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 :
Microsoft Dynamics CRM (Archived)

Load JS webresource on EnableRule of a ribbon button

(0) ShareShare
ReportReport
Posted on by 75

Problem:

In Dynamics 365 I have one custom entity say CustomEntity. In that entity's Home Grid Page (List View page, where we get Active/Inactive and so on views) and in entity's form I have added one custom ribbon button, say CustomRibbon. Now, that ribbon button should be visible to users having specific security role, say CSR Admin. How to achieve this ?

What I have tried:

Added custom js (for checking particular Role) in EnableRule for CustomRibbon button. It is working fine for form but not for Grid/List View page of the entity. Reason - js Library is not loading in Grid/List view.
I have also tried callling dummy function for the library and try to call it (so that js webreource can be loaded) on Enable rule, but still it is not working.

*This post is locked for comments

I have the same question (0)
  • ashlega Profile Picture
    34,477 on at

    Hi,

     see if you did not include a different library occasionally (library parameter of the CustomRule). Maybe you have the right one added to the form as you would, normally, add a web resource?

     Then, of course, publish all.. close the browsers.. use F5 after that.. but I'm guessing you've tried that already.

     If nothing works, might also want to try ribbon workbench as an alternative:

     www.develop1.net/.../ribbonworkbench.aspx

  • Vineet  Mehra Profile Picture
    75 on at

    Thanks Alex.

    Yes I tried with the correct library only. The point here is In Home Grid/List views, how we can load our custom javascript libraries.

  • ashlega Profile Picture
    34,477 on at

    It should have been loaded automatically because you are referencing it from the rule... your function wouldn't have a name that could have been used by crm?

  • Community Member Profile Picture
    on at

    Are you using RibbonWorkbench

  • Vineet  Mehra Profile Picture
    75 on at

    Thats what I thought, but it is not loading. I have added one enable rule which is a custom js call for function, say ShowCustomButton(), of my custom js library.

  • Vineet  Mehra Profile Picture
    75 on at

    Yes

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Winnie,

    I usually add those libraries with Enable Rule of Custom Function type using isNaN function without parameters. Can you please provide screenshots of your Ribbon Workbench cnfiguration to check what's wrong with it?

  • Gopalan Bhuvanesh Profile Picture
    11,401 on at

    Hi

    If you are using multiple JavaScript (library) files, along with the JS file in which you are having the function to be used.

    1. Add those library files to webresources

    2. For Actions, add the library files with the function name

    NaN

    3. For Enable rule add the library files with a function which would return true,

    for example:

    function General_IncludeInRibbon()
    {
       return true;
    }

    or
    isNaN
    as mentioned by Andrii
  • Vineet  Mehra Profile Picture
    75 on at

    Thanks Andrii, Gopalan

    Ribbon-Workbench.png

    I have used isNaN or dummy functions earlier also for Actions and they worked fine.

    In above snapshot, I have added 2 Funds button one on HomePageGrid and other on the form and added the same enable rule for both button commands. For simplifying it I am just calling a function of AccountMain Library which is checking the role of a user and returning true or false. I am not referencing any other library.

    For Form it is working as expected but not HomePageGrid.

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Please provide a screenshot of Enable Action in which you load required library.

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 > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans