Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum

Getting the appid included in the Record URL(Dynamic) in a Dynamics 365 email workflow

Posted on by Microsoft Employee

I've been tasked with creating a workflow in Dynamics 365 which can send emails (the easy bit). However, the email has a link to the record (also easy using the Record URL(Dynamic) attribute). However, we use Apps in our Dynamics instance and the link generated by the workflow using Record URL(Dynamic) doesn't include the app id and so when users click the link they are taken to Dynamics but are now outside the app.

My question is, is there a supported way to appending the App Id to the Record URL(Dynamic) attribute?

I've already searched for answers to this and cant find any. My solution was to create an Action which takes as input the Record and app ID, appends them and outputs them as an output parameter. This works to be honest, but I'm wondering if I'm reinventing the wheel and there is an easier way to achieve this.

Thanks and hope this helps anyone else with the same issue.

  • Suggested answer
    amb2000 Profile Picture
    amb2000 1,385 on at
    RE: Getting the appid included in the Record URL(Dynamic) in a Dynamics 365 email workflow

    I would suggest you get this free Ultimate Workflow Toolkit from Andrew Butenko, and read this article that explains using a feature in the toolkit to achieve what you are looking for.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Getting the appid included in the Record URL(Dynamic) in a Dynamics 365 email workflow

    getCurrentAppUrl() only returns teh app URL "without the appId"

    The only time I've seen this happen is if you are in the default instance of CRM. Make sure you are in the app when you run the above script. 

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Getting the appid included in the Record URL(Dynamic) in a Dynamics 365 email workflow

    Hello,

    You can check my post - butenko.pro/.../howto-send-record-url-pointing-to-specific-model-driven-apps

  • Rkaur Profile Picture
    Rkaur 67 on at
    RE: Getting the appid included in the Record URL(Dynamic) in a Dynamics 365 email workflow

    getCurrentAppUrl() only returns teh app URL "without the appId" . i tried that and that's when while searching came across "getCurrentAppProperties() method". which will return appId value but jus trying to make it work.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Getting the appid included in the Record URL(Dynamic) in a Dynamics 365 email workflow

    Sorry in your case it will be

    Xrm.Utility.getGlobalContext().getCurrentAppUrl()

    Use parent only if its a html resource on the page.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Getting the appid included in the Record URL(Dynamic) in a Dynamics 365 email workflow

    Ok I have done something similar on the front end using ....

    parent.Xrm.Utility.getGlobalContext().getCurrentAppUrl()

    This will give you the URL with App ID. You can then append the rest of the URL to for the complete link for your record ID. Have you tried this?

  • Rkaur Profile Picture
    Rkaur 67 on at
    RE: Getting the appid included in the Record URL(Dynamic) in a Dynamics 365 email workflow

    Hi,

    when you say "I created a record called 'App ID'. I set the app ID for each environment. " i assume you are setting it manually.

    which is what you are later using via custom workflow then to put in your record URL.

    i m looking for a way to avoid this manual entry. there should be a method somewhere which can tell us AppId value like the one i pasted above "getCurrentAppProperties".

    however, i'm just struggling to make it work. The definition of this method is that it outputs all the app property values.

    docs.microsoft.com/.../getcurrentappproperties

    My reqmnt is also to build the record uRL dynamically and i'm using MS flow which will send out emails to the users with record URL's . and my record is a Work Order entity record which is now only available in Field Service Hub applications and not in traditional UI.

    Thanks.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Getting the appid included in the Record URL(Dynamic) in a Dynamics 365 email workflow

    Hi,

    You havent given much detail on your requirement, but if your requirement is like mine, then this what I did. 

    I needed to send emails which had a link to the record. The link needed to take the user to the App and not the default CRM App. Here's what I did.

    Create an Action: Ensure it has an input param (string) and an output param (string).

    Step 1 : Assign the input param to the output param

    Step 2: Call a Custom Workflow Activity which retrieves a config entity record. Since we have multiple environments and the app ID in DEV is different to the the one in our SIT environment, I created a custom entity called Params and in this entity I created a record called 'App ID'. I set the app ID for each environment. Then using the Custom Workflow Activity I wrote to retrieve any param entity record, I retrieve the record with the key 'App ID'. So in this step I now have the App ID.

    Step 3: Now I simply append the app ID to the output param. 

    The output param now contains the full URL with App ID.

    As you know you know have an action that returns Record URLs with AppIDs. 

    Now you can call this Action from any workflow by passing in the 'Record URL (Dynamic)' to this Action and it will return a Record URL with App ID.

    Hope this helps, if not provide more info where you are stuck and I'll try my best to help.

    Regards,

    Andrew.

  • Rkaur Profile Picture
    Rkaur 67 on at
    RE: Getting the appid included in the Record URL(Dynamic) in a Dynamics 365 email workflow

    Hello,

    Is there any update on this question request.

    im also looking for a way to dynamically fetch appid to navigate directly to the record sitting in the Hub application view not the standard view.

    i came across this - var globalContext = Xrm.Utility.getGlobalContext(); globalContext.getCurrentAppProperties().then(successCallback, errorCallback);

    where function successcall back returns application property values including appid. but not able to make it work.

    Any suggestion please.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans