Reputation: 1442
I have written some javascript and attached it onto the onSave event of an entity to perform some actions when a record is deactivated. This works fine when on the form but if a user decides to deactivate the record from the entity view then this code does not get fired. Is there a way that I can attach this event to deactivating from here?
Thanks
Upvotes: 0
Views: 597
Reputation: 619
You can use the a Ribbon Editor to edit the "deactivate" Ribbon Button in the homepage grid to include a javascript function in a webresource. So when it is clicked the button will trigger your javascript code.
the only adjustment you have to make is to accept an input parameter given by the ribbon button.
You just need to make a RibbonButton and set a control so that it will return all the id's of the active grid. In the link you will have the "SelectedControlSelectedItemIds" but you have more options available.
if you alter the XML of the solution. Your function will require a parameter.
function getSelectedItems(arrayOfIDS){
for(var i = 0; i < arrayofIDS.length;i++)
{
//Your implementation here
}
}
Alternatively you can choose to write a plugIn like Daryl suggests
EDIT: Ribbon Workbench: With this tool you can customize system buttons with visual ribbon button you can't.
Upvotes: 1