--- title: "Add automatic post-processing actions" slug: "add-automatic-post-processing-actions" description: "Configure automatic post-processing with additional calculations for agreement lines in templates." updated: 2023-03-16T17:15:32Z published: 2023-03-16T17:15:32Z canonical: "docs.zilliant.com/add-automatic-post-processing-actions" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.zilliant.com/llms.txt > Use this file to discover all available pages before exploring further. # Add automatic post-processing You can add automatic post-processing with some custom business logic. For example, you can configure additional calculations or data updates, then specify a custom toast message for when the specific template is applied. 1. Create a Lightning component that will provide the handler code for the **ApplyTemplateCompletedEvent**. Example of a **SampleApplyTemplateEventHandler** component: ``` ``` 1. Create a **SampleApplyTemplateEventHandler** controller where you can specify pre- or post-processing actions and a custom toast message. ``` ({ handleApplyTemplateCompletedEvent: function (component, event, helper) { console.log('At the top of handleApplyTemplateCompletedEvent'); // get the params let params = event.getParams(); let templateId = params["templateId"]; let targetObjectId = params["targetObjectId"]; console.log('templateId: ' + templateId + ' targetObjectId: ' + targetObjectId); const toastEvent = $A.get("e.force:showToast"); const successMessage = 'Custom success message - applied template: ' + templateId + 'target: ' + targetObjectId; toastEvent.setParams({ type: 'success', message: successMessage, }); toastEvent.fire(); $A.get("e.force:refreshView").fire(); } }) ``` 1. Add this component to the Lightning page. Note - By default, the **Show Message On Successful Apply** checkbox is selected and a standard toast message **Template *Name* was successfully applied** appears. - You can clear the **Show Message On Successful Apply** checkbox. In this case, the toast message about a successful template application does not appear.