Skip to content

MobileCRM.DynamicEntity.loadById

rescocrm edited this page May 15, 2023 · 9 revisions

Asynchronously loads the CRM entity properties.

Arguments

Argument Type Description
entityName String The logical name of the entity, e.g. "account".
id String GUID of the existing entity or null for new one.
success function(result) A callback function for successful asynchronous result. The result argument will carry the MobileCRM.DynamicEntity 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 load the account entity with given id.

function getAccountData(accountId) {
	/// <param name="account" type="MobileCRM.Reference"/>;
	MobileCRM.DynamicEntity.loadById("account", accountId, function (entity) {
		/// <param name="entity" type="MobileCRM.DynamicEntity"/>;
		// "entity" argument contains the MobileCRM.DynamicEntity object
		MobileCRM.bridge.alert(JSON.stringify(entity.properties));
	}, function (error) {
		MobileCRM.bridge.alert("An error occurred: " + error);
	}, null);
}
Clone this wiki locally