You may need to execute some custom action on your parent form, when you add some records using quick create forms. As an example you may need to disable a field on work order form when you add work order incidents using quick create form.
In this case, you can add a subgrid event listener to your subgrid to perform your logic.
In this case, you can add a subgrid event listener to your subgrid to perform your logic.
- Create a javascript file as a web resource and add below functions to your javascript file.
- Include your javascript file in form libraries.
- Add your "AddSubgridEvents" function to Form Onload event handler and pass the execution context as a parameter.
function AddSubgridEvents(executionContext) { var formContext = executionContext.getFormContext(); addSubgridEventListener(formContext); } function addSubgridEventListener(formContext){ var gridContext = formContext.getControl("SUBGRID_ID"); //ensure that the subgrid is ready…if not wait and call this function again if (gridContext == null){ setTimeout(function () { addSubgridEventListener(formContext); }, 500); return; } //bind the event listener when the subgrid is ready gridContext.addOnLoad(subgridEventListener); } function subgridEventListener(gridContext){ // Gets the form context using subgird context var formContext = gridContext.getFormContext(); // Implement your logic here... }
Happy coding 😎