CRM 2015 XRM JScript SOAP.REST retrieveRecord

Beware of the field you used for. If its simple field, noproblem. If you use lookup or entityreference, you can get value with array or object. Also don’t forget SDK.REST work asynchronous. So you must write return code in the block.

function findPriceLevelIdandexec(claimid) {
    SDK.REST.retrieveRecord(claimid, "new_warrantyclaim", null, null,
        function (wc) {
            var lookupObj = new Array();
            lookupObj = wc.new_pricelistid;
            if (lookupObj != null)
           {
            var lookupRecordGuid = lookupObj.Id; 
            execpricecalc(lookupRecordGuid );
            }
        }
        ,
        function (error) { alert(error.message); }
    );

}

Leave a Reply

Your email address will not be published. Required fields are marked *