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

sravya03_0-1742478159803.png

 

Hello @sravya03 

 

I meant before making the modification, what was there, any condition was there or not ? 

 

Also, are you checking it on the record which has already crossed planned start date ? Because for other records it will be visible definitely. It will not be visible only when planned start date already crossed. 

 

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.

 

yes there was OOB condition which u pasted ....

yes i am testing for planned start which is 22nd march

Hello @sravya03

 

Then append it at the end "&&" with this. 

 

And you are checking for 22nd March means Implementation button should be visible. Is it visible or not ? 

 

Check for planned start date before today. It shouldn't be visible, after you have modified the condition like above. 

 

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.

My req is implement button should be diabled till planned start date window

it means it should be present on form but disabled and once planned start date comes then it should be enabled