Hi, this is probably a simple answer but can't get my head quite around it
In quote product I want to be able to put the current person as the salesperson.
So far I have the following;
function retrieveDefaultSales()
{
var check = Xrm.Page.getAttribute("salesrepid").getValue();
if (check == null)
{
var salesid = Xrm.Page.context.getUserId();
var option = "$select=DomainName&$filter=SystemUserId eq guid'" + salesid + "'";
SDK.REST.retrieveMultipleRecords("SystemUser", option, retrieveUser, function(error) { alert(error.message); }, function(){});
Xrm.Page.getAttribute("salesrepid").setValue(salesid);
}
}
function retrieveUser(retirevedUser)
{
if(retirevedUser.length > 0)
{
var salesperson = retirevedUser[0].DomainName;
alert(salesperson);
Xrm.Page.getAttribute("salesrepid").setValue(salesperson);
}
}
Any ideas how to get this actually working? I don't seem to have any error messages coming up it simply isn't populating the lookup field
*This post is locked for comments
I have the same question (0)