Skip to main content

Notifications

Community site session details

Community site session details

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

how to get user email from plugin and update its

(0) ShareShare
ReportReport
Posted on by

ITracingService tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService));
//get the execution context from the service provider
IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
//obtain the org service ref to make web service calls
IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);

try
{
Entity target = (Entity)context.InputParameters["target"];
Entity objUser = service.Retrieve("systemuserid", userGuid, new ColumnSet("primaryemailaddress", "systemuserid"));

if (objUser != null && objUser.Contains("primaryemailaddress") && objUser["primaryemailaddress"] != null)
{
string Useremail = (string)objUser["primaryemailaddress"];
}

}
catch (Exception ex)
{
throw (ex);
}
}

  • Suggested answer
    ankit_singhal Profile Picture
    560 on at
    RE: how to get user email from plugin and update its

    Then you need to first get the guid of user lookup then based on that guid you can get the email address from user record.

  • Community Member Profile Picture
    on at
    RE: how to get user email from plugin and update its

    Yes

  • ankit_singhal Profile Picture
    560 on at
    RE: how to get user email from plugin and update its

    is there any lookup of that user on account record?

  • Community Member Profile Picture
    on at
    RE: how to get user email from plugin and update its

    account

  • ankit_singhal Profile Picture
    560 on at
    RE: how to get user email from plugin and update its

    Please explain your requirement. On which entity your plugin is trigger? you can use fetch xml as well to get your email in plugin

  • Community Member Profile Picture
    on at
    RE: how to get user email from plugin and update its

    Hi i need help on this

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 225 Super User 2025 Season 1

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 106 Most Valuable Professional

#3
Eugen Podkorytov Profile Picture

Eugen Podkorytov 102

Overall leaderboard

Product updates

Dynamics 365 release plans