Change the transaction before saving to the database by using the preSaveRules(ctx) function

The preSaveRules(ctx) function allows for extra processing that is related to the transaction as a whole. You can use the preSaveRules(ctx) function to create a related object and add it to the transaction. The function is called before the Save action and is called for each noun in the message.