4

Background

I am using Process Builder to run an Apex InvocableMethod which sends some data to a 3rd party REST API.

Sometimes the 3rd party REST API returns a validation error.

Question

How can I return this message from the InvocableMethod to the User as a friendly popup message?

Similar to how triggers allow this:

.addError('REST API Validation Message Goes Here!');
4

You cannot perform a callout after a transaction has started a DML operation, so your callout would necessarily need to be asynchronous, starting some time after the record is committed to the database. As such, there's no way to return an error to the user, and subsequently cancel the save operation, because it runs in a separate transaction. The best you could hope for is to do something like sending a message or updating/deleting a record.

  • Is there anyway to return a friendly error message from an InvocableMethod? – Robs Aug 1 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.