Upon loading a Quote form, I want to show an alert based on the value of a field called "new_stage" from the related opportunity. I used CRM REST Builder for retrieveRecord and then added an if statement to check this field and show the alert. Here is the error. I'm new to javascript so I'm having trouble with my code. Any help would be appreciated.
function retrieveStage(opportunityId) { SDK.REST.retrieveRecord( opportunityId, "Opportunity", "opportunity_quotes/new_stage", 'opportunity_quotes', function (result) { var stage = result.opportunity_quotes.new_stage; }, function(error) { Xrm.Utility.alertDialog(error.message); }); if (stage != null && stage != 1) { alert("This is my test message."); } }
*This post is locked for comments