Hi Expert,
Have a current requirement, to say, if the activity type is Appointment and Appointment Activity owner is /Portal User/, show the Activity home page ribbon button /Cancel/, otherwise hide it. I try to user Ribbon Workbench Enable Rule to get it work. My code as below,
async function hideHomePageCancelBtn(firstSelectedItemId) { debugger; const activity = await Xrm.WebApi.retrieveRecord( 'activitypointer', firstSelectedItemId, '?$select=activitytypecode', /?$expand=appointment($select=ownerid)/ ); const isAptType = activity['activitytypecode']; const owner = appointment['ownerid'] if (isAptType === appointment) { if (owner === 'Portal User') return true; } else { return false; }}
After created Enable Rule and attached to the Command, tested it, not work.
The rule set up as below
Any suggestions/solutions are welcome and appreciated!