Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

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

(0) ShareShare
ReportReport
Posted on by 5

hi,

 

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

pastedimage1657180048529v2.png

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 .

 

thanks

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

    Howdy,

    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');

    tabObj.setVisible(false);

    if (wholeNumberFieldValue.getValue() == 2)

    {

    tabObj.setVisible(true);

    }

    }

    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 :)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 225 Super User 2025 Season 1

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 97

#3
Vahid Ghafarpour Profile Picture

Vahid Ghafarpour 82 Super User 2025 Season 1

Overall leaderboard

Product updates

Dynamics 365 release plans