Find your content:

Search form

You are here

Sending HTTP callout after a Lead record is updated

 
Share

I have a requirement where I have to send Lead data from Salesforce to TIBCO server once Send_to_CRM__c check box goes from false to true on Lead update.

Once updated 2 web-services are suppose to go out:-

  1. Get Security Token (getSecurityTokenWebService).
  2. Send Lead Information (createLeadWebService).

These web-services are to be sent out in a sequence, the first one will retrieve a security token which will be sent in the second web-service along with the lead data.

I created a trigger which will call the web-service function once the criteria is met. However it gives me the following error.

Callout from triggers are currently not supported.

I then tried using @future(callout = true), in that case I am not able to send trigger.new list to my function as @future doesnot allow any parameter to be passed.

How can I call this web-service after lead has been updated? The client want this web-service to be almost real-time.


Attribution to: Yash Mehta

Possible Suggestion/Solution #1

@future methods can definitely take arguments - just not SObjects. Instead, you pass in a collection of ids. As such, you need to use an after trigger (when Ids are present on insert operations and validations have completed)

The specified parameters must be primitive data types, arrays of primitive data types, 
or collections of primitive data types. 
Methods with the future annotation cannot take sObjects or objects as arguments.

Attribution to: cropredy
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/32445

My Block Status

My Block Content