Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Answered

How to get current Application ID in CRM Plugin

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
    Divya Bharti 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
    Kumar Viju 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
    Kumar Viju 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
    Charles Abi Khirs 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
    David Jennaway 14,063 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
    Divya Bharti 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
    cloflyMao 25,198 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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans