Planned start time and Planned end time should be same in change request.

babbi
Tera Expert

Hi Team,

Can you please help me - attached script what is the result of it.

if there is any possible to keep start time & end time should not accept. how add this step in below script.

Onchange clientscript:-

babbi_0-1677058575949.png

babbi_0-1677058671243.png

 

 

2 ACCEPTED SOLUTIONS

Hi @babbi ,

In the same onChange script add the below line of scripts and shown in image.

Screenshot 2023-02-22 at 5.45.28 PM.png

 

 var startDate = g_form.getValue('start_date');
    var endDate = g_form.getValue('end_date');
    if (startDate == endDate) {
        var errorMessage = "Planned end date must be after Planned Start Date";
        g_form.clearValue('end_date');
        g_form.showErrorBox("end_date", errorMessage);

        return false;
    }

 

 

Mark helpful and accept the solution if it helps in solving your query.

 

Regards,

Johns

View solution in original post

Shamma Negi
Kilo Sage
Kilo Sage

Try this

 

var start = g_form.getValue('start_date');
var end = g_form.getValue('end_date');
if(start == end){
var errorMessage = "Planned end date must be after Planned Start Date";
g_form.showErrorBox("end_date", errorMessage);
return false;
}

Regards,Shamma Negi

View solution in original post

8 REPLIES 8

Johns Marokky
Tera Guru

Hi @babbi ,

I didn't quite understand your requirement.

Do you need the start date and end date not to be the same value for a Change Record?

Can you explain in more detail with an example?

 

Regards,

Johns

Hi @Johns Marokky,

Can you please help me urgnt requirement - in change request Planned start date time and Planned end date time is should not be accecpt ( same date is fine - But the end time must be different compare to start time).

How can we acheive  

Hi,

 

You can prepare a script onchange which will check the end date/time with start date/time and if the time is same then it will throw the error. I am preparing the script and will send you soon.

 

Regards,

Shamma

Regards,Shamma Negi

Hi @babbi ,

In the same onChange script add the below line of scripts and shown in image.

Screenshot 2023-02-22 at 5.45.28 PM.png

 

 var startDate = g_form.getValue('start_date');
    var endDate = g_form.getValue('end_date');
    if (startDate == endDate) {
        var errorMessage = "Planned end date must be after Planned Start Date";
        g_form.clearValue('end_date');
        g_form.showErrorBox("end_date", errorMessage);

        return false;
    }

 

 

Mark helpful and accept the solution if it helps in solving your query.

 

Regards,

Johns