Rebrand your Web Client

If you are working with Dynamics 365 for Financials, when it comes time to submitting your extension to AppSource, you need to supply some marketing materials, for examples walkthroughs and videos.

As the only option right now is to use the Dynamics NAV 2017 Web Client for testing (no Dynamics 365 sandbox…yet!), it can be a pain that the title ribbon in the Web Client says Dynamics NAV. When submitting to AppSource, there can be no trace of NAV in any of your marketing materials.

But with a small change to your Web Client url, you can change that title ribbon from this…

navribbon

to this…

d365ribbon

You do this by simply adding the following parameter to the end of the url:

?aid=fin

Example:

http://localhost:8080/DynamicsNAV100/WebClient/?aid=fin

That’s it! Bookmark both versions of the url to easily switch between a NAV demo and a Dynamics 365 demo!

Advertisements

Determining the right client

In certain scenarios, it may be important to know what client that the user is working in. Perhaps you have an action that doesn’t work in the Web Client, or maybe you have some code that interacts with a device camera that only works in the Device Client. Or maybe you want to send a link to your users that allows them to open a record, and we want to make sure the link is for the correct client?

First, I want to be clear that what I am describing here is based on the Dynamics NAV 2017 platform. Yes, this means the Dynamics 365 for Financials platform falls under this umbrella as well. Perhaps bits and pieces are supported on older platforms, but my intention is to never look backwards and keep this train moving forward!

Now to it…

There are some system variables that we need to get familiar with:

  • CLIENTTYPE
    • an option variable that contains the various client types:
      • Windows
      • Web
      • SOAP
      • OData
      • NAS
      • Background
      • Management
      • Tablet
      • Phone
      • Desktop
      • ODataV4
  • CURRENTCLIENTTYPE
    • Returns the client type that is currently executing the code.
  • DEFAULTCLIENTTYPE
    • Returns the default client type, as defined in the Dynamics NAV Server configuration. For more information click here.

Example 1: Show an action only in the Windows Client.

  • In the Development Environment, design the page that contains the action.
  • Make sure that the action does something. If it does not do anything, then it will always be hidden. For testing purposes you can add the following code to the onAction trigger for the action:
MESSAGE('A message for testing');
  • Add a global Boolean variable named ‘showMyAction’:

globalvariable

  • Assign the global variable to the Visible property of the action that you wish to conditional show/hide (you can show this property as a column in the Action Designer now!!):

actiondesigner

  • Add the following code to the onOpenPage trigger:
showMyAction := CURRENTCLIENTTYPE = CLIENTTYPE::Windows;
  • Close, save and compile your page.
  • If you run the page in the Web Client for example, you will not see the action on the ribbon of the page. Running the page from the Windows Client will show the action.

Example 2: Create a url that takes a user to the first customer record.

  • In the Development Environment, create a new codeunit.
  • In the onRun trigger, create the following local variables:

capture-globalvariables

  • In the onRun trigger, add the following code:
Customer.FINDFIRST;
url := GETURL(DEFAULTCLIENTTYPE,COMPANYNAME,OBJECTTYPE::Page,PAGE::"Customer Card",Customer);
MESSAGE(url);
  • Close, save and compile the codeunit.
  • From the Development Environment run the codeunit. A message should appear on screen with the url that was generated. In the example below, my default client was set to be the Web Client.
http://localhost:8080/DynamicsNAV100/WebClient?company=CRONUS%20USA&page=21&bookmark=27%3bEgAAAAJ7CDAAMQAxADIAMQAyADEAMg%3d%3d

Hopefully you get a sense now of how you can condition your code based on the different Dynamics NAV client types.

That’s all for today!

A promise of sorts

Well, I’ve not exactly been very active with this site. A smattering of posts over the years, but nothing too consistent.

I am putting up this post to hopefully energize myself into committing to putting up more posts on a more frequent basis.

You see, while I am a developer at heart, I only recently got back into development full time, and it is amazing!! So amazing, that I have been going full steam ahead not looking up from it.

What am I doing? Well…….I’ve climbed aboard the Dynamics 365 for Financials train, and I’ve been busily building an app (or two!) that at this time, has been validated by Microsoft and is just waiting to be deployed to AppSource.

So, back to the point. I am going to try and do better here. I have learned a lot of information that I have found is not as easy to come by as it probably should be, especially being an early adopter that’s moving full steam ahead with NAV extensions. My goal is to be able to put up little tidbits (and bytes! haha, see what I did there?) of things I come across so that perhaps it’s not as hard for the next developer to get this information.

We’ll see how it goes….