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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Enable/Disable a button based on the activities selected in the activities subgrid in a custom entity

(0) ShareShare
ReportReport
Posted on by 1,331

Hi Crm community,

    I have a requirement like this, Based on record selection of activities subgrid, should disable OOB Cancel ribbon button.

If we select activity type task need to disable cancel button and email is selected the button should be enabled.

My code is as below, came to know we can retrieve an array of the selected items and can refer to values like this in the array

function canceldisable(selectedItems)
{
  var selectedItem = selectedItems[0];
  var code = selectedItem.TypeCode.toString();
 if(code == "4212")--task entity typecode
  return false;
if(code == "4202")--email entity typecode
  return true;
  Xrm.Page.data.save();
  Xrm.Page.ui.refreshRibbon();
} with selectedControlselecteditemreferences and selectioncountrule crm parameter references

used this custom js function in enable rules of ribbon workbench , with no actions , disable rules enabled,

when the same is published using ribbon workbench, the function is firing once the subgrid is loaded without clicking on any record and getting typecode of undefined null reference, think no array reference is coming to selected items.

 

Can you please check on this...

*This post is locked for comments

I have the same question (0)

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

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
RichardM Profile Picture

RichardM 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans