Plataan - Microsoft Dynamics - Learning & Competence Management Vincent Bellefroid Koen Stox Steven Renders Conny Schuddinck Steffie Alexiou
A blog about Microsoft Dynamics
Home Archives Subscribe Plataan website

« Get trained | Main | Sure Step Spring Release 2009 »

23/03/2009

How can I create a Link in an email that opens a specific page in the Role Tailored Client?

In the Classic Client for Dynamics NAV, and in older versions (4.X, 5.x) when creating emails from C/AL code, we had the possibility to use the Form.URL method and include it into the body of an email. Whenever someone then clicked on the Link, the Classical Client would be opened and the corresponding Form was shown.

In Dynamics NAV 2009, in the Role Tailored Client, the Form.URL method is no longer supported. The RTC does not display Forms, it uses Pages and Pages do not have an URL method.

So, how can we then create a Link towards a specific Page?

To solve this, you have to create the URL as follows: dynamicsnav:////runpage?page=<Page No>&bookmark=<URL>.

But how can we get the BookmarkURL for a specific Page?

Well, what you need to do is use a RecordRef variable that points towards the specific Page and use its RecordId property. The problem might then be that your code is in a Codeunit and can sometimes be called from within a Form or from within a Page. How can you make your code compatible with both environments?

To solve these kinds of issues, in C/AL there's a new function available: ISSERVICETIER:

  • If you call ISSERVICETIER from the Classic client, then the function returns false.
  • If you call ISSERVICETIER from the RoleTailored client, then the function returns true.

This allows you to execute different code that is based on the client that you are running.

Here's an example of how you can write your code, to be compliant with the Classical Client and the Role Tailored Client:

Keep in mind that in the past (before Dynamics NAV 5.0 and 2009) you could use the"Mail" Codeunit to create and send emails. As from Dynamics NAV 5 and 2009 it is also possible to use SMTP (Codeunit "SMTP Mail") to do this.

In the code example above I used a Mail Codeunit variable to send mail in the Classic Client and I used SMTP for the Role Tailored Client. But of course you can also use SMTP from within the Classical Client.

Comments

thanks a lot.. it's very good article.

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

December 2009

Mon Tue Wed Thu Fri Sat Sun
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      

Plataan Community

Visit us on LinkedIn Visit us on Facebook Visit us on Twitter