- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 04:47 AM
Hi,
Reflect SCTASK state field values to RITM state field values. it is working but How to do for RITM to SCTASK.
Can anyone please help on this. It will be helpfull.
After/update:
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 05:09 AM - edited 05-29-2024 05:09 AM
Hi @mania ,
I tried your problem in my PDI please make some changes this will work for you.
1. Create before BR. It so not recommended to use current.update() in after BR
2. Create BR on sc_req_item table
3. Add below code
(function executeRule(current, previous /*null when async*/) {
// Add your code here
gs.log("Here id = " + current.sys_id);
var gr = new GlideRecord('sc_task');
gr.addQuery('request_item', current.sys_id);
gr.query();
while(gr.next()){
gs.log('Inside while 123 = ' + gr.state);
gr.setValue('state', current.state);
gr.update()
}
})(current, previous);
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 05:09 AM - edited 05-29-2024 05:09 AM
Hi @mania ,
I tried your problem in my PDI please make some changes this will work for you.
1. Create before BR. It so not recommended to use current.update() in after BR
2. Create BR on sc_req_item table
3. Add below code
(function executeRule(current, previous /*null when async*/) {
// Add your code here
gs.log("Here id = " + current.sys_id);
var gr = new GlideRecord('sc_task');
gr.addQuery('request_item', current.sys_id);
gr.query();
while(gr.next()){
gs.log('Inside while 123 = ' + gr.state);
gr.setValue('state', current.state);
gr.update()
}
})(current, previous);
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak
