Skip to content

MobileCRM.UI.DetailViewItems.CheckBoxItem.constructor

rescocrm edited this page May 15, 2023 · 9 revisions

Constructs an instance of MobileCRM.UI.DetailViewItems.CheckBoxItem object.

Arguments

Argument Type Description
name String Defines the item name.
label String Defines the item label.

This example demonstrates how to append the new 'ShowDetails' CheckBoxItem on the form and handle its changes.

MobileCRM.UI.EntityForm.requestObject(function (entityForm) {
	var detailView = entityForm.getDetailView("General");
	var checkBoxItem = detailView.getItemByName("ShowDetails");
	if (checkBoxItem)
		checkBoxItem.value = true;
	else {
		checkBoxItem = new MobileCRM.UI.DetailViewItems.CheckBoxItem("ShowDetails", "Show Details");
		checkBoxItem.value = true;
		checkBoxItem.textChecked = "Checked";
		checkBoxItem.textUnchecked = "Unchecked";
		checkBoxItem.isNullable = false;
		detailView.insertItem(checkBoxItem, 0); // Place the item as the fist one.
	}
}, MobileCRM.bridge.alert, null);
MobileCRM.UI.EntityForm.onChange(function (entityForm) {
	if (entityForm.context.changedItem == "ShowDetails") {
		var detailView = entityForm.getDetailView("General");
		var checkBoxItem = detailView.getItemByName("ShowDetails");
		if (checkBoxItem.value) {
			// Show your details
		}
		else {
			// Hide your details.
		}
	}
}, MobileCRM.bridge.alert, null);
Clone this wiki locally