locked
Assign Records - XrmServiceToolkit Async Callback RRS feed

  • Question

  • Hi all,

    I am using the lovely XrmServiceToolkit to assign records in Jscript.

    http://xrmservicetoolkit.codeplex.com

    How do I process an error from an asynchronous callback of an Assign function?

    At the moment my Assign method method in  async  DOES NOT WORK - I get 'response is not defined':

    function mainFunction(){
    
    XrmServiceToolkit.Soap.Assign('mta_alert', selectedItems[i], 'systemuser', '0fd41a2f1f0be51180c0000d3ad01a40', callback);
    
    }
    
    function callback(response){
    
    alert(response);
    
    }

    As a workaround I have to create the method synchronously:

    try {
       
          XrmServiceToolkit.Soap.Assign('mta_alert', selectedItems[i], 'systemuser', '0fd41a2f1f0be51180c0000d3ad01a40');
     }
    catch (e) {
       alert(e.message);
     }

    THIS WORKS ! But ideally I would like to handle the response asynchronously.

    Any help would be appreciated.

    Cheers



    • Edited by Stanley_Lai Tuesday, September 29, 2015 8:07 AM
    Tuesday, September 29, 2015 8:01 AM