Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

Using IOrganizationService how to retrieve GUID column from an entity record

(0) ShareShare
ReportReport
Posted on by 15

Using IOrganizationService how to retrieve GUID column from an entity record? 

IOrganizationService service = serviceFactory.CreateOrganizationService(workflowContext.InitiatingUserId);

id = Guid.Parse(activityLogId);

Entity entity = service.Retrieve("entityName", id, columnSet));

guidCol = ??

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,961 Moderator on at
    RE: Using IOrganizationService how to retrieve GUID column from an entity record

    Hi,

    You can get current record Id from target Entity as below.

    Entity target= context.inputParameters["Target"]  as Entity;

    Guid entityId= target.Id.

  • Suggested answer
    Abdul Wahab Profile Picture
    Abdul Wahab 12,081 Moderator on at
    RE: Using IOrganizationService how to retrieve GUID column from an entity record

    Hi Tanmay Pal,

     Is this you are looking for: Guid primaryEntityId = context.PrimaryEntityId;?

    IPluginExecutionContext context =
                    (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
    Guid primaryEntityId = context.PrimaryEntityId;
    IOrganizationServiceFactory serviceFactory =
                    (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
    IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
    Entity entity = (Entity)context.InputParameters["Target"];

    If I answer your question then please mark it as verified.

    Let me know if I can provide you with more details.

    Thanks
    Regards,

    Abdul Wahab
    Power Platform & Customer Engagement Developer/Lead/Solution Architecture/Project Manager
    Direct/WhatsApp: 923323281237
    E-mail: abdulwahabubit@outlook.com
    Skype: abdul.wahabubit
    Linkedin: www.linkedin.com/.../

  • Guido Preite Profile Picture
    Guido Preite 54,073 Moderator on at
    RE: Using IOrganizationService how to retrieve GUID column from an entity record

    can you explain what are you trying to achieve? thanks

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,430 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans