Hello All,
I need to send email to initiating users's manager via plugin C# code.
Can anyone help suggest me how i can get user's manager via code in plugin.
*This post is locked for comments
You can use the following code:
private Guid RetrieveUserManager(Guid userId)
{
ColumnSet columnset = new ColumnSet("systemuserid", "parentsystemuserid");
Entity user = service.Retrieve("systemuser", userId, columnset);
Guid parentSystemUserId = user.Contains("parentsystemuserid") ? ((EntityReference)(user["parentsystemuserid"])).Id : Guid.Empty;
return parentSystemUserId;
}
Hi,
Inside plugin you can get initiating user and Organization Service. Using it , retrieve manager details from corresonding SystemUser record
To send email refer
you need use fetchxml or linq to query based on the user id.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156