today state value changes.

vinod6
Tera Contributor

Usecase: I need a today state values change to new to InProgress  incident records through script .

 

Could you please help any one

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@vinod6 

your question is not clear.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Aniket Chavan
Tera Sage
Tera Sage

Hello @vinod6 ,

Could you please provide additional details or screenshots related to your requirement? This would allow us to offer more precise assistance in resolving your query.

Thank You,
Aniket

Sandeep Rajput
Tera Patron
Tera Patron

@vinod6 The following script should give you the list of those incidents whose state changed from New to In Progress today.

 

var list = new GlideRecord('sys_history_line');
list.addEncodedQuery('update_timeONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday()^old_value=1^new_valueSTARTSWITH2^field=state^set.table=incident');
list.query();
var incidentArray = [];
while (list.next()){
 incidentArray.push(list.getDisplayValue('set'));   
}

gs.info(incidentArray);

Hope this helps.