3

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.

  • Can you use a workflow rule with an outbound message? – bigassforce Apr 10 '14 at 18:07
3

@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.
|improve this answer|||||

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.