Suppose say we have a field which has 2 options: Individual & corporate customers. Based on the field option selected we have to render a particular form (we have one form for individual option and another form for corporate option).
How to approach this problem in CRM? If possible please give me the architecture of your solutions and java script code.
Thanks in advance
*This post is locked for comments
Hi,
Try the Javascript code below.
function switchForm() { var lblForm; // get the value optionset field var value = Xrm.Page.getAttribute("optionSetFieldName").getValue(); //check the value of the optionset field if (value == 1000001) { lblForm = "Individual"; } else if (value == 1000002){ lblForm = "Corporate"; } //check if the current form is form need to be displayed based on the value if (Xrm.Page.ui.formSelector.getCurrentItem().getLabel() != lblForm) { var items = Xrm.Page.ui.formSelector.items.get(); for (var i in items) { var item = items[i]; var itemId = item.getId(); var itemLabel = item.getLabel(); if (itemLabel == lblForm) { //navigate to the form item.navigate(); } } } }
Here1000001 and 1000002 are the option set values corresponding to the options Individual and Corporate respectively. Replace these values with option set values in your CRM.
Hope this helps.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156