Skip to content

MobileCRM.FetchXml.Fetch.deserializeFromXml

rescocrm edited this page May 15, 2023 · 10 revisions

Deserializes the Fetch object from XML.

Arguments

Argument Type Description
xml String A string defining the fetch XML request.
success function(result: MobileCRM.FetchXml.Fetch) A callback function for successful asynchronous result. The result argument will carry the Fetch object.
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 convert a fetch XML string into MobileCRM.FetchXml.Fetch object.

var xml = '<fetch>\
		<entity name="account">\
		<attribute name="accountid" />\
		<attribute name="name" />\
		<order attribute="name" descending="false" />\
		<filter type="and">\
			<condition attribute="statecode" operator="eq" value="0" />\
		</filter>\
		</entity>\
	</fetch>';
MobileCRM.FetchXml.Fetch.deserializeFromXml(xml, function (fetch) {
	/// <param name="fetch" type="MobileCRM.FetchXml.Fetch" />
	fetch.entity.filter.startsWith("name", "B"); // Modify deserialized fetch...
	fetch.execute("DynamicEntities", function (res) {
		var report = res.join("\r\n");
		MobileCRM.bridge.alert(report);
	}, MobileCRM.bridge.alert);
}, MobileCRM.bridge.alert);
Clone this wiki locally