Articles

Affichage des articles du octobre, 2021

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)                         {                             return result;                         }                     },                     function (error)                     {                         Xrm.Navigation.openAlertDialog(error.message);                     }                 )   ); }}); the function that call the promise async function onChange_regarding(executionContext) {     var formContext = executionContext.getFormContext();     var regarding = formContext.getAttribute("regardingobjectid").getValue();          var mycurrentSubject = formContext.getAttribute("subject").getValue();     if (regarding != null)     {