Created
April 23, 2021 21:44
-
-
Save melamriD365/75d6e97fbd10b678459f25b765ace703 to your computer and use it in GitHub Desktop.
Open all lookups in a modal dialog
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (typeof (MEA) == "undefined") { MEA = {} }; | |
if (typeof (MEA.Account) == "undefined") { MEA.Account = {} }; | |
if (typeof (MEA.Account.AccountForm) == "undefined") { MEA.Account.AccountForm = {} }; | |
MEA.Account.AccountForm = { | |
onLoad: function (executionContext) { | |
var formContext = executionContext.getFormContext(); | |
var attributes = formContext.data.entity.attributes; | |
attributes.forEach(att => { | |
att.getAttributeType() == 'lookup' ? | |
formContext.getControl(att.getName()).addOnLookupTagClick(this.openModalForm) | |
: null | |
}); | |
}, | |
openModalForm: function (executionContext) { | |
var formContext = executionContext.getFormContext(); | |
var record = executionContext.getEventArgs().getTagValue(); | |
executionContext.getEventArgs().preventDefault(); | |
var pageInput = {pageType: "entityrecord",entityName: record.entityType,entityId: record.id}; | |
var navigationOptions = {target: 2,width:{value: 80,unit: "%"}}; | |
Xrm.Navigation.navigateTo(pageInput,navigationOptions); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment