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 03:00 PM
var SYSID='552c48888c033300964f4932b03eb092';
var gr = new GlideRecord('metric_instance');
gr.addEncodedQuery('definition=35f0791ac0a808ae008f0a2b1dc1030c^ORdefinition=39d43745c0a808ae0062603b77018b90^value!=NULL^id='+SYSID);;
gr.query();
var totalcount=gr.getRowCount();
while(gr.next()){
if(totalcount>1){
gr.orderByDesc('sys_created_on');
gr.setLimit(1);
gr.query();
if((gr.getValue('duration')!="NULL" ||gr.getValue('duration')!="") && (gr.end!="") )
{
if(gr.definition=='39d43745c0a808ae0062603b77018b90'){
gs.info('Assignment Group Value :'+gr.value);
}else if(gr.definition=='35f0791ac0a808ae008f0a2b1dc1030c')
{
gs.info('Assigned To Value :'+gr.value);
}
}
} else if(totalcount==1){
if((gr.getValue('duration')=="NULL" ||gr.getValue('duration')=="") && (gr.end==""))
{
if(gr.definition=='39d43745c0a808ae0062603b77018b90'){
gs.info('Assignment Group Value :'+gr.value);
}else if(gr.definition=='35f0791ac0a808ae008f0a2b1dc1030c')
{
gs.info('Assigned To Value :'+gr.value);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 04:24 PM
@Supriya25 : Is it giving desired result?
Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.