Status depend on date

gy891815
Tera Contributor

If date is past then status will show deployed otherwise it show inprogress in servicenow

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Hi @gy891815 

Not clear with you requirement, but you can try following imaginary script in your BR:

 

(function executeRule(current, previous /*null when async*/) {
var currentDate = new GlideDateTime();
var incidentDate = current.Name_of_date_field;

if (incidentDate <= currentDate) {
    current.incident_status = 'Deployed';
} else {
    current.incident_status = 'In Progress'; 

}

current.setWorkflow(false);
current.update();

current.setWorkflow(true);
})(current, previous);

View solution in original post

7 REPLIES 7

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @gy891815 

 

You did not give a full context, but you can use the BR / client script and check the Date with the current date and set the state to in-progress. It is do able but need more details to guide.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

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/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Hi all, 

I have one field in table is wave go live date and other field is wave status. If  go live date is past then wave status will be deployed otherwise it will show in progress 

Hi @gy891815 

 

So you can create the Flow and in the flow add logic if Go live date is greater than the Current date or the date you have and then in the action update record > and set the state.

 

https://youtu.be/5Wl9MpFDTb4

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

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/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************