Unified Service Desk – Logged in user details in Hosted controls

No comments

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

Advertisements

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.