web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
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;
  });
},

  • Verified answer
    Bipin D365 Profile Picture
    28,995 Moderator on at

    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/

  • anavrin Profile Picture
    40 on at

    Bipin,

    This worked.

    Thank you very much!

    Regards,

    Patrick Nielsen

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
11manish Profile Picture

11manish 71 Super User 2026 Season 2

#2
Travis South Profile Picture

Travis South 43

#3
Syed Aqib Raza Profile Picture

Syed Aqib Raza 40

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans