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
nbnb 

Will callout initiated from trigger roll back if a custom validation rule fails?

Hi all,

 

I have a requirement where in there is a callouut initiated from the before update event of a trigger.and a custom validation rule.As per order of execution, the before trigger will run and then the validation rule will run.

Consider the trigger runs and the callout gets initiated and then the validation rule fails.

In this case will the callout transaction be rolled back?

 

Thanks

NB

Best Answer chosen by Admin (Salesforce Developers) 
sfdcfoxsfdcfox
You can't callout from a trigger, only from an asynchronous code that will perform the callout. The asynchronous code will also be rolled back in the event that a validation rule causes a failure, meaning the callout will never occur in the first place.

All Answers

sfdcfoxsfdcfox
You can't callout from a trigger, only from an asynchronous code that will perform the callout. The asynchronous code will also be rolled back in the event that a validation rule causes a failure, meaning the callout will never occur in the first place.
This was selected as the best answer
nbnb

Hi,

 

Yes, i am using an asynchronous code to initiate the callout from trigger. Forgot to mention it.

Thanks for your reply.

 

 

Regards,

Nagavi