Inbound Email Actions multiple update
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2016 12:34 AM
Hi Experts
I have a really complicated issue.
I have created an inbound Email Action for a Time Card Approval Process.
this inbound Action is triggered when an approve email comes from a manager with Subject == approve.
The Target Table is Sys_User as my Notification Template must be on the Sys_user Table but the information that needs to be updated and approve is on the Time Card Table.
Now In my Inbound Action as I said Target is Sys_user and then in the script I GlideRecord Time card table with the fitler of the user that is requesting this approval.
The GlideRecord is working and giving me the correct data.
Now I just need to approve each record (changing state from Submitted to Approved) in the Time card table.
e.g. User A have 3 Time Records submitted, the manager gets an email with all 3 records and he approves via email. the Inbound action started and gliderecord filtering the user and in the while statement I can log all 3 data and see them but when I say gr.update(); to update my state, it only update one record. even it is running threw all 3.
Does anyone have an idea what is running wrong?
if (email.subject.indexOf("approve") >= 0) {
var gr = new GlideRecord('time_card');
gr.addQuery('user', current.sys_id);
gr.addQuery('state', 'Submitted');
gr.query();
while(gr.next()) {
gs.log('TIME INBOUND APPROVED for CURRENT USER: ' + current.name);
gr.state = "Approved";
gr.update();
}
}
thanks
Elias
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2016 08:29 AM
Hi ZA Thanks for your help
I am also getting deeper and deeper in snow core and yes I noticed that the issue is by creating the Expense Line. The TaskRateProcessor alone is not issuing but in this script include there is create expense line function and this is causing the issue, if I commented the //exp.createExpense(); all tasks will be approved and processed but again it wont create any expense line.
so what I think is that when the script include - Expense Line gets the GlideRecord from time card with 2 records e.g. it takes one and create an expense line after creating that it will stop.
I will continue fighting this chalenge
Elias