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);
}
}
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.
Yes
is there any lookup of that user on account record?
account
Please explain your requirement. On which entity your plugin is trigger? you can use fetch xml as well to get your email in plugin
Hi i need help on this
Daivat Vartak (v-9d...
225
Super User 2025 Season 1
Muhammad Shahzad Sh...
106
Most Valuable Professional
Eugen Podkorytov
102