How to write a custom date validation on save button click event?
We have added a custom "Actual Resolve Date" field on detail_in page.
We want to validation that "Actual Resolve Date" can not be less than Open date.
How to achieve this requirement?
The Save button will call the function preSaveTrigger(). So if you define a function by this name in your form you can code any JavaScript that you want executed. Returning true from the function will allow the Save to complete; returning false will keep the Save from completing.
Hello Lindsay,
Thanks for your response. Actually I'm a newbie for CA Service Desk.
Can you please tell me "where should I write preSaveTrigger() function"? I mean I must call it as onclick of Save button, right?
Thanks in advance.
I recommend putting the function in the form (detail_in.htmpl in this case) file where you want to use it. You don't need to call it because the Out-of-the-box (OOTB) code calls it by name anyway. Of course, you need to be familiar with JavaScript and the DOM (Domain Object Model) to create the script.
Hi Rima,
I see that Lindsay has provided you with the information on using the function in the appropriate form. Unfortunately, from the support side of the house, this type of thing is outside the scope of support, thus we are not able to assist you on it.
Thanks,
Jon I.
Rima, also, if the information that Lindsay had provided has helped, please mark his post as the correct answer.
Hello Jon,
Thanks for the guidance. But I'm quite new on this forum. Would you please guide me how can I accept an answer?
Thanks.