You need to sign in to do that
Don't have an account?
raseshtcs
Save error in class @future
Public class utility{ @future public static void updatehmt(List<customobject__c> colist){ Update colist; } }
When I try to save the above class it doesnt save and gives error Unsupported parameter type LIST<customobject__c> at line 5 column 24
If I change the parameter to a set of ids the class gets saved. Any idea what am I doing wrong??
Here's what you need to do. Inside your userUpdate method, create the following List:
Replace the following line in your code
with the following one:
Then where you call your future method, pass the hmtFieldValues List to it as argument.
The code for the future method is below:
I've used a tilde (~) as separator, but oviously, you can replace it with something else if required. Also, I haven't executed this code, so there might be some minor errors.
Thanks.
All Answers
Hi,
Try the below code as reference for using @future:
public class UpdateNonSetupObjects
{
@future
public static void updateContact(list<String> usercontactid )
{
CustomObject__c[] updateimp = [SELECT id from CustomObject __c
Database.update(updateimp);
}
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
The parameters for a future method must be primitive dataypes, arrays of primitive datatypes, or collections of primitive datatypes. That's the issue with your method.
If you could send a few details around what you're trying to accomplish, I might be able to come up with a work-around.
Thanks.
On update of user object I want to update an entry in a custom object which is correspoding to the user.What I am doing is creating the list of the custom object which i need to update. Then call the future method to do the actual update. This i am doing to prevent the mixed dml operation error.But the list becomes empty inside the future method.
Below is the code
Thanks in advance
Here's what you need to do. Inside your userUpdate method, create the following List:
Replace the following line in your code
with the following one:
Then where you call your future method, pass the hmtFieldValues List to it as argument.
The code for the future method is below:
I've used a tilde (~) as separator, but oviously, you can replace it with something else if required. Also, I haven't executed this code, so there might be some minor errors.
Thanks.
Worked like magic.. here is the code which worked after small errors!!! Changed fieldVals from String to List of string