- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2023 04:02 AM
Im trying to get the value of a field "status" on the table "task_sla" into a custom field I created in the "task [TASK]" table (the field name in "task" is "u_status"), Im using a BR to do this but Im not really sure how to do it, can anyone help ?
BR:
BR Code:
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord('task');
gr.addQuery('u_status');
gr.query();
gr.u_status = current.u_status;
})(current, previous);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2023 04:45 AM
u_status on task table is of what type?
Out of the box task_sla doesn't have Status field.
Did you change the label of an existing field?
The logic will be something like this
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord('task');
if(gr.get(current.task)){
gr.u_status = current.statusField; // this is the field on task_sla table
gr.update();
}
})(current, previous);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2023 04:57 AM
Hello @F_bio Santos
use the same code of @Ankur Bawiskar
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord('task');
if(gr.get(current.task)){
gr.u_state = current.u_status; // this is the field on task_sla table
gr.update();
}
})(current, previous);
, just do the modification which i shared.
Plz Mark my Solution as Accept and Give me thumbs up, if you find it helpful.
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2023 05:05 AM
Should I use this on the BR or on the code I sent before ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2023 07:36 AM - edited ‎09-12-2023 07:36 AM
This worked, I forgot that the "status" field on "task_sla" had some delay ...