function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
stcforcestcforce 

add error and create separate object

i was trying to add an error on event if meetings coincide and wanted to create an log object indicating that a conflict occured. I would appreciate if anyone knew if this were possible - that is, both rollback of the object on which the trigger is defined and some method of adding a separate object.

thank you.

aebenaeben

Use a before trigger. Adding error to a object will rollback the whole transaction.

raseshtcsraseshtcs

Try using try catch and insert the error log record in the catch

stcforcestcforce

i am trying to have a trigger called on event and within this trigger have a mechanism to create something to which the rollback doesn't apply (both rollback and save). Simply rolling back the whole operation is insufficient for my needs.

Thank you anyway.

 

stcforcestcforce

Also i should mention that i do not have access to the place where the event is created and thus a try catch block is not able to be used.