Showing posts with label Ribbon Workbench. Show all posts
Showing posts with label Ribbon Workbench. Show all posts

Monday, September 3, 2018

Check User Specific Role - Web API (1 API Call) - Dynamics CRM 365

I was working in a requirement where ribbon customization was required based on user role. Many ribbon buttons were hidden / visible based on different roles assigned to user. There was also custom button on ribbon bind with custom JavaScript function.

 Due to more buttons bind with Enable Rules to set their visibility result in slow page load and increase user wait for Ribbon Buttons.

Previously, I was getting user roles ids from XRM method and then checking the name of roles by getting role name through Web API retrieve request and passing guid of role as parameter. This means if there are 7 roles assigned to user then system will make 7 API Calls.
Also on custom button trigger, System was again loading the webresource and as API Calls were made outside any function therefore system also made API Calls before triggering custom ribbon button function. There were separate web resource for Enable Rules of Ribbon Buttons. There were methods which were used in Entity Main web resource and in Enble Rules web resource.
What I did was that I create another web-resource and write a class of Dynamics CRM Roles. This class contain method and an array to load all roles from Dynamics CRM 365. So I loaded the array with role name and role guid using the Web API retrieve request for roles. This technique loaded the array with all roles and made the API Call only once.
Now in my logic and other areas where I was checking with role name whether user is assigned that or not, I was using the roles array to match.
So this result in making Web API Call only once.

Here is my code logic.

Updating shortly ....






㉺㉼㉴㉳㉽㉾㈕㈔㈆㈅㈄㈄㈃㈁㈀㉤
Ali Hamza Wadood Microsoft Dynamics CRM Developer | Software Engineer - Microsoft Technologies(Asp.Net, Asp.Net MVC) LinkedIn

Saturday, March 31, 2018

Enable Rule for Default Buttons - Ribbon Workbench - Dynamics CRM 365


1) Install Ribbon Workbench from here
2) Import solution in your Dynamics CRM 365 instance
3) A button "RIBBON WORKBENCH 2016" is created in Solution Page. Click on it
























4) Now new window is opened. Select your desired solution containing entity to be customized. It is better to create a separate solution to be used for ribbon customization and contains only desired entity. In this scenario I have created a new solution "Ribbon Solution" contain only Case entity. Here I am selecting solution Ribbon Solution

























5) Now solution is opened in ribbon workbench. Select your desired entity and on button right mouse click. Now select Customize Command. (In my case as button is already customized therefore this command is shown disabled)























6) Now in command section, select the generated command and click on Add Enable Rule. Now select Add New Enable Rule.




























7) Now click on Add Step & select CustomRule. There are others rules to apply enable rules on button. Here I am only showing the CustomRule.























Thursday, July 2, 2015

Add Dynamic Ribbon Menu Buttons

1) Create Ribbon Menu Buttons using (Ribbon Workbench)

2) Add Enable Rules in Ribbon Workbench

  • For each Rule Add a Custom Rule and Select Custom Javascript Rule
  • Now mention your function name and web-resource.

3) Connect Rules with Commands
4) Add the functions in Web-Resource as mentioned in Specified Rules in Step 2.
5) For Enable Button Return True and to Disable the Button, Return False.














#AW Customization Consultant Maison Consulting & Solutions

Asp.Net MVC (5) - Exception Filter - HandleError

Applicable on Asp.Net MVC5 HandleError Filter This belongs to Exception Filters category (Authentication Filter, Authoriz...