The Now Platform® Washington DC release is live. Watch now!

Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

To prevent selection of change task planned start date & end date outside of change record planned start date and planned end date

Rajashekhar M
Kilo Sage
Kilo Sage

Hi Team,

I want to restrict the users to select change Task Start Date and End Date (I  mean it should not less than the change record planned start and end date) outside the Change planned Start Date and planned End Date.

can some one help on this.

Thanks in advance...

Thanks,

Rajashekhar Mushke 

Community Leader



Thanks,
Rajashekhar Mushke
Rising star -2023 & 2022
Community Leader -2018

1 ACCEPTED SOLUTION

Hi All,

 

Thanks for the response, no need to do a GlideRecord here because change task is child table of change request table, we can directly do a dot walking to get the parent table data.

 

I have created oBefore  insert/update business rule on change_task table, now it is working fine.

 

(function executeRule(current, previous /*null when async*/) {
if((current.planned_start_date < current.change_request.start_date)){

gs.addErrorMessage("The Task Planned Start Date should be within the Change Planned End Date.");
current.setAbortAction(true);
}

})(current, previous);

 

Hence closing this thread.



Thanks,
Rajashekhar Mushke
Rising star -2023 & 2022
Community Leader -2018

View solution in original post

4 REPLIES 4

RajuThelu
Mega Expert

Hi  Rajashekhar Mushke,

 

 

Create a script include and call the script include from the glideajax and pass the planned start and end date to check with parent record.

 

Please mark as helpful.if it solved your problem.

 

Regards

Raju Thelu

puneetgoels1
Mega Guru

You can make these fields read-only using a UI Policy

Harsh Vardhan
Mega Patron
Mega Patron

you can either write a after business rule to check if change Task Start Date and End Date is less than change record planned start and end date, then it should either abort the form submission or give some error.

or you can write glide ajax + script include to validate either on onSubmit client script or you can also write onchange() client script ( but you need to write two onchange() client script , one will be on change task start date and other will be on change task end date. )

 

script example:

 

var d ='2018-04-10 16:00:00'; // this would be your change task planned start date value
var gr = new GlideRecord('change_request');
gr.addQuery('sys_id','a9e9c33dc61122760072455df62663d2'); // change task field "change request" value 
gr.query();
if(gr.next())
{
gs.print(gr.start_date);

if(d <= gr.start_date)

gs.print('change task planned start date should be more than change record planned start date');

else

gs.print('it is good');

}

 

above script is an example. you can make some modification and add it in script include and based on the if condition you can return the value and use it in glide ajax.  or also you can use the script in your business rule on change task table. 

 

hope it will help you. 

 

Hi All,

 

Thanks for the response, no need to do a GlideRecord here because change task is child table of change request table, we can directly do a dot walking to get the parent table data.

 

I have created oBefore  insert/update business rule on change_task table, now it is working fine.

 

(function executeRule(current, previous /*null when async*/) {
if((current.planned_start_date < current.change_request.start_date)){

gs.addErrorMessage("The Task Planned Start Date should be within the Change Planned End Date.");
current.setAbortAction(true);
}

})(current, previous);

 

Hence closing this thread.



Thanks,
Rajashekhar Mushke
Rising star -2023 & 2022
Community Leader -2018