MobileCRM.UI.EntityForm.setFieldValue - Resconet/JSBridge GitHub Wiki

[v18.0] Sets the field value on entity record shown on this EntityForm.

Arguments

Argument Type Description
fieldName String Logical name of the field that has to be changed.
value any New value of entity field with given name.

This example demonstrates how to change the "Company Name" field on Contact record which is currently edited on entity form.

MobileCRM.UI.EntityForm.setFieldValue("parentcustomerid", new MobileCRM.Reference("account", companyId)) // lookup field requires Reference object
	.then(result => {
	if (result) {
		onCompleted();
	}
	else {
		displayError("Unexpected error setting company name field.");
	}
})
	.catch(error => displayError(`Error setting entity company name field: ${error}`));