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

Dynamics Portals || PowerApps Portal Hide show button based on logged on Contact condition

(0) ShareShare
ReportReport
Posted on by 547

Currently I have Entity list where in I have create and Details Button.

I wish to Hide Create button if Entity list returns a record and show Create Button if Entity list returns nothing. Is this possible.

If not Entity list button I am also ok with custom button, but this button should be hidden based of if logged on Contact .

For ex select * from contact where contacid =LoggedonContactid;

There are few blogs which mentioned the same

https://www.netwoven.com/2018/06/19/using-fetch-xml-based-filter-criteria-to-show-hide-action-buttons-in-a-dynamics-365-online-portal/

  • Suggested answer
    oliver.rodrigues Profile Picture
    oliver.rodrigues 4,052 on at
    RE: Dynamics Portals || PowerApps Portal Hide show button based on logged on Contact condition

    hi, the link you reference would be actually adding the conditions to the items within the Entity List, when you have for example workflows or details page associated

    for your requirement, the easiest way is adding a JavaScript with logic to hide/show the button

    this code should for you, you can add it in your entity list or web page record:

    $(document).ready(function () {
    
        SetNewButtonVisibility();
    
    });
    
    function SetNewButtonVisibility() {
    
        var list = $(".entity-grid").eq(0);
    
        list.on("loaded", function () {
            var rowCount = list.find("tr").length;
    
            if (rowCount > 0) {
                $(".create-action").hide();
            }
            else {
                $(".create-action").show();
            }
        });
    }
    

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,329 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans