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).