RSS

Dynamics NAV: How To Run Objects From RTC (Role Tailored Client)

29 Aug

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
RunObjects

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])
Source: MSDN

“Object Type” sounds nice 😉 And if we go back to the Dynamics NAV blog we can see following examples:

GETURL(CLIENTTYPE::Windows,COMPANYNAME,OBJECTTYPE::Table,27) dynamicsnav://MyServer:7046/DynamicsNAV71/CRONUS/runtable?table=27

GETURL(CLIENTTYPE::Windows,COMPANYNAME,OBJECTTYPE::Page,27) dynamicsnav://MyServer:7046/DynamicsNAV71/CRONUS/runpage?page=27

GETURL(CLIENTTYPE::Windows,COMPANYNAME,OBJECTTYPE::Report,6) dynamicsnav://MyServer:7046/DynamicsNAV71/CRONUS/runreport?report=6

GETURL(CLIENTTYPE::Windows,COMPANYNAME,OBJECTTYPE::Codeunit,5065) dynamicsnav://MyServer:7046/DynamicsNAV71/CRONUS/runcodeunit?codeunit=5065

GETURL(CLIENTTYPE::Windows,COMPANYNAME,OBJECTTYPE::Query,9150) dynamicsnav://MyServer:7046/DynamicsNAV71/CRONUS/runquery?query=9150

GETURL(CLIENTTYPE::Windows,COMPANYNAME,OBJECTTYPE::XmlPort,5150) dynamicsnav://MyServer:7046/DynamicsNAV71/CRONUS/runxmlport?xmlport=5150

So let us use this information together with the function HYPERLINK and extend our run function to
RunObjectsExtended

    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! 🙂

 
2 Comments

Posted by on 2015-08-29 in Okategoriserade

 

Tags: , , ,

2 responses to “Dynamics NAV: How To Run Objects From RTC (Role Tailored Client)

  1. Tomas

    2015-09-28 at 11:34

    This is cool 🙂

    Like

     

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

 
The BC Docs Librarian

Tips and news for AL programmers

Stefan Maroń

Dynamics 365 Business Central

James Pearson

Thoughts about Dynamics 365 Business Central, Git, Azure DevOps, PowerShell, Automated Testing, Visual Studio Code...and maybe some other stuff

Roberto Stefanetti BLOG

MVP & MCT Microsoft Dynamics 365 Business Central, Powershell, Azure, SQL Server

JoeBrown

DevOps starts with culture!

Comments for DevOps ABCs Blog

Reflections from the ERP field

DevOps ABCs Blog

Reflections from the ERP field

Dynamics 365 Business Central for Partners

Reflections from the ERP field

Freddys blog

Learn something new... - then Teach someone!

Stefano Demiliani Technical Blog

Reflections from the ERP field

David Worthington's NAV Performance Blog

Micosoft Dynamics NAV Performance Testing & Optimization

Freddys Blog

Reflections from the ERP field

Marije Brummel Blog | Business Central, Azure and more...

Design Patterns, Performance, Clean Code

Vjeko.com

Ideas in the cloud

Goprowe AB

Reflections from the ERP field

ArcherPoint

Reflections from the ERP field

The NAV Viking´s Blog

- Sharing my experience in the Dynamics NAV world

Comments for

Reflections from the ERP field

Nav Can Be Fun

Its Really Fun to Work with Microsoft Dynamics Nav / D365 Business Central

%d bloggers like this: