Skip to content

MobileCRM.UI.DetailViewItems.DurationItem.constructor

rescocrm edited this page May 15, 2023 · 9 revisions

Constructs an instance of MobileCRM.UI.DetailViewItems.DurationItem 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 DurationItem.

MobileCRM.UI.EntityForm.requestObject(function (entityForm) {
	var detailView = entityForm.getDetailView("General");
	var item = detailView.getItemByName("EventDuration");
	if (item)
		item.value = 65; // value is in seconds.
	else {
		item = new MobileCRM.UI.DetailViewItems.DurationItem("EventDuration", "Duration");
		item.value = 65;
		detailView.insertItem(item, -1); // Place item as the last one.
	}
}, MobileCRM.bridge.alert, null);
MobileCRM.UI.EntityForm.onChange(function (entityForm) {
	if (entityForm.context.changedItem == "EventDuration") {
		var detailView = entityForm.getDetailView("General");
		var item = detailView.getItemByName("EventDuration");
		MobileCRM.bridge.alert(item.value + " seconds."); // Show an alert with changed duration in seconds.
	}
}, MobileCRM.bridge.alert, null);
Clone this wiki locally