In the pre RTC versions of Dynamics NAV it was really simple to run/view objects from the client. Nowadays when we are using RTC it is not quite that simple since by standard we don’t have object designer in RTC (Role Tailored Client). At least yet 🙂
But there is a trick that you can use to achieve this. You need to create a page on the table object. After that add a button that runs the current record. Microsoft described this a couple of years ago in a blog post (How to start any object in Role Tailored Client)
But how about tables and querys?
If we look at our run function it will look something like this
Unfortunately we don’t have anything for tables 😦
But after reading the blog post Creating URLs to Microsoft Dynamics NAV Clients I found some new possibilities.
The URL builder function, GETURL, is released in Microsoft Dynamics NAV 2013 R2 to reduce coding time for developers who need to create various URL strings to run application objects in either the win client, the web client, or on web services. In addition, the GETURL function makes multitenancy features more transparent to C/AL developers.
Ok, so this is a 2013 R2 feature to begin with. What options do have with this function?
The format is:
[String :=] GETURL(ClientType[, Company][, Object Type][, Object Id][, Record])
“Object Type” sounds nice 😉 And if we go back to the Dynamics NAV blog we can see following examples:
So let us use this information together with the function HYPERLINK and extend our run function to
PROCEDURE Execute@1000000000(); BEGIN CASE Type OF Type::Page : PAGE.RUN(ID); Type::Codeunit : CODEUNIT.RUN(ID); Type::Report : REPORT.RUN(ID); Type::XMLport : XMLPORT.RUN(ID); Type::Table : HYPERLINK(GETURL(CLIENTTYPE::Current,COMPANYNAME,OBJECTTYPE::Table,ID)); Type::Query : HYPERLINK(GETURL(CLIENTTYPE::Current,COMPANYNAME,OBJECTTYPE::Query,ID)); END; END;
After a quick try it works! 🙂
However, this scenario only works when you are within the same domain as the NAV server. So when you are connected remotely to another domain via ClickOnce or normal client you need to take care of the MyServer issue. (dynamicsnav://MyServer:7046/DynamicsNAV71)
Microsoft writes the following about this:
Public\external endpoints may differ from internal addressing. For example, an external port number could map to a different internal port number, or you may be using a domain name to identify your Microsoft Dynamics NAV server. In such cases, the Microsoft Dynamics NAV server instance cannot automatically identify your network configuration settings.
To solve this problem, find the server instance configuration file and update the configuration keys for base URLs, such as the following key:
<add key=”PublicWebBaseUrl” value=”” />
You can set a Base URL for the Windows client, the web client, as well as SOAP and ODATA services, each independently. For example, you could set the Web Client Base URL to “cronus.nav.net/…/”. From this point forward, the GETURL function will return URLs starting with this base address that you have specified.
Happy running objects! 🙂
2015-09-28 at 11:34
This is cool 🙂