web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
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!  

I have the same question (0)
  • Suggested answer
    Abdul Wahab Profile Picture
    12,119 Moderator on at

    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/.../

  • Verified answer
    Abdul Wahab Profile Picture
    12,119 Moderator on at

    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

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
11manish Profile Picture

11manish 176

#2
ManoVerse Profile Picture

ManoVerse 158 Super User 2026 Season 1

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 57 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans