You need to sign in to do that
Don't have an account?
tommytran
How to call a S-Control From a Trigger?
Hi all,
Please tell me how to call a S-Control from a Trigger? My case, when a contact is created, I had to call S-Control to get data by using Webservice API from external application.
The trigger runs on our servers, and as you know scontrols run in a client browser which may or may not be running when the trigger is running. the two are not connected.
you can call out to your service to clean up data, from Apex Code , but not from a trigger.
normally you would create a button , from the button call scontrol or apex to perform the callout which can then clean up your data.
What I suggest is to create a checkbox field which value would be reset (unmarked) everytime the trigger has been activated, So you could know when the execution of the scontrol is required and throught the scontrol set the chekbox field to the normal state after reciving the webservice response (this is only recommended if the event is not often).
Other way could be to send an email to the user in order to notify the required action. Perhaps there are other chances using ApexCode to consume the external webservice invoking a Salesforce webservice method from the trigger.
Hi lalit,
well, as Ron Hess said, it is not possible to do this directly. I suggest you to use the trigger in order to mark the record and later, with a scripting toolkit program (which could have the scontrol logic because it is mostly javascript or just to call out an apex webservice class) look for the marked records and do what you need in a bulk process.
Other possibility is to write the scontrol logic into an apexwebservice and call it from the trigger.
I hope this helps,
Regards,
Wilmer