Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

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

@vinod6 

your question is not clear.

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

AniketC85155510
Kilo Patron

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

@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.