+ Start a Discussion
samthakur74samthakur74 

Creating a S3 Bucket and adding Task records in S3

Hello,

I am attempting to add Task objects/records into AWS S3. I have installed Force.com for Amazon webservices.

I wrote the following trigger code

 

trigger S3Insert on Task (before insert) {
 Task[] TaskList = Trigger.new;
   for(Task t :TaskList)
      {
            AWS_S3_ExampleController c = new AWS_S3_ExampleController();
           // String credName = c.createTestCredentials();
          //  c.AWSCredentialName = credName;
            c.constructor();
            c.createBucket();       
      }
}

 

But i get exception:

Class.AWS_S3_ExampleController.createBucket: line 239, column 1
Trigger.S3Insert: line 9, column 1
05:36:00.224 (224038000)|FATAL_ERROR|System.FinalException: ApexPages.addMessages can only be called from a Visualforce page

 

I also see "System.CalloutException: Callout from triggers are currently not supported"

 

Is there any reason why webervice callouts cannot be made from Salesforce triggers?

 

Thank you

Sameer

 

 

 

 

 

 

 

 
samthakur74samthakur74

I think I have answer described @ http://boards.developerforce.com/t5/Apex-Code-Development/Callout-from-triggers-are-currently-not-supported/td-p/108871

Need to write the callout code in another Apex class which has @future annotation for the static void method making the callout. Call this method from the trigger.

regards Sameer