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
PureFactsPureFacts 

Callout to external SOAP API on Contact save event

Good afternoon,

 

I am trying to exeucte a callout to an external web service on the standard Contact form via a trigger and am getting the following error:

 

Error:Apex trigger pwmsContactTrigger caused an unexpected exception, contact your administrator: pwmsContactTrigger: execution of AfterUpdate caused by: System.CalloutException: Callout from triggers are currently not supported.: Class.PWMSContactManagement.salesforceContactActionSoap.addContact: line 24, column 1

 

What is the quickest and easier way to execute a callout on the standard save event for a Contact to a external SOAP endpoint - I have already created by APEX class to call the SOAP endpoint by importing my WSDL so I am half way there I believe.

 

Hopefully there is a tutorial on this somewhere but I can't seem to find something specific to what I am trying to do.

 

Thanks in advance.

 

Whatty

 

 

 

sfdcfoxsfdcfox

Add the "@future" annotation to the class method that you're currently calling to execute the callout; this will allow you to call out asynchronously. Note that if you perform a DML on the same type of object, you will need to check against @future recursion (which will cause your logic to fail in the asynchronous call).