- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2024 01:37 AM
I have the below script where i am trying to update the state of record from open > duplicate request before insert in BR. I have below script but its not working.
1) should I make it After insert ?
2) Is the script wrong?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2024 03:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2024 03:45 AM
Try using current.update() after you set the state as 8, here is the code below.
function executeRule(current, previous /*null when async*/ ) {
var caseid= current.case;
var amount = current.amount;
var serv_type = current.type_of_service;
var gr = new GlideRecord('x_inffr_task');
gr.addQuery('case', caseid);
gr.addQuery('amount', amount);
gr.addQuery('type_of_service', serv_type);
gr.addQuery('sys_created_on', '>', gs.daysAgo(30));
gr.query();
gr.next();
while (gr.next()) {
current.state = '8';
current.update();
}
}
Thanks,
Let me know if that worked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2024 03:55 AM
The script worked with before insert