Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archive)
Answered

How to get current Application ID in CRM Plugin

(0) ShareShare
ReportReport
Posted on by 55

Hi,

I have requirement that i need to append application ID to record URL and save it in CRM form field using Plugin.

Is there any solution to achieve the same?

  • Divya Bharti Profile Picture
    55 on at
    RE: How to get current Application ID in CRM Plugin

    Thanks i used this same approach i was able to do this. I used system workflow to pass application name on my condition and in custom workflow based on parameter name retrieved app ID.

  • Suggested answer
    Kumar Viju Profile Picture
    1,026 on at
    RE: How to get current Application ID in CRM Plugin

    Assuming the Application ID is always a constant value depending on the App the user has access.

    The recommended way is to create an environmental variable; this is a widespread practice wherein you may have an entity dedicated to holding constant values.

    Create a config entity in your system and create parameters for Key and Value(similar to config files).

    Ex.

    Key - SalesAppId

    Value - "ascef47845345erer454545ew"

    In your plugin, access this variable by passing Key and retrieving the Value from Config Entity. 

    Tip:

    - For Plugin, create a helper class and have the function defined to access any key and related values to be utilized in future

    - For Config Entity, Create attribute type Multiline Text Type so that you can reuse for future large constant values (Eg. FetchXml Script).

  • Verified answer
    Kumar Viju Profile Picture
    1,026 on at
    RE: How to get current Application ID in CRM Plugin

    Assuming the Application ID is always a constant value depending on the App the user has access.

    The recommended way is to create an environmental variable; this is a widespread practice wherein you may have an entity dedicated to holding constant values.

    Create a config entity in your system and create parameters for Key and Value(similar to config files).

    Ex.

    Key - SalesAppId

    Value - "ascef47845345erer454545ew"

    In your plugin, access this variable by passing Key and retrieving the Value from Config Entity. 

    Tip:

    - For Plugin, create a helper class and have the function defined to access any key and related values to be utilized in future

    - For Config Entity, Create attribute type Multiline Text Type so that you can reuse for future large constant values (Eg. FetchXml Script).

  • Verified answer
    Charles Abi Khirs Profile Picture
    3,569 on at
    RE: How to get current Application ID in CRM Plugin

    Hello,

    What I suggest is to create a Parameters entity that has 2 fields: Name (i.e ApplicationGUID) and Value (<Application GUID value>).

    In your plugin code, retrieve your parameter based on the needed Name and get the Value of the Application Id that you can use in the rest of your code.

    The downside is that you have to add this entity to your solution when deployment and create the record in your new environment with the correct Application ID

  • David Jennaway Profile Picture
    14,061 on at
    RE: How to get current Application ID in CRM Plugin

    As per the previous post, the Application ID is solely available on the client-side - a plugin is not aware of the Application ID. Therefore your only option is to use client script on a form to get the Application ID. You can do this is in the OnSave event, and put the Application ID in a field on the entity, which can then be read by a plugin. You can get the Application ID using the getCurrentAppProperties method

  • Divya Bharti Profile Picture
    55 on at
    RE: How to get current Application ID in CRM Plugin

    Hi problem is that we require to update this value no matter from where record is created.

    With this logic it will restrict to create with Form and run JS everytime.

  • cloflyMao Profile Picture
    25,194 on at
    RE: How to get current Application ID in CRM Plugin

    Hi Divya,

    We could only get application id by javascript. 

    Did you plugin only fire at some simple events such as on creation of record or on update of record?

    If so, a workaround is that you could convert your plugin into a custom workflow activity:

    1. Run javascript at onSave event of form.

    2. We can get both entity name and app id by client API.

    3. Call the custom workflow with params from step 2 by ExecuteWorkflow action.

    Regards,

    Clofly

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

Community Spotlight of the Month

Kudos to Mohamed Amine Mahmoudi!

Blog subscriptions now enabled!

Follow your favorite blogs

TechTalk: How Dataverse and Microsoft Fabric powers ...

Explore the latest advancements in data export and integration within ...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 283,860 Test role Public

#2
Ludwig Reinhard Profile Picture

Ludwig Reinhard Microsoft Employee

#3
Martin Dráb Profile Picture

Martin Dráb 225,155 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans