MobileCRM.UI._DetailView.updateLinkItemViews - Resconet/JSBridge GitHub Wiki

[v10.1] Changes the ComboBoxItem views and/or filters.

Arguments

Argument Type Description
index Number Item index on the view.
dialogSetup MobileCRM.UI.DetailViewItems.LookupSetup Lookup setup for modal lookup dialog.
inlinePickSetup MobileCRM.UI.DetailViewItems.LookupSetup Optional setup for inline lookup picker. Leave empty to use the same setup as modal dialog.
dialogOnly Boolean Optional - indicates whether to allow the inline picker. Set true to disable the inline picker and always use the modal dialog. Set false; to allow the inline picker. Default value is true
allowCreateNew Boolean Optional - [v18.0] Indicates whether to allow creation of new items. Default value is true.

This example demonstrates how to change the view for the detail view link item. It sets the view or fetch XML for ParentCustomer field on Contact entity.

MobileCRM.UI.EntityForm.requestObject(function (entityForm) {
	/// <param name="entityForm" type="MobileCRM.UI.EntityForm"/>
	// Take detail view with name "General"
	const dv = entityForm.getDetailView("General");
	// use schema name to get index of lookup item in the detail view
	const itemIndex = dv.getItemIndex("parentcustomerid");
	const inlineSetup = new MobileCRM.UI.DetailViewItems.LookupSetup();
	// Set Account entity view with name "ContactParents" defining the filter for accounts
	// that should be present in the inline lookup for this field.
	inlineSetup.addView("account", "ContactParents", true);
	// Alternatively, specify the explicit fetch XML filter for inline lookup
	// inlineSetup.addFilter("account", '<fetch version="1.0"><entity name="account">...</entity></fetch>');
	const dialogSetup = new MobileCRM.UI.DetailViewItems.LookupSetup();
	// Set "Default" view for expanded lookup form
	dialogSetup.addView("account", "Default", true);
	//dialogSetup.addFilter("account", '<fetch version="1.0"><entity name="account">...</entity></fetch>');
	const dialogOnly = false; // Allow both inline lookup and expanded lookup dialog
	const allowCreateNew = false; // Ensures user cannot create new record even in case underlying view config allows it.
	dv.updateLinkItemViews(itemIndex, dialogSetup, inlineSetup, dialogOnly, allowCreateNew);
}, onError, null);
function onError(error) {
	/// <param name="error" type="String"/>
	if (error)
		MobileCRM.bridge.alert(error);
}
⚠️ **GitHub.com Fallback** ⚠️