Is there a way to get a specific form to open when user clicks on record, depending on the value of another field?
For example
- if WIRS_Request says 'Marketing Presentation' then when user clicks on WIRSID 269, formMP would open
- if WIRS_Request says 'Config Design Support ' then when user clicks on WIRSID 269, formCDS would open....
Thanks in advance
An alternative design approach could be to show / hide tabs based on same field value ....
- if WIRS_Request says 'Marketing Presentation' - Config would be hidden
- if WIRS_Request says 'Config Design Support ' - Marketing presentation would be hidden
Hi @ctedesco3307 ,
Yes. You will need to pass the function name (I have named it "HideTab"), as well as check "Pass execution context as first parameter".
Remember to publish all customisations in the Solution.
------------------------------------------------------------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.
If you like my response, please give it a Thumbs Up.
@Amik This is great advice - thank you -GOT it working - had to add the function name to the event handler!
This is awesome! Thx!!
Form
Code:
function HideTab() {
var textFieldValue = Xrm.Page.getAttribute('ctq_wirs_request').getValue();
if (textFieldValue === "Marketing Presentation") {
Xrm.Page.ui.tabs.get('tab_3').setVisible(true);
Xrm.Page.ui.tabs.get('tab_2').setVisible(false);
} else if (textFieldValue === "Configuration Design Support") {
Xrm.Page.ui.tabs.get('tab_3').setVisible(false);
Xrm.Page.ui.tabs.get('tab_2').setVisible(true);
}
}
Do I need to enter anything in function? I tried it like this and not working. Thank you!
Hi @ctedesco3307 ,
This is not possible out of the box, but you could achieve this by creating a java script web resource, and then having it run on the OnLoad event on your Form:
In the below example, I have two tabs, tab_one and tab_two.
To show/hide either tab based on the value of a text field for example, you could use:
function HideTab() {
var textFieldValue = Xrm.Page.getAttribute('logical_field_name_for_WIRS_Request').getValue();
if (textFieldValue === "Marketing Promotion") {
Xrm.Page.ui.tabs.get('tab_one').setVisible(false);
Xrm.Page.ui.tabs.get('tab_two').setVisible(true);
} else if (textFieldValue === "Config Design Support") {
Xrm.Page.ui.tabs.get('tab_one').setVisible(true);
Xrm.Page.ui.tabs.get('tab_two').setVisible(false);
}
}
Similar logic can be applied where you have more than one Main Form for the same entity, although I have personally not tested this.
------------------------------------------------------------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.
If you like my response, please give it a Thumbs Up.
WarrenBelz
146,618
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,962
Most Valuable Professional