@alien4u For example you are doing a search to gather Invoices on beforeSubmit. Instead of writing the search and acting on the search in the same beforeSubmit method, break the search into its own method and the logic that acts on it into another method and in the beforeSubmit call those methods