MobileCRM.Configuration.requestObject - Resconet/JSBridge GitHub Wiki

Requests the managed Configuration object.

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

Arguments

Argument Type Description
callback function(config) The callback function that is called asynchronously with MobileCRM.Configuration object instance 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 obtain and modify MobileCRM.Configuration object. It checks if user is working in Online mode and calls a function with user's credentials obtained from MobileCRM._Settings object.

MobileCRM.Configuration.requestObject(function (config) {
	/// <param name="config" type="MobileCRM.Configuration">/<param>
	if (config.isOnline) {
		var settings = config.settings;
		queryXYStatistics(settings.userName, settings.password, settings.domain);
	}
	// we have done no changes, thus return false to disallow sending the changes back to C#.
	return false;
}, function (err) {
	/// <param name="err" type="String">/<param>
	MobileCRM.bridge.alert("An error occurred: " + err);
}, null);
function queryXYStatistics(userName, password, domain) {
	// Use CRM credentials let's say for an AJAX call to a WebService...
}
⚠️ **GitHub.com Fallback** ⚠️