I want escalate button to be added after 48 hours of case creation.

Suzy
Tera Contributor

Hi All,

 

I need escalate UI action should be visible to users after 48 hours of case creation.

 

Can you please suggest what needs to be added in the condition of UI action.

 

I will have to send an email once the case is escalated.

 

Thank you.

2 REPLIES 2

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Suzy 

 

Have a look here:

https://www.servicenow.com/community/now-platform-forum/hide-ui-button-based-on-state-and-time/m-p/1...

 

What is the use case showing button after 4 days, better to drive this on stat eor updated field. 

*************************************************************************************************************
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]

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

Danish Bhairag2
Tera Sage
Tera Sage

Hi @Suzy ,

 

You can call a script include in ur UI action & place this code in it n try if it works.

 

// This script assumes you have a field named 'sys_created_on' that represents the creation date

var caseCreatedOn = new GlideDateTime(current.sys_created_on); // Replace 'sys_created_on' with the actual field name

// Set the escalation threshold to 48 hours

var escalationThreshold = 48 * 60 * 60 * 1000; // 48 hours in milliseconds

// Calculate the time difference between now and the case creation date

var timeDifference = gs.nowDateTime().getNumericValue() - caseCreatedOn.getNumericValue();

// Check if the time difference is greater than or equal to the escalation threshold

if (timeDifference >= escalationThreshold) {

    // UI action should be visible when this condition is true

  return  true;

} else {

    // UI action should be hidden when this condition is false

    return false;

}

 

Thanks,

Danish