Adding an informational error in the commit ('Edit' -> 'Save') section of a batch extension

I am trying to raise an informational error in the commit ('Edit' -> 'Save') section of a batch extension but the problem is that when I call the appropriate stored procedure to create the informational message (i.e. - USP_BATCHCONSTITUENTUPDATEBATCHUSERMESSAGE_ADD) it creates the record in the BATCHCONSTITUENTUPDATEBATCHUSERMESSAGE table but does not rollback the transaction. It seems that once it gets to the commit section of an batch extension spec, it has already run the transactions to to commit the record to the database. Is there anyway around that? Is there anyway that if the informational message is needed to be created at this time, the transaction can be rolled back and this be at least put into an error batch with the informational error message displayed at that time?


Any suggestions would be helpful because I have several situations that I will need to use this fix.


Thanks,

Matt

Comments

  • Hey Matthew,

    As far as I'm aware, it's not possible to rollback a transaction the way you're attempting to because the code from the base batch that you're extending will always run first and then the extension will run. So you can't really rollback the transaction because it's already been committed.

    Depending on the data your accessing and the complexity you could always have part of your extension check the associated audit tables for the old values and change the values back (not perfect but you'd be able to reset the values). The only other approach would be to recreate the batch so you have full control over the batch code.

    Sorry if that's not much help.

Categories