Unified Service Desk – Logged in user details in Hosted controls

Hi,

You may need Logged in user details for different purposes in hosted controls.

Here is the way to get them from replaced parameters.

// This will give you actual logged in customer

var customer = (Microsoft.Crm.UnifiedServiceDesk.Dynamics.DynamicsCustomerRecord)localSession.Customer.DesktopCustomer;
Dictionary<string, CRMApplicationData> userInfo = null;
if (!customer.CapturedReplacementVariables.TryGetValue(“$User”, out userInfo))
return;

CRMApplicationData fullname = null;
if (!userInfo.TryGetValue(“fullname”, out fullname))
return;

CRMApplicationData userId = null;
if (!userInfo.TryGetValue(“systemuserid”, out userId))
return;

Dictionary<string, CRMApplicationData> systemUserInfo = null;
if (!customer.CapturedReplacementVariables.TryGetValue(“systemuser”, out systemUserInfo))
return;

Happy coding..!

Sreeni Pavalla

Advertisement

Published by Sreeni Pavalla

Working as a Assistant Technical Manager in Positive Edge Technologies. Having over 11 years of extensive hands-on experience in MS Dynamics CRM 4.0, 2011, 2013, 2015, 2016, Dynamics 365 with over 5 years of experience in CRM Online. You can visit my blog here https://sreenipavalla.me/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: