Disbale Implementation button till planned start date window arrives

sravya03
Tera Contributor

Logic  to Disbale Implementation button till planned start date window arrives.

I have written below on load client script but it is not working

 

function onLoad() {
  // Get the planned start date
  var plannedStartDate = g_form.getValue('planned_start_date');
  // Get the current date and time
  var now = new Date();
  // Convert planned start date to a Date object
  var plannedStart = new Date(plannedStartDate);
  // Check if the current date is before the planned start date
  if (now < plannedStart) {
    // Disable the Implement button
    g_form.setActionDisabled('implement', true);
  }
}
28 REPLIES 28

Shivalika
Mega Sage

Hello @sravya03 

 

Add below condition in the existing UI action. 

 

gs.dateDiff(current.planned_start_date, new GlideDateTime(), true)>0 

 

Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket. 

 

Regards,

 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY

@Shivalika 

 

UI already has script ,can you please tell exactly where i need to paste this

Hello @sravya03 

 

 

1000020794.jpg

 

This is "Implement" UI Action in change request  table - in the condition field as highlighted you can edit. 

 

Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket. 

 

Regards,

 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY.

I did .. but still not working do i need to mention for ITIL role or available function?