You need to sign in to do that
Don't have an account?
Losintikfos
@Future
Hi Experts,
Do anyone know how to define methods that are defined as asynchronous,
that is, defined with the @future keyword? Simple sample will be highly appreciated.
B
Do anyone know how to define methods that are defined as asynchronous,
that is, defined with the @future keyword? Simple sample will be highly appreciated.
B
GV - you can't pass Sobjects as parameters into asynch methods. From the annotations help:
"Methods with the future
annotation cannot take sObjects or objects as arguments. "
You can pass a list or set of ID's and then query for the objects inside the method.
All Answers
There are a couple of examples in there :
David
Message Edited by Losintikfos on 10-13-2008 07:56 AM
You would typically store the response of the call out in some fields in an object ...
Can you describe what you're trying to do ?
David
This is what i am trying to do!
1. Anytime a new Account is created a trigger will be fired to invoke an apex class;
2. This Apex class then takes value from the AccountName and other fields to automatically invoke my remote service
3. This will process the request and return success confirmation.
Problem:
1. Finding it difficult to use trigger to invoke the Apex callout.
Message Edited by Losintikfos on 10-13-2008 08:21 AM
Method does not exist or incorrect signature: [wsServiceAccount.ServiceAccountHttpSoap11Endpoint].CreateService(Boolean, String, String, String, Double, Double, Date, Date, Double);
Message Edited by Losintikfos on 10-13-2008 08:33 AM
This will however not allow you to immediately display the result of your web service call to the user. (Don't know if you need this?)
Edit : I just saw the last message you added :
Method does not exist or incorrect signature: [wsServiceAccount.ServiceAccountHttpSoap11Endpoint].CreateService(Boolean, String, String, String, Double, Double, Date, Date, Double);
This method doesn't seem to exist in your class. Probably the number of arguments or their type is not correct.
David
Message Edited by David VP on 10-13-2008 05:54 PM
I am doing something like this;
This doesn't seems to work! do you have any clue what i am doing wrong?
David
and still get the exception:
Save error: Method does not exist or incorrect signature: [wsServiceAccount.ServiceAccountHttpSoap11Endpoint].CreateService(Boolean, String, String, String, Decimal, Decimal, Date, Date, Double)
-David
I have found the error! Apex2WSDL was saving the value of date as DateTime; Changing this did clear the error.
Quick one! do you know how to store the response from the remote server?
I am doing something like this;
Using the trigger:
This then generates the error:
Method does not exist or incorrect signature: ServiceAccount.createServ(LIST:SOBJECT:Service__c)
Do you know how to go about this?
B
so in the ServiceAccount class you need :
-David
Save error: Unsupported parameter type LIST:SOBJECT:Service__c e
Message Edited by Losintikfos on 10-14-2008 02:09 AM
(now I have) :smileysurprised:
The reference however says :
The parameters specified must be primitive dataypes, arrays of primitive datatypes, or collections of primitive datatypes
So perhaps you could build a list of the ID's and work with that ? (watch out for the governor limits though)
-David
Hi David
I have the same issue as the previous poster. My trigger passes on a list of Ids like this
Opportunity_Sales_Goal__c[] lstOpportunitySalesGoal = [Select Id from Opportunity_Sales_Goal__c where Sales_Goal__c in :Trigger.newMap.keyset()];
My class which has the @future callout receives the parameter thus
@future (callout=true) public static void OpportunitySalesGoal(Opportunity_Sales_Goal__c[] opportunitySalesGoalArr) { DateTime currentTime = System.Now(); for(Opportunity_Sales_Goal__c opportunitySalesGoal:opportunitySalesGoalArr) { opportunitySalesGoal.Last_Sync_To_Parent__c = currentTime; } update opportunitySalesGoalArr; } }
I am getting an error in this
Opportunity_Sales_Goal__c[] .
The error message says
Save error: Unsupported parameter type LIST:SOBJECT:Opportunity_Sales_Goal__c
How do I got past this error
Thanks in advance
GV - you can't pass Sobjects as parameters into asynch methods. From the annotations help:
"Methods with the future
annotation cannot take sObjects or objects as arguments. "
You can pass a list or set of ID's and then query for the objects inside the method.