के माध्यम से साझा करें


Xrm.WebApi.online.execute (क्लाइंट एपीआई संदर्भ)

एकल क्रिया, फ़ंक्शन या CRUD ऑपरेशन निष्पादित करें।

नोट

यह विधि केवल ऑनलाइन मोड (Xrm.WebApi.online) के लिए समर्थित है।

सिंटैक्स

Xrm.WebApi.online.execute(request).then(successCallback, errorCallback);

पैरामीटर

नाम प्रकार आवश्य विवरण
request ऑब्जेक्ट हाँ ऑब्जेक्ट जो किसी क्रिया, फ़ंक्शन या CRUD अनुरोध को निष्पादित करने के लिए वेब API समापन बिंदु पर पास किया जाएगा। ऑब्जेक्ट अपने प्रोटोटाइप के माध्यम से एक getMetadata विधि को उजागर करता है जो आपको उस कार्रवाई, फ़ंक्शन या CRUD अनुरोध के लिए मेटाडेटा को परिभाषित करने देता है जिसे आप निष्पादित करना चाहते हैं। request.getMetadata विधि देखें
successCallback फ़ंक्शन नहीं ऑपरेशन सफलतापूर्वक निष्पादित होने पर कॉल करने के लिए एक फ़ंक्शन. रिटर्न वैल्यू देखें
errorCallback फ़ंक्शन नहीं ऑपरेशन विफल होने पर कॉल करने के लिए एक फ़ंक्शन। निम्न गुणों के साथ एक ऑब्जेक्ट पास किया जाता है:
- errorCode:संख्या। त्रुटि कोड एक धनात्मक दशमलव संख्या के रूप में। उदाहरण के लिए, के रूप में 0x80040333 प्रलेखित त्रुटि कोड के रूप में 2147746611लौटाया जाएगा।
- message:तार। समस्या का वर्णन करने वाला एक त्रुटि संदेश.

request.getMetadata विधि

विधि में getMetadata निम्नलिखित पैरामीटर हैं:

नाम प्रकार आवश्य विवरण
boundParameter तार नहीं निष्पादित करने के लिए क्रिया या फ़ंक्शन के लिए बाउंड पैरामीटर का नाम.
- निर्दिष्ट करें undefined कि क्या आप CRUD अनुरोध निष्पादित कर रहे हैं।
- निर्दिष्ट करें null कि निष्पादित करने के लिए कार्रवाई या फ़ंक्शन किसी तालिका से बाध्य नहीं है।
- निर्दिष्ट करें entity यदि निष्पादित करने के लिए कार्रवाई या फ़ंक्शन एक तालिका से बंधा हुआ है।
operationName तार नहीं यदि आप CRUD अनुरोध निष्पादित कर रहे हैं, तो क्रिया, फ़ंक्शन या निम्न मानों में से एक का नाम: Create, , UpdateRetrieve, या .Delete
operationType संख्या नहीं आपके द्वारा क्रियान्वित किए जा रहे ऑपरेशन के प्रकार को इंगित करता है; निम्न मानों में से कोई एक निर्दिष्ट करें:
- 0:मुक़दमा
- 1:फलन
- 2: क्रूड
parameterTypes ऑब्जेक्ट हाँ पैरामीटर प्रकारों के लिए मेटाडेटा. ऑब्जेक्ट में निम्नलिखित मान हैं:
enumProperties : (वैकल्पिक) वस्तु। एनम प्रकारों के लिए मेटाडेटा। ऑब्जेक्ट में दो स्ट्रिंग मान हैं: name और value
structuralProperty :संख्या। पैरामीटर प्रकार की श्रेणी। निम्न मानों में से कोई एक निर्दिष्ट करें:
- 0:अप्रसिद्घ व्यक्ति
- 1: आदिम प्रकार
- 2: कॉम्प्लेक्सटाइप
- 3: गणना प्रकार
- 4:संग्रह
- 5: इकाई प्रकार
typeName :तार। पैरामीटर प्रकार का पूरी तरह से योग्य नाम।

वापसी मान

सफलता पर, निम्नलिखित गुणों के साथ एक वादा ऑब्जेक्ट successCallback लौटाता है:

नाम प्रकार विवरण
body(बहिष्कृत) ऑब्जेक्ट प्रतिक्रिया निकाय।
headers ऑब्जेक्ट प्रतिक्रिया हेडर।
ok बूलियन इंगित करता है कि अनुरोध सफल रहा या नहीं.
status संख्या प्रतिसाद स्थिति कोड में संख्यात्मक मान। उदाहरण के लिए: 200
statusText तार प्रतिक्रिया स्थिति कोड का विवरण। उदाहरण के लिए: OK
type(बहिष्कृत) तार प्रतिक्रिया प्रकार। मान हैं: खाली स्ट्रिंग (डिफ़ॉल्ट), arraybuffer, blobdocumentjsonऔर .text
url तार वेब API समापन बिंदु पर भेजे गए क्रिया, फ़ंक्शन या CRUD अनुरोध का URL का अनुरोध करें।
json प्रतिज्ञा कॉलबैक प्रतिनिधि के लिए पैरामीटर किसी भी (JSON ऑब्जेक्ट) प्रकार का है।
text प्रतिज्ञा कॉलबैक प्रतिनिधि के लिए पैरामीटर एक स्ट्रिंग है।

उदाहरण

नीचे इन उदाहरणों को देखें:

टिप

आप इस विधि का उपयोग करने वाले Xrm.WebApi.online.execute जावास्क्रिप्ट कोड को जनरेट करने के लिए Dataverse REST बिल्डर का उपयोग कर सकते हैं।

एक क्रिया निष्पादित करें

निम्न उदाहरण Dynamics 365 for Sales समाधान में पाई गई कार्रवाई को WinOpportunity निष्पादित करने का तरीका प्रदर्शित करता है. अनुरोध ऑब्जेक्ट यहां कार्रवाई परिभाषा के आधार पर बनाया गया है: अनबाउंड क्रियाएं

var Sdk = window.Sdk || {};
/**
 * Request to win an opportunity
 * @param {Object} opportunityClose - The opportunity close activity associated with this state change.
 * @param {number} status - Status of the opportunity.
 */
Sdk.WinOpportunityRequest = function(opportunityClose, status) {
    this.OpportunityClose = opportunityClose;
    this.Status = status;
};

// NOTE: The getMetadata property should be attached to the function prototype instead of the
// function object itself.
Sdk.WinOpportunityRequest.prototype.getMetadata = function () {
    return {
        boundParameter: null,
        parameterTypes: {
            "OpportunityClose": {
                "typeName": "mscrm.opportunityclose",
                "structuralProperty": 5 // Entity Type
            },
            "Status": {
                "typeName": "Edm.Int32",
                "structuralProperty": 1 // Primitive Type
            }
        },
        operationType: 0, // This is an action. Use '1' for functions and '2' for CRUD
        operationName: "WinOpportunity",
    };
};

var opportunityClose = {
    "opportunityid@odata.bind": "/opportunities(c60e0283-5bf2-e311-945f-6c3be5a8dd64)",
    "description": "Product and maintenance for 2018",
    "subject": "Contract for 2018"
}

// Construct a request object from the metadata
var winOpportunityRequest = new Sdk.WinOpportunityRequest(opportunityClose, 3);

// Use the request object to execute the function
Xrm.WebApi.online.execute(winOpportunityRequest).then(function (response) {
    if (response.ok) {
        console.log("Status: %s %s", response.status, response.statusText);
        // The WinOpportunityRequest does not return any response body content. So we
        // need not access the response.json() property.

        // Perform other operations as required.
    }
})
.catch(function(error) {
    console.log(error.message);
    // handle error conditions
});

एक फ़ंक्शन निष्पादित करें

निम्नलिखित उदाहरण दर्शाता है कि WhoAmI फ़ंक्शन को कैसे निष्पादित किया जाए:

var Sdk = window.Sdk || {};
/**
 * Request to execute WhoAmI function
 */
Sdk.WhoAmIRequest = function () { };

// NOTE: The getMetadata property should be attached to the function prototype instead of the
//       function object itself.
Sdk.WhoAmIRequest.prototype.getMetadata = function () {
    return {
        boundParameter: null,
        parameterTypes: {},
        operationType: 1, // This is a function. Use '0' for actions and '2' for CRUD
        operationName: "WhoAmI",
    };
};

// Construct a request object from the metadata
var whoAmIRequest = new Sdk.WhoAmIRequest();

// Use the request object to execute the function
Xrm.WebApi.online.execute(whoAmIRequest)
.then(function (response) {
    if (response.ok) {
        console.log("Status: %s %s", response.status, response.statusText);

        // Use response.json() to access the content of the response body.
        return response.json();
    }
}
)
.then(function (responseBody) {
    console.log("User Id: %s", responseBody.UserId);
    // perform other operations as required;
})
.catch(function (error) {
    console.log(error.message);
    // handle error conditions
});

निम्नलिखित उदाहरण दर्शाता है कि फ़ंक्शन को कैसे निष्पादित किया जाए CalculateRollupField :

var Sdk = window.Sdk || {};

Sdk.CalculateRollupFieldRequest = function(target, fieldName) {
    this.Target = target;
    this.FieldName = fieldName;
};

// NOTE: The getMetadata property should be attached to the function prototype instead of the
//       function object itself.
Sdk.CalculateRollupFieldRequest.prototype.getMetadata = function() {
    return {
        boundParameter: null,
        parameterTypes: {
            "Target": {
                "typeName": "mscrm.crmbaseentity",
                "structuralProperty": 5
            },
            "FieldName": {
                "typeName": "Edm.String",
                "structuralProperty": 1
            }
        },
        operationType: 1, // This is a function. Use '0' for actions and '2' for CRUD
        operationName: "CalculateRollupField"
    };
};

// Create variables to point to a quote record and to a specific column
var quoteId = {
    "@odata.type": "Microsoft.Dynamics.CRM.quote",
    "quoteid": "7bb01e55-2394-ea11-a811-000d3ad97943"
};

// The roll-up column for which we want to force a re-calculation
var fieldName = "new_test_rollup";

// Create variable calculateRollupFieldRequest and pass those variables created above
var calculateRollupFieldRequest = new Sdk.CalculateRollupFieldRequest(quoteId, fieldName);

// Use the request object to execute the function
Xrm.WebApi.online.execute(calculateRollupFieldRequest)
.then(function(response) {
    if (response.ok) { // If a response was received.
        console.log("Status: %s %s", response.status, response.statusText);

        // Use response.json() to access the content of the response body.
        return response.json();
    }
})
.then(function(responseBody) { 
    //Do something with the response
    console.log("The response is: %s", responseBody);
})
.catch(function(error) {
    console.log(error.message);
    // handle error conditions
});

निम्नलिखित उदाहरण दर्शाता है कि फ़ंक्शन को कैसे निष्पादित किया जाए RetrieveDuplicates :

var Sdk = window.Sdk || {};

Sdk.RetrieveDuplicatesRequest = function(businessEntity, matchingEntityName, pagingInfo) {
    this.BusinessEntity = businessEntity;
    this.MatchingEntityName = matchingEntityName;
    this.PagingInfo = pagingInfo;

};

// NOTE: The getMetadata property should be attached to the function prototype instead of the
// function object itself.
Sdk.RetrieveDuplicatesRequest.prototype.getMetadata = function() {
    return {
        boundParameter: null,
        parameterTypes: {
            "BusinessEntity": {
                "typeName": "mscrm.crmbaseentity",
                "structuralProperty": 5 // Entity Type
            },
            "MatchingEntityName": {
                "typeName": "Edm.String",
                "structuralProperty": 1 // Primitive Type
            },
            "PagingInfo": {
                "typeName:": "mscrm.PagingInfo", // Complex Type
                "structuralProperty": 5
            }
        },
        operationType: 1, // This is a function. Use '0' for actions and '2' for CRUD
        operationName: "RetrieveDuplicates",
    };
};

// Create a variable to point to a contact record and with specific data in the needed columns
var contactRecord = {
    "@odata.type": "Microsoft.Dynamics.CRM.contact",
    "firstname": "Test",
    "lastname": "Account"
};

// Create a paging object to keep track of the current page and how many records we get per page
var pagingInfo = {
    "PageNumber": 1,
    "Count": 10
};

// Create the variable retrieveDuplicatesRequest to build the request
var retrieveDuplicatesRequest = new Sdk.RetrieveDuplicatesRequest(contactRecord, "contact", pagingInfo);

// Use the request object to execute the function
Xrm.WebApi.online.execute(retrieveDuplicatesRequest)
.then(function (response) {
    if (response.ok) {
        console.log("Status: %s %s", response.status, response.statusText);

        // Use response.json() to access the content of the response body.
        return response.json();
    }
})
.then(function(responseBody) { 
    // Do something with the response
    console.log("The response is: %s", responseBody);
})
.catch(function(error) {
    console.log(error.message);
    // handle error conditions
});

निम्नलिखित उदाहरण दर्शाता है कि फ़ंक्शन को कैसे निष्पादित किया जाए InitializeFrom :

var Sdk = window.Sdk || {};

Sdk.InitializeFromRequest = function (
  entityMoniker,
  targetEntityName,
  targetFieldType
) {
  this.EntityMoniker = entityMoniker;
  this.TargetEntityName = targetEntityName;
  this.TargetFieldType = targetFieldType;
};

// NOTE: The getMetadata property should be attached to the function prototype instead of the
// function object itself.
Sdk.InitializeFromRequest.prototype.getMetadata = function () {
  return {
    boundParameter: null,
    parameterTypes: {
      EntityMoniker: {
        typeName: "mscrm.crmbaseentity",
        structuralProperty: 5, //Entity Type
      },
      TargetEntityName: {
        typeName: "Edm.String",
        structuralProperty: 1, // PrimitiveType
      },
      TargetFieldType: {
        typeName: "Microsoft.Dynamics.CRM.TargetFieldType",
        structuralProperty: 3, // Enum Type
        enumProperties: [
          {
            name: "All",
            value: 0,
          },
          {
            name: "ValidForCreate",
            value: 1,
          },
          {
            name: "ValidForUpdate",
            value: 2,
          },
          {
            name: "ValidForRead",
            value: 3,
          },
        ],
      },
    },
    operationType: 1, // This is a function. Use '0' for actions and '2' for CRUD
    operationName: "InitializeFrom",
  };
};

// Create a variable to point to tje parent account record
var parentAccountRecord = {
  "@odata.type": "Microsoft.Dynamics.CRM.account",
  accountid: "141da047-eaad-eb11-b1b4-000d3ac581a0",
};

// Create a variable for the target entity name
var targetEntityName = "account";

// Create a variable for the target field type
var targetFieldType = 0;

// Build the request
var initializeFromRequest = new Sdk.InitializeFromRequest(
  parentAccountRecord,
  targetEntityName,
  targetFieldType
);

// Execute the request
Xrm.WebApi.online.execute(initializeFromRequest)
.then(function (response) {
    if (response.ok) {
        console.log("Status: %s %s", response.status, response.statusText);

        // Use response.json() to access the content of the response body.
        return response.json();
    }
})
.then(function(responseBody) { 
    // Do something with the response
    console.log("The response is: %s", responseBody);
})
.catch(function(error) {
    console.log(error.message);
    // handle error conditions
});

CRUD संचालन करें

एक रिकॉर्ड बनाएँ

निम्न उदाहरण दिखाता है कि क्रिएट कार्रवाई कैसे करें।

var Sdk = window.Sdk || {};

/**
 * Request to execute a create operation
 */
Sdk.CreateRequest = function(entityName, payload) {
    this.etn = entityName;
    this.payload = payload;
};

// NOTE: The getMetadata property should be attached to the function prototype instead of the
// function object itself.
Sdk.CreateRequest.prototype.getMetadata = function () {
    return {
        boundParameter: null,
        parameterTypes: {},
        operationType: 2, // This is a CRUD operation. Use '0' for actions and '1' for functions
        operationName: "Create",
    };
};
// Construct a request object from the metadata
var payload = {
    name: "Fabrikam Inc."
};
var createRequest = new Sdk.CreateRequest("account", payload);

// Use the request object to execute the function
Xrm.WebApi.online.execute(createRequest)
.then(function (response) {
    if (response.ok) {
        console.log("Status: %s %s", response.status, response.statusText);
        
        // The Create request does not return any response body content. So we
        // need not access the response.json() property.

        // Perform other operations as required.
    }
})
.catch(function(error) {
    console.log(error.message);
    // handle error conditions
});

एक रिकॉर्ड पुनर्प्राप्त करें

निम्न उदाहरण प्रदर्शित करता है कि पुनर्प्राप्ति कार्रवाई कैसे करें।

var Sdk = window.Sdk || {};

/**
 * Request to execute a retrieve operation
 */
Sdk.RetrieveRequest = function(entityReference, columns) {
    this.entityReference = entityReference;
    this.columns = columns;
};
// NOTE: The getMetadata property should be attached to the function prototype instead of the
// function object itself.
Sdk.RetrieveRequest.prototype.getMetadata = function () {
    return {
        boundParameter: null,
        parameterTypes: {},
        operationType: 2, // This is a CRUD operation. Use '0' for actions and '1' for functions
        operationName: "Retrieve",
    };
};

// Construct request object from the metadata
var entityReference = {
    entityType: "account",
    id: "d2b6c3f8-b0fa-e911-a812-000d3a59fa22"
};
var retrieveRequest = new Sdk.RetrieveRequest(entityReference, ["name"]);

// Use the request object to execute the function
Xrm.WebApi.online.execute(retrieveRequest)
.then(function (response) {
    if (response.ok) {
        console.log("Status: %s %s", response.status, response.statusText);

        // Use response.json() to access the content of the response body.
        return response.json();
    }
})
.then(function(responseBody) {
    console.log("Name: %s", responseBody.name);
    
    // perform other operations as required;
})
.catch(function(error) {
    console.log(error.message);
    // handle error conditions
});

एक रिकॉर्ड अपडेट करें

निम्न उदाहरण दिखाता है कि अद्यतन कार्रवाई कैसे करें।

var Sdk = window.Sdk || {};


/**
 * Request to execute an update operation
 */
Sdk.UpdateRequest = function(entityName, entityId, payload) {
    this.etn = entityName;
    this.id = entityId;
    this.payload = payload;
};

// NOTE: The getMetadata property should be attached to the function prototype instead of the
// function object itself.
Sdk.UpdateRequest.prototype.getMetadata = function () {
    return {
        boundParameter: null,
        parameterTypes: {},
        operationType: 2, // This is a CRUD operation. Use '0' for actions and '1' for functions
        operationName: "Update",
    };
};

// Construct a request object from the metadata
var payload = {
    name: "Updated Sample Account"
};
var updateRequest = new Sdk.UpdateRequest("account", "d2b6c3f8-b0fa-e911-a812-000d3a59fa22", payload);

// Use the request object to execute the function
Xrm.WebApi.online.execute(updateRequest)
.then(function (response) {
    if (response.ok) {
        console.log("Status: %s %s", response.status, response.statusText);

        // The Update request does not return any response body content. So we
        // need not access the response.json() property.
        
        // perform other operations as required;
    }
})
.catch(function(error) {
    console.log(error.message);
    // handle error conditions
});

किसी रिकॉर्ड को हटाना

निम्न उदाहरण दिखाता है कि हटाने की कार्रवाई कैसे करें।

var Sdk = window.Sdk || {};

/**
 * Request to execute a delete operation
 */
Sdk.DeleteRequest = function(entityReference) {
    this.entityReference = entityReference;
};

// NOTE: The getMetadata property should be attached to the function prototype instead of the
// function object itself.
Sdk.DeleteRequest.prototype.getMetadata = function () {
        return {
            boundParameter: null,
            parameterTypes: {},
            operationType: 2, // This is a CRUD operation. Use '0' for actions and '1' for functions
            operationName: "Delete",
        };
    };
};
};

// Construct request object from the metadata
var entityReference = {
    entityType: "account",
    id: "d2b6c3f8-b0fa-e911-a812-000d3a59fa22"
};
var deleteRequest = new Sdk.DeleteRequest(entityReference);

// Use the request object to execute the function
Xrm.WebApi.online.execute(deleteRequest)
.then(function(response) {
    if (response.ok) {
        console.log("Status: %s %s", response.status, response.statusText);
        
        // The Delete request does not return any response body content. So we
        // need not access the response.json() property.

        // perform other operations as required;
    }
})
.catch(function(error) {
    console.log(error.message);
    // handle error conditions
});

कोई रिकॉर्ड संबद्ध करना

निम्न कोड नमूना प्रदर्शित करता है कि संग्रह-मान नेविगेशन गुणों (एक-To-Many और अनेक-To-Many संबंधों) पर एक सहयोगी कार्रवाई कैसे करें। एकल-मान वाले नेविगेशन गुणों (कई-To-One संबंध उर्फ लुकअप कॉलम) के लिए, आप ऊपर दिखाए गए अनुसार अपडेट कार्रवाई कर सकते हैं या Xrm.WebApi.updateRecord का उपयोग कर सकते हैं.

var Sdk = window.Sdk || {};

/*
 * Request to execute an Associate operation.
 */
Sdk.AssociateRequest = function(target, relatedEntities, relationship) {
    this.target = target;
    this.relatedEntities = relatedEntities;
    this.relationship = relationship;
};

// NOTE: The getMetadata property should be attached to the function prototype instead of the
// function object itself.
Sdk.AssociateRequest.prototype.getMetadata = function() {
    return {
        boundParameter: null,
        parameterTypes: {},
        operationType: 2, // Associate and Disassociate fall under the CRUD umbrella
        operationName: "Associate"
    }
};

// Construct the target EntityReference object
var target = {
    entityType: "account",
    id: "0b4abc7d-7619-eb11-8dff-000d3ac5c7f9"
};

// Construct the related EntityReferences that the Target will be associated with.
var relatedEntities = [
    {
        entityType: "contact",
        id: "180a9aad-7619-eb11-8dff-000d3ac5c7f9"
    },
    {
        entityType: "contact",
        id: "753c58b4-7619-eb11-8dff-000d3ac5c7f9"
    }
];

// The name of the existing relationship to associate on.
var relationship = "new_account_contact";

var manyToManyAssociateRequest = new Sdk.AssociateRequest(target, relatedEntities, relationship)

Xrm.WebApi.online.execute(manyToManyAssociateRequest)
.then(function(response) {
    if (response.ok) {
        console.log("Status: %s %s", response.status, response.statusText);

        // The Associate request does not return any response body content. So we
        // need not access the response.json() property.

        // perform other operations as required;
    }
})
.catch(function(error) {
    console.log(error.message);
    // handle error conditions
});

किसी रिकॉर्ड को अलग करना

निम्न कोड नमूना प्रदर्शित करता है कि संग्रह-मान नेविगेशन गुणों (एक-To-Many और अनेक-To-Many संबंधों) पर एक अलग कार्रवाई कैसे करें। एकल-मान वाले नेविगेशन गुणों (कई-To-One संबंध उर्फ लुकअप कॉलम) के लिए, आप ऊपर दिखाए गए अनुसार अपडेट कार्रवाई कर सकते हैं या Xrm.WebApi.updateRecord का उपयोग कर सकते हैं.

नोट

सहयोगी कार्रवाई के विपरीत, जो लक्ष्य निकाय रिकॉर्ड को एक ही कार्रवाई में एकाधिक संबंधित निकाय रिकॉर्ड के साथ संबद्ध करने की अनुमति देता है, असंबद्ध कार्रवाई प्रति कार्रवाई लक्ष्य निकाय रिकॉर्ड से केवल एक निकाय रिकॉर्ड को अलग करने तक सीमित है.

var Sdk = window.Sdk || {};

/*
 * Request to execute a Disassociate operation.
 */
Sdk.DisassociateRequest = function(target, relatedEntityId, relationship) {
    this.target = target;
    this.relatedEntityId = relatedEntityId;
    this.relationship = relationship;
};

// NOTE: The getMetadata property should be attached to the function prototype instead of the
// function object itself.
Sdk.DisassociateRequest.prototype.getMetadata = function() {
    return {
        boundParameter: null,
        parameterTypes: {},
        operationType: 2, // Associate and Disassociate fall under the CRUD umbrella
        operationName: "Disassociate"
    }
};

// Construct the target EntityReference object
var target = {
    entityType: "account",
    id: "0b4abc7d-7619-eb11-8dff-000d3ac5c7f9"
};

// The GUID of the related entity record to disassociate.
var relatedEntityId = "180a9aad-7619-eb11-8dff-000d3ac5c7f9";

// The name of the existing relationship to disassociate from.
var relationship = "new_account_contact";

var manyToManyDisassociateRequest = new Sdk.DisassociateRequest(target, relatedEntityId, relationship)

Xrm.WebApi.online.execute(manyToManyDisassociateRequest)
.then(function(response) {
    if (response.ok) {
        console.log("Status: %s %s", response.status, response.statusText);

        // The Disassociate request does not return any response body content. So we
        // need not access the response.json() property.

        // perform other operations as required;
    }
})
.catch(function(error) {
    console.log(error.message);
    // handle error conditions
});

एक्सआरएम.वेबएपीआई