The only thing I've changed is the switch to Unified Interface. The code was working as expected in classic look.
function formload() {
var GridOnloadFunction = function() {
SubgridModifed();
};
//Check if the grid is loaded and add the event handler to the subgrid.
var checkgrid = window.setInterval(function() {
if (Xrm.Page.getControl("DebitCards") != null) {
Xrm.Page.getControl("DebitCards").addOnLoad(GridOnloadFunction);
window.clearInterval(checkgrid);
}
}, 2000);
var checkgridCredit = window.setInterval(function() {
if (Xrm.Page.getControl("CreditCards") != null) {
Xrm.Page.getControl("CreditCards").addOnLoad(GridOnloadFunction);
window.clearInterval(checkgridCredit);
}
}, 2000);
}
function SubgridModifed() {
firstFunction();
secondFunction();
thirdFunction();
Xrm.Page.data.entity.save();
}