Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Ribbon Workbench - Show Button on Related Entity value and Show Button by Sec Role

(0) ShareShare
ReportReport
Posted on by

Hi, 
I have a button I want displayed on a Work Order.  This button should ONLY show WHEN:


-Related Account option set field = a certain value (bf_b2bsubtype = 979,580,001) 

AND 


-User Security Role = custom role (*BF Field Service - Dispatcher)

I need assistance figuring this out using a Display Rule.  Can anyone send a screenshot of what this would look like?  I am unsure because the solution I am working in is the Work Order, but it needs a value from the related Account.  I also have not shown/hidden buttons based on Security Role previously.  


Thanks!  

  • Verified answer
    Abdul Wahab Profile Picture
    12,085 Moderator on at
    RE: Ribbon Workbench - Show Button on Related Entity value and Show Button by Sec Role

    Hi Chrisbra22,

    Any active concern? If, No then please close this thread

    If I answered your question then please mark it as verified.

    Let me know if I can provide you with more details.

    Thanks

    Regards,

    Abdul Wahab

    Power Platform & Customer Engagement Developer/Lead/Solution Architecture/Project Manager

    Direct/WhatsApp:+923323281237

    E-mail: abdulwahabubit@outlook.com

    Skype: abdul.wahabubit

    Linkedin: Abdul Wahab | LinkedIn

  • Suggested answer
    Abdul Wahab Profile Picture
    12,085 Moderator on at
    RE: Ribbon Workbench - Show Button on Related Entity value and Show Button by Sec Role

    Hi Chrisbra22,

    You need to write some similar functions to solve your problem and bind it in a custom rule.

    function fn1 (_accountid) {
        try {
            var isVerifiedBankDonorOrganization = false;
            var fetchData = {
                verifiedbankdonor: "1",
                accountid: _accountid
            };
            var fetchXml = [
                "",
                "  ",
                "    ",
                "    ",
                "    ",
                "      ",
                "      ",
                "    ",
                "  ",
                "",
            ].join("");
            otherChanelImport.Retrieve(globalVariables.WebAPIVersion, "accounts", fetchXml);
            if (globalVariables.Results.length > 0) {
                isVerifiedBankDonorOrganization = true
            }
        } catch (e) {
            var alertStrings = { confirmButtonLabel: "OK", text: "Error from IsVerifiedBankDonorOrganization: "   e, title: "Error" };
            var alertOptions = { height: 200, width: 500 };
            Xrm.Navigation.openAlertDialog(alertStrings, alertOptions).then();
        }
        return isVerifiedBankDonorOrganization;
    };

    function Retrieve(webAPIVersion, entitysPluralName, fetchXmlQuery) {
    try {
    //GET[Organization URI/api/data / v9.0/ EntityDefinitions(LogicalName = 'account') ? $select = DisplayName,IsKnowledgeManagementEnabled, EntitySetName HTTP/ 1.1
    //Accept: application / json
    //OData - MaxVersion: 4.0
    //OData - Version: 4.0
    var req = new XMLHttpRequest();
    req.open(
    "GET",
    Xrm.Page.context.getClientUrl()
    "/api/data/" webAPIVersion "/" entitysPluralName "?fetchXml="
    encodeURIComponent(fetchXmlQuery),
    false
    );//Sync
    req.setRequestHeader("Prefer", 'odata.include-annotations="*"');
    req.onreadystatechange = function () {
    if (this.readyState === 4) {
    req.onreadystatechange = null;
    if (this.status === 200) {
    var results = JSON.parse(this.response);
    globalVariables.Results = results.value;
    } else {
    alert(this.statusText);
    }
    }
    };
    req.send();
    } catch (e) {
    var alertStrings = { confirmButtonLabel: "OK", text: "Error from Retrieve: " e, title: "Error" };
    var alertOptions = { height: 200, width: 500 };
    Xrm.Navigation.openAlertDialog(alertStrings, alertOptions).then();
    }
    };

    If I answer your question then please mark it as verified.

    Let me know if I can provide you with more details.

    Thanks
    Regards,

    Abdul Wahab
    Power Platform & Customer Engagement Developer/Lead/Solution Architecture/Project Manager
    Direct/WhatsApp: 923323281237
    E-mail: abdulwahabubit@outlook.com
    Skype: abdul.wahabubit
    Linkedin: www.linkedin.com/.../

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

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

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,280 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,038 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans