Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Answered

Ribbon Workbench value rule on grid only work if column is on grid

(0) ShareShare
ReportReport
Posted on by 40

Hello,

I am trying to enable/display a smart button on the main gird (view)  of a table (entity).

I want it to be enabled if the selected row has certain criteria met.

I found that when using the value rule in the ribbon workbench this only works if the grid (view) has all the columns (fields) in the condition.

I tried to use a custom enable rule using the following code but it will not return the true value back to ribbon workbench to enable the button

pastedimage1645714410235v1.png

pastedimage1645714448834v2.png

CheckForecastView: function (selectedItems) {
  var gridContext = selectedItems[0].Id;
  var retVal = false;
  Xrm.WebApi.retrieveRecord("msdyn_customerasset", gridContext, "?$select=a, b, c").then(
  function success(result) {
    var a = result.a;
    var b = result.b;
    var c = result.c;
    if(a !== 809700000 && b !== 1 && (c === "SA" || c === "SA13")) {
      retVal = true;
    }
    else {
      retVal = false;
    }
  return retVal;
  });
},

  • anavrin Profile Picture
    anavrin 40 on at
    RE: Ribbon Workbench value rule on grid only work if column is on grid

    Bipin,

    This worked.

    Thank you very much!

    Regards,

    Patrick Nielsen

  • Verified answer
    Bipin D365 Profile Picture
    Bipin D365 28,964 Super User 2024 Season 1 on at
    RE: Ribbon Workbench value rule on grid only work if column is on grid

    Hi,

    Your code is working but it is not returning the correct result because XRM.WebApi.retrieveRecord executes as async process. You will need to use promise to evaluate the ribbon rule. Please see below blog -

    debajmecrm.com/.../

    Please mark my answer verified if this is helpful!

    Regards,

    Bipin Kumar

    Follow my Blog: xrmdynamicscrm.wordpress.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

News and Announcements

Announcing Category Subscriptions!

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,370 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans