promise example
the promise async function getrecord (recordtype,recordid) { return new Promise(resolve => {{ resolve(Xrm.WebApi.retrieveRecord(recordtype, recordid ).then( function success(result) { // perform operations on record retrieval if (result) { ...