Hi,
Following 'https://community.dynamics.com/crm/f/117/t/246006', am trying to override case cancel OOB button in D365 v9. I check a custom field and only when it is filled , call the OOB fucntion 'CrmService.IncidentRibbon.CommandBarActions.cancel'
1. Js on the form...
function cancelreasoncasebutton() { //alert("start"); Xrm.Page.getControl("ecr_cancelreason").setVisible(true); var casereason = Xrm.Page.getAttribute("ecr_cancelreason").getValue(); if(casereason == null) { //alert("cancel stage"); Xrm.Page.ui.setFormNotification("Please fill Cancel Reason Field !!.","INFO","emailCheckNotification"); Xrm.Page.getControl("ecr_cancelreason").setNotification("Please Write the reason to cancel the case."); break; //return true; } else { // call CRM OOB function - CrmService.IncidentRibbon.GridCommandActions.cancelCase //CrmService.IncidentRibbon.GridCommandActions.cancelCase(); CrmService.IncidentRibbon.CommandBarActions.cancel(); } }
2. Add the function call in Action (Ribbon workbench)
After publish, When click the cancel button... Does nothing. Am i missing anything? Any pointers?
Br,Jackie