Audit log issue in before save hook

Hello Everyone 

I am facing an issue with the audit log in before save hook. 

I have a field that is enabled for the audit log. In before save logic hook I am throwing an exception on specific conditions in which data is not getting saved but still audit log is getting created so I have to avoid this audit log being created when the data is not saved. 

I have checked that no other code is affecting this in other logic hooks and record.js files.

Thanks in advance

Parents Reply Children
  • Hello Andre,

    To prevent the creation of an audit log entry in logic hooks, a specific exception-based solution is sought to restrict users from changing the status of a lead within a certain time frame. When the status is set to "New lead," an exception is thrown to halt the status change for 4 hours. The exception successfully prevents users from modifying the status, but the problem lies in the creation of audit logs even when the data is not saved.

    To clarify, the desired behavior is to avoid recording any audit log when the exception is triggered and the status change is not allowed. Currently, the exception prevents the status change but does not prevent the audit log from being generated, even though the data remains unchanged.

    The objective is to find a solution that allows the exception to take precedence over the audit log creation when the status change is blocked. This way, users cannot change the status during the restricted period, and no audit log is recorded for the prevented change.

    Thanks

  • Hello
    I hope this detail will make a clear understanding.
    Let me know if you have any confusion here.

    Thanks