Skip to main content

Notifications

Announcements

No record found.

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
    Abdul Wahab 12,077 Super User 2024 Season 1 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
    Abdul Wahab 12,077 Super User 2024 Season 1 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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,466 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans