Notifications
Announcements
No record found.
Hi, I am creating a simple plugin, how can I get the attributes from one entity, and the record ID as well. For example, I want to get the current contact ID on the contact form.
Thanks
*This post is locked for comments
To get the ID of the record you are running the plugin on:
entity = (Entity)context.InputParameters["Target"]; Guid contactid = entity.Id;
To get an attribute of the record you are running the plugin on (You will have to change the data type depending on the field you want to get):
var fullname = ((string)(entity.Attributes[fullname]));
Hi
You can obtain the record id (contactid) from Target of the input parameters collection.
For example (update message):
// The InputParameters collection contains all the data passed in the message request. if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity) { // Obtain the target entity from the input parameters. Entity entity = (Entity)context.InputParameters["Target"];
Here you can get the id from entity.Id
https://msdn.microsoft.com/en-us/library/microsoft.xrm.sdk.entity.aspx
Please refer the following:
[View:https://msdn.microsoft.com/en-us/library/gg309673.aspx:750:50]
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
SA-08121319-0 4
Calum MacFarlane 4
Alex Fun Wei Jie 2