Skip to content

MobileCRM.Metadata.requestObject

rescocrm edited this page May 15, 2023 · 8 revisions

Requests the Metadata object containing the list of MetaEntities which are enabled for current mobile project.

Method initiates an asynchronous request which either ends with calling the errorCallback or with calling the callback with Javascript version of Metadata object. See MobileCRM.Bridge.requestObject for further details.

Arguments

Argument Type Description
callback function(metadata) The callback function which is called asynchronously with serialized EntityForm object as argument. Callback should return true to apply changed properties.
errorCallback function(errorMsg) The errorCallback which is called in case of error.
scope Object The scope for callbacks.

This example demonstrates how to get the metadata object.

MobileCRM.Metadata.requestObject(function (metadata) {
	var metaEntity = MobileCRM.Metadata.getEntity("account");
	var latitudeProp = metaEntity.getProperty("address1_latitude");
	var longitudeProp = metaEntity.getProperty("address1_longitude");
	// contains entity what has child ("invoicedetail","salesorder",...);
	var childrenMap = metadata._childParentMap;
	for (var i in childrenMap) {
		// Parent for children (invoice has invoicedetail;)
		var entityParent = entity.getEntityParent(i);
	}
}, MobileCRM.bridge.alert);
Clone this wiki locally