Hi,
We used to write soap call method for getting the user name on the form in JavaScript.
We used to get User Id by using the following line.
Use the following code to set the lookup field in JavaScript.
var setUserLoopUp = new Array();
setUserLoopUp[0] = new Object();
setUserLoopUp[0].id = Xrm.Page.context.getUserId();
setUserLoopUp[0].name = Xrm.Page.context.getUserName();
setUserLoopUp[0].entityType = 'systemuser';
// Set the look up field.
Xrm.Page.getAttribute("LookupField").setValue(setUserLoopUp);
For more information on Setting and Getting Lookups
Hope this helps.
--
Happy CRM'ing
Gopinath
We used to write soap call method for getting the user name on the form in JavaScript.
We used to get User Id by using the following line.
Xrm.Page.context.getUserId();
Now in the same way, we can also get the logged in user name.
Xrm.Page.context.getUserName();Use the following code to set the lookup field in JavaScript.
var setUserLoopUp = new Array();
setUserLoopUp[0] = new Object();
setUserLoopUp[0].id = Xrm.Page.context.getUserId();
setUserLoopUp[0].name = Xrm.Page.context.getUserName();
setUserLoopUp[0].entityType = 'systemuser';
// Set the look up field.
Xrm.Page.getAttribute("LookupField").setValue(setUserLoopUp);
For more information on Setting and Getting Lookups
Hope this helps.
--
Happy CRM'ing
Gopinath
No comments:
Post a Comment