Hello,
I am trying to use an After Restore trigger and it is not working.
It is a simple object script trigger with two lines of code (selectQuery and updateRecord). I tried checking the 'On Finalize' option as well, but the trigger is not running at all.
Any suggestions ? Is there anything particular that needs to be done with this timing (After Restore) ?
Thank you
Meryem
Hi MeryK,
To run After Restore triggers nothing need to done particularly.
After restore trigger is working fine for me, Following is the script that executed.
Can you please let us know what exactly you are trying?
in following example i am updating the first name and middle name field values with last name field value.
var arr=rbv_api.selectQuery("SELECT lastName FROM SendEmailTriggerObj", 1, {!id});
rbv_api.setFieldValue("SendEmailTriggerObj", {!id}, "firstName", arr[0][0]);
x = new Array();
x["middleName"]="{!lastName}";
rbv_api.updateRecord("SendEmailTriggerObj", {!id}, x);
Thanks,
Rajkumar
So your code here is setting the first name and middle name values to last name value when you delete and restore the record ? Is that right ?
I am doing something very similar and here is the code :
rbv_api.println('Running after restore trigger');
var campaign = {!campaignStageCampaign#id};
var maxOrder = rbv_api.selectQuery("select MAX(orderInCampaign) from campaignStage where campaignStageCampaign = ?", 100, campaign);
rbv_api.println('maximum order in this campaign is : ' + maxOrder[0][0]);
var arr = [];
arr.orderInCampaign = maxOrder[0][0] + 1;
rbv_api.updateRecord('campaignStage', {!id}, arr);
The first print in the first line is not showing at all when I debug the trigger. I am just checking the 'After_restore' option in the trigger.
Any ideas why this is not working please?
Thanks
Meryem
Hi,
So your code here is setting the first name and middle name values to last name value when you delete and restore the record ? Is that right ?
--Yes
For me first line is printed while debugging.
Can confirm that second print statement is printing value of maxOrder[0][0]?
Can you please share the sample application if possible?
Thanks,
Rajkumar