Skip to main content

Notifications

Announcements

No record found.

Service | Customer Service, Contact Center, Fie...
Suggested answer

Dynamics Portal - Conditional Create Button in Entity List

Posted on by

Hi

Is there a way to make the "create"-Button from a Entity List conditional? In Portalmanagement i have unter "Entity List - Options - Create" the option "Filter Criteria" (see Screenshot).

My Question: Is there a way to check "If count of records in entitylist is bigger than 0" then hide the "Create Button".  Or is this requirement only with JavaScript makeable? 

pastedimage1605892149180v1.png

How to solve the problem (JavaScript, Liquid or Parameters in Portal Manager) doesn't really matter, but I need a way to hide the create-button when a record has already been created. Thx for any help.

 

solution:

$(document).ready(function () {
    SetNewButtonVisibility();
});

function SetNewButtonVisibility() {

    var list = $(".entity-grid").eq(0);

    list.on("loaded", function () {
        var rowCount = list.find("tr").length;
        
        if (rowCount > 1) {
            $(".create-action").hide();
        }
        else {
            $(".create-action").show();
        }
    });
}

  • CRMJetty Profile Picture
    CRMJetty 3,508 on at
    RE: Dynamics Portal - Conditional Create Button in Entity List

    Hello,

    pls refer this link,

    https://community.dynamics.com/crm/f/microsoft-dynamics-crm-forum/227763/hide-a-ribbon-based-on-security-roles---crm-2016-online

    https://lakshmanindian.wordpress.com/2012/05/23/check-user-security-role-in-crm-2011-using-jscript/

    I hope it helps,

    Thanks.

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365

  • Suggested answer
    Dy365Fan Profile Picture
    Dy365Fan on at
    RE: Dynamics Portal - Conditional Create Button in Entity List

    I found a solution by another Post:

    https://community.dynamics.com/crm/f/microsoft-dynamics-crm-forum/370751/dynamics-portals-powerapps-portal-hide-show-button-based-on-logged-on-contact-condition

    thx to oliver.rodrigues

    $(document).ready(function () {
        SetNewButtonVisibility();
    });
    
    function SetNewButtonVisibility() {
    
        var list = $(".entity-grid").eq(0);
    
        list.on("loaded", function () {
            var rowCount = list.find("tr").length;
            
            if (rowCount > 1) {
                $(".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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans