-
Notifications
You must be signed in to change notification settings - Fork 26
MobileCRM.UI.MultiLookupForm.showAsync
rescocrm edited this page May 15, 2023
·
9 revisions
Shows a dialog which allows the user to select a list of entities from a configurable list of entity types.
This example demonstrates how to select products from multi-lookup form. It opens the multi-lookup form with products matching specified filter fetch.
// WARNING: async/await pattern requires ECMAScript 6 and it's not supported on Internet Explorer.
// It's supported by all modern browsers including mobile version of Chrome and Safari (requires Android 5+ and iOS 10+).
function openMultiLookUp(orderRef) {
return __awaiter(this, void 0, void 0, function* () {
/// <param name='orderRef' type='MobileCRM.Reference'>A reference to a sales order entity.</param>
var filteredLeadXML = '<fetch version="1.0">' +
'<entity name="product">' +
'<filter type="and">' +
'<condition attribute="name" operator="like" value="H%" />' +
'</filter>' +
'</entity>' +
'</fetch>';
try {
var ml = new MobileCRM.UI.MultiLookupForm("product");
ml.source = new MobileCRM.Relationship("salesorderid", orderRef);
;
ml.addEntityFilter("product", filteredLeadXML);
ml.allowNull = true;
ml.addView("product", "Active Products", true); // requires "Active Products" view for "product" entity in your mobile project
var selected = yield ml.showAsync();
var reportText = selected.map(function (a) { return a.primaryName; }).join(", ");
MobileCRM.bridge.alert(reportText);
}
catch (err) {
MobileCRM.bridge.alert(err);
}
});
}