How to get Previous value of record assignment
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 09:47 AM
Hi,
Please help me on below issue
SCTASK was Assignments changing as per situation, sometimes to groups, sometimes to Users.
Scenario 1 : Initially it was assigned to a user "David" , From David to it was assigned to Group : "Software", finally From Software group to it was assigned to "Hardware" group ( currently it was assigned to Hardware group).
Now I want to know that , to whom it was assigned Previously either group/user and it's value. (expected result: Software group ).
David-->Software group--->Hardware group .
Scenario 2: Initially it was assigned to :Hardware group---> David user---> software group ( currently it was assigned to Software group)..
Now I want to know that , to whom it was assigned Previously either group/user and it's value. (expected result: David User).
Kindly let me know how to get this solved.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 09:49 AM
Hi @Supriya25
Give a try to metric table on sctask .
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 10:17 AM - edited 12-20-2023 10:31 AM
Hi,
I tried to get data from sys_history_line.LIST
I tried below code
var gr = new GlideRecord('sys_history_line');
gr.addEncodedQuery('set=89c1652047937110e2192c44846d4368^field=assignment_group^ORfield=assigned_to');
gr.orderByDesc('sys_created_on');
gr.setLimit(1);
gr.query();
if(gr.next()){
gs.info("Field :"+gr.field);
}
getting Result like below :
here I'm getting current field value, bit how about we can get one step back
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 10:26 AM
Going in Audit is complicated so SN provide the metrics.
It will make your life easy and No code required.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 11:02 AM - edited 12-20-2023 11:12 AM
I understand , here we are looking at Metric table and telling that previously it was assigned to User Or group, clearly system showing , Perfect !.
BUT my concerns is
how can we get that previous assignment value in-form of RESULT value from code with Querying Metric table.
Please suggest !
