web
You’re offline. This is a read only version of the page.
close
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!  

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 96 Super User 2025 Season 2

#2
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans