Hyperlink with space in COMPANYNAME not working

deV.chdeV.ch Member Posts: 543
edited 2011-03-01 in NAV Three Tier
I have a problem in NAV2009 R2 with a hyperlink and a companyname that has spaces in the URL

When i run the hyperlink from the shell without spaces i get an error (of course).
When i run the hyperlink from the shell with %20 it works.

So i added url encoding to the companyname in NAV and pass that to the HYPERLNIK() function.

The strange thing is that the string that is sent to the shell is with spaces and not with %20! I know that because i changed the application which reacts to protocol DynamicsNAV: to a self made c# application and this gets the url with spaces as argument.

It seems like the HYPERLINK() function changes my %20 to spaces (what imo makes no sense...) before sending it to the shell.

this is the code i use to generate the link:
CASE _ObjectType OF
  _ObjectType::Page   : RunObjectTxt := STRSUBSTNO('runpage?page=%1',_ObjectNo);
  _ObjectType::Report : RunObjectTxt := STRSUBSTNO('runreport?report=%1',_ObjectNo);
HyperlinkTxt += STRSUBSTNO('DynamicsNAV://%1/%2/%3/%4',ServerPortTxt,ServiceTxt,URLEncode.URLEncode(COMPANYNAME),RunObjectTxt);
IF _Mode <> _Mode::" " THEN
  HyperlinkTxt += STRSUBSTNO('&mode=%1',_Mode);
MESSAGE(HyperlinkTxt); // <= this shows the correct URL with &20

Any ideas?


  • ara3nara3n Member Posts: 9,253
    I suggest to use windows host script instead.
    Ahmed Rashed Amini
    Independent Consultant/Developer

    blog: https://dynamicsuser.net/nav/b/ara3n
  • reijermolenaarreijermolenaar Member Posts: 256
    Did you already tried to use a '+' instead of %20?
    Reijer Molenaar
    Object Manager
  • deV.chdeV.ch Member Posts: 543
    Using the '+' sign causes an error that this company doesn't exist...

    Of course this would be a solution, in fact i currently try to use interop to start the hyperlink, but imo this is not a good solution, because the built in function Hyperlink should be capable of doing this and no workaround should be needed for such a simple function...

    for now i did it with your solution ara3n, because dotnet requires SPN or the client settings changed to "ServicePrincipalNameRequired" = false , and i don't want to do one of this for such a simple requirement...
    a shame that dotnet interop on client side needs SPN or ServicePrincipalNameRequired=false to NOT ask for permission EVERY time!
Sign In or Register to comment.