Skip to main content



No record found.

Microsoft Dynamics CRM forum
Suggested answer

hide and show tab based on condition using fetch xml with liquid template

Posted on by 5



how to hide and show tab based on condition using fetch xml with liquid template in power portal.


I want to hide share your link tab , when condition is not matched with them if condition is matched then show this tab.

in this tab I add a link, when we click on this tab then open a new web page and there are  one field that name is report. if this field contain data then "share your link " tab is shown otherwise this tab will be hide .



  • Suggested answer
    RodRodriguez Profile Picture
    RodRodriguez on at
    RE: hide and show tab based on condition using fetch xml with liquid template


    Here is a basic JavaScript that hides and shows a tab based on the value in a whole number field, but you can change that to meet the conditions you are looking for, just change "DETAILS_TAB" to the name of your tab and "new_wholenumber" to the name of one of the fields you are going to use to check the condition(s).  Right now it is set so that if the whole number field is "2" then the field is shown, otherwise it is hidden.  Rinse, lather, repeat if you need more than one field for your evaluations:

    function hideOrShowTabFromWholeNumberField(executionContext)


    var formContext = executionContext.getFormContext();

    var tabObj = formContext.ui.tabs.get('DETAILS_TAB');

    var wholeNumberFieldValue = formContext.getAttribute('new_wholenumber');


    if (wholeNumberFieldValue.getValue() == 2)





    Just make sure to have that function loaded on the page you want to customize and that the function is set to fire "on load" or when the field changes or whatever :)

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .


André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,696 Super User

Martin Dráb Profile Picture

Martin Dráb 225,490 Super User

nmaenpaa Profile Picture

nmaenpaa 101,148


Featured topics

Product updates

Dynamics 365 release plans