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:
GetServerAndServiceName(ServerPortTxt,ServiceTxt);
CASE _ObjectType OF
_ObjectType::Page : RunObjectTxt := STRSUBSTNO('runpage?page=%1',_ObjectNo);
_ObjectType::Report : RunObjectTxt := STRSUBSTNO('runreport?report=%1',_ObjectNo);
END;
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
EXIT(HyperlinkTxt);
Any ideas?
Comments
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Object Manager
@ara3n
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...
edit:
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!