There's on change, and on save, but neither triggers on a row delete. I want to run a JS on the form when a row has been deleted from the Editable Grid using the trashcan icon on the furthest right of the row. Is this possible, somehow? Please note: editable grid, in 365, not standard grid.
*This post is locked for comments
Normally when record is created or deleted, the subgrid will refresh so I register a event when grid refresh
Try this.
function mainForm(executionContext) {
var formContext = executionContext.getFormContext();
//add event when grid is refresh after add or delete a record
formContext.getControl('subgrid logical name').addOnLoad(function(formContext){
//total record present in grid before delete
var totalRecord = formContext.getControl("subgrid logical name").getGrid().getTotalRecordCount();
//Check row is deleted or not
//if deleted then perform js
if(formContext.getControl("subgrid logical name").getGrid().getRows().get()[totalRecord-1] == undefined){
//action
}
});
}
I don't suppose you ever found a way to do this? I've got the exact same issue right now. I have a plugin recalculating a rollup when the child records are added/changed/deleted, but I need the screen to reflect that. I can get it to trigger via javascript when a record is added (via a listener on the grid onload), and when a record is changed (via the onSave event on the grid), but neither of these trigger when the record is deleted on the editable grid. :-( I also thought about a custom delete field/button/something - but there doesn't seem to be a way to get rid of the OOTB delete icon. Not even removing the user's permissions to delete! So I can't find a good way to add a custom delete that isn't confusing, given the OOTB one also being there.
Hi Erik,
in that case,
Normally when record get created or deleted, the subgrid will refresh, you can take a look in below post. copy the code from below post too.
community.dynamics.com/.../271605
Because V8.2 , we are not allowed to delete the record in editable subgrid.
So i only made a create record video for you.
Hi all, thanks for the replies.
I have a custom HTML iframe which contains summarized data from the editable grid.
I want this iframe to reload on grid row deletion.
Had it been a standard subgrid, there is an onload listener. Sadly it's not available for editable grid.
I'm thinking I might have to add my own custom Delete button...
Hi Erik,
would you mind to share what do you want to achieve via JS?
Hi Erik,
I'm not too familiar with JScript on Editable grids, but I would like to suggest an answer:
Add custom field to the entity form the grid is sitting on. Set a real-time workflow in place that uses the "Record is Deleted" trigger, once triggered, it updates the parent record's custom field. This field can hold a value that your JScript function can use to reference when utilized OnLoad, OnSave or OnChange.
Mohamed Amine Mahmoudi
83
Super User 2025 Season 1
Community Member
54
Victor Onyebuchi
6