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
samsonsamson 

Trigger and CallOut Webservice

Issue:

 

What I need is to sync every updates of case to another system(ASAP), firstly I tired to call an outside webservice in a after update trigger, But got following err message: "Callout from triggers are currently not supported."

 

After some research, it seems there are two ways as workaround. I've not tried them, please advise if my understanding is wrong:

 

1. use @future (callout=true) to mark the call out method.

2. Outbound Messaging feature

 

Question:

 

1. Both of above two workaround ways are asynchronous. Anyone know how long will it take to invoke outside webservice? will the @future one instantly call outside webservice?

2. Is there any other good solution, what I need is sync updates of case to outside system instantly?

 

Thanks a lot!

sfdccoder1sfdccoder1

Hello Samson,

 

>>1. Both of above two workaround ways are asynchronous. Anyone know how long will it take to invoke outside webservice?

From my experience an outbound usually fires right after the workflow fires.

 

>>will the @future one instantly call outside webservice?

No. It will execute "when Salesforce has available resources".

 

>>2. Is there any other good solution, what I need is sync updates of case to outside system instantly? 

 

If you want to guarentee instant updates you can override the case edit page with VF and have the save button call an APEX web service which calls the external web service to update the case. 

Is it a good solution? I don't know but it's the one.

 

HTH 

Message Edited by sfdccoder1 on 06-03-2009 05:47 AM
Message Edited by sfdccoder1 on 06-03-2009 05:48 AM
samsonsamson

Really appreciate your help on this!

 

I've tried workflow outbound message feature. It works great in my sandbox without data. It's really really fast to fire.

 

But what I also wanna do is to sync attachment into outside system. I found outbound message does't support attachment.(Can not found attachment object during the wizard of creating outbound message).

 

So I have no idea except using a windows services to keep checking attachment in a certain span of time.

 

Question:

1. Do you think if it's possible to override the upload attachment page with visualforce?

2. Is there any other ways to track case attachment upload events?

 

Thanks! 

sfdccoder1sfdccoder1

 

>>1. Do you think if it's possible to override the upload attachment page with visualforce?

Yes.

 

>> 2. Is there any other ways to track case attachment upload events?

I see two options:

  a. Add a trigger on the attachement object.

  If you need to send the attachement file itself it's tricky, I never done it but it looks possible. The idea is to send the file via web service or http put method.

  The most tricky part is if the file is larger than 100k, than you need to send it in chunks. This means setting a scedueler (see http://gokubi.com/archives/daily-cron-jobs-with-apex) or having your external system pull this data.

   

   b. Use external attachments.