Hi,
I am calling the below code from a ribbon button 'CloseAsWon' in opportunity form, it is throwing 'unable to get property 'retrieveRecord' of undefined or null reference'. Can you pls let know what am i missing. Also is that WebApi.retrieveRecord will work from ribbon context.
function CloseOpportunityCheck()
{
var owner = Xrm.Page.getAttribute('ownerid').getValue()[0].id;
owner = owner.replace(/[{}]/g, "");
//To get the businessunit of the Opportunity Owner.
Xrm.WebApi.retrieveRecord("systemuser", "+owner+", "?$select=_businessunitid_value").then(
function success(data)
{
alert('Hi');
},
function (error)
{
Xrm.Utility.alertDialog(error.message);
});
}
*This post is locked for comments
I have the same question (0)

Report
All responses (
Answers (