Skip to content

MobileCRM.FetchXml.Fetch.executeFromXML

rescocrm edited this page Aug 2, 2024 · 10 revisions

Performs the asynchronous CRM Fetch command.

Arguments

Argument Type Description
fetchXmlData String CRM fetch in XML representation.
success function(result) A callback function for successful asynchronous result. The result argument will carry the objects array of type specified by resultformat XML attribute (Array, JSON, XML or DynamicEntities).
failed function(error) A callback function for command failure. The error argument will carry the error message.
scope A scope for calling the callbacks; set "null" to call the callbacks in global scope.

This example demonstrates how to fetch a list of accounts and process their names using XML fetch query.

var xmlData = '<fetch resultformat="Array"><entity name="account"><attribute name="accountid"/>' + '<attribute name="name"/></entity></fetch>';
MobileCRM.FetchXml.Fetch.executeFromXML(xmlData, function (result) {
	for (var i in result) {
		var props = result[i];
		processAccount(props[0], props[1]);
	}
}, function (err) {
	MobileCRM.bridge.alert("Error fetching accounts: " + err);
}, null);
Clone this wiki locally