Skip to content Skip to sidebar Skip to footer

Accessing The Logged In Crm User From Custom Page

We have Dynamics CRM and a webform which is loaded from the ribbon, essentially inside an iframe. How do we get the logged on user? On the top right, is my name and image as logge

Solution 1:

The below code should give you what you want. Read more

Xrm.Page.context.getUserName();

But based on popup or inline embedded iframe, you have append in front.

window.parent.Xrm.Page.context.getUserName();
window.opener.Xrm.Page.context.getUserName();

Solution 2:

In one of the all time great hacks ... we got around the problem by embedding another iFrame into a web resource!

So the web resource can call Xrm.Page.context.getUserName() and then concatenate that to the querystring which we then pass into an iFrame. because CRM thinks the iframe is just one control, it allows all the webform commands taking place inside of it and doesn't give any 500 errors.

Post a Comment for "Accessing The Logged In Crm User From Custom Page"