
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2019 09:14 PM
We have custom workflow framework to simplify our workflows and as a result all of our catalog task default the opened_by to 'system'
I've written an after insert/update business rule, but it is not updating the opened_by:
var sctask = new GlideRecord('sc_task');
sctask.get(current.sc_task);
sctask.opened_by = current.request_item.opened_by;
sctask.update();
I've reversed the logic and got it working the other way around:
var sctask = new GlideRecord('sc_req_item');
sctask.get(current.request_item);
sctask.opened_by = current.opened_by; //populates the RITM opened_by to 'system'
sctask.update();
Any ideas why my first script does not update the opened_by?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2019 05:39 PM
Got it working correctly on the sc_task table:
current.opened_by = current.request_item.opened_by
I had my business running on after insert/update instead of before.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-29-2019 01:27 PM
Can you check if there is an ACL write that is stopping the update on sc_task
Vinod Kumar Kachineni
Community Rising Star 2022

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-29-2019 01:45 PM
The only write ACL we have on sc_task is the one to allow itil users write access, so it doesn't appear to be an ACL affecting it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-29-2019 01:51 PM
Can we try this??
var sctask = new GlideRecord('sc_task');
sctask.addQuery('request_item',current.request_item);
sctask.query();
while(sctask.next()){
sctask.opened_by = current.request_item.opened_by;
sctask.update();
}
Please mark my response as correct and helpful if it helped solved your question.
-Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-29-2019 01:56 PM
Just to be sure are you getting the right sys_ids
Please double check.
var sctask = new GlideRecord('sc_task');
sctask.get('sys_id of sc_task');
sctask.opened_by = 'sys_id of requested item opened by';
var updated = sctask.update();
gs.info('updated sysid = ' + updated);
Vinod Kumar Kachineni
Community Rising Star 2022

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-29-2019 02:15 PM
Thanks, yes - the sys_id of the requested item opened by appears in the log statements, but it doesn't update in the related tasks