You need to sign in to do that
Don't have an account?
praveen murugesan
Update setup object and insert non setup object in @future method.
Hi all,
In my case initally i need to update setup and not setup object at a time. So I have used @future method to save setup object seperately. But new requirement is to save update setup object and if any error occurs i need to insert non setup object in @future method.
Scenario:
If any error occurs while updating user record i need to save that error in custom object.
I tried with
1. Created one more separate @future method to insert non-setup obj. but we can't call @future method from @future method.
2. Tried with Database.Update, try-catch-finally methods.
But its doesn't work.
Can any one help me pls.
Thanks.
In my case initally i need to update setup and not setup object at a time. So I have used @future method to save setup object seperately. But new requirement is to save update setup object and if any error occurs i need to insert non setup object in @future method.
Scenario:
If any error occurs while updating user record i need to save that error in custom object.
I tried with
1. Created one more separate @future method to insert non-setup obj. but we can't call @future method from @future method.
2. Tried with Database.Update, try-catch-finally methods.
But its doesn't work.
Can any one help me pls.
Thanks.
Please take a look on the below sample code, i have tested and worked fine.
Future handler class is,
If still non setup object record is not inserted means, please check some of the below points,
1. Check your storage Usage from the setup menu and verify your non setup object has sufficient data storage.
2. Create a debug log and monitor the issue.
3. Go to apex job from the setup menu you will get the status, if record not inserted then it will show as fail.
4. while inserting non setup object insert all required field values.
Here insertuser is @future method. and in salesforce we cant call @future from @future.
Thanks.
Praveen Murugesan.