MobileCRM.UI.DetailViewItems.ComboBoxItem.constructor - Resconet/JSBridge GitHub Wiki

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

Arguments

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

This example demonstrates how to get detail view and create new ComboBoxItem.

MobileCRM.UI.EntityForm.requestObject(function (entityForm) {
	var detailView = entityForm.getDetailView("General");
	var comboItem = detailView.getItemByName("MyOptions");
	if (comboItem)
		comboItem.value = "val1";
	else {
		comboItem = new MobileCRM.UI.DetailViewItems.ComboBoxItem("MyOptions", "Choose Options");
		comboItem.value = "val1";
		comboItem.listDataSource = {
			"Label 1": "val1",
			"Label 2": "val2",
		};
		detailView.insertItem(comboItem, -1); // Place the item as the last one.
	}
}, MobileCRM.bridge.alert);
MobileCRM.UI.EntityForm.onChange(function (entityForm) {
	if (entityForm.context.changedItem == "MyOptions") {
		var detailView = entityForm.getDetailView("General");
		var item = detailView.getItemByName("MyOptions");
		MobileCRM.bridge.alert(item.value); // Show an alert with currently chosen value
	}
}, MobileCRM.bridge.alert);
⚠️ **GitHub.com Fallback** ⚠️