CA Service Management

  • 1.  Custom js code on save button click

    Posted Sep 22, 2017 06:34 AM

    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?



  • 2.  Re: Custom js code on save button click

    Posted Sep 22, 2017 10:49 AM

    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.



  • 3.  Re: Custom js code on save button click

    Posted Sep 25, 2017 02:32 AM

    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.



  • 4.  Re: Custom js code on save button click
    Best Answer

    Posted Sep 25, 2017 08:52 AM

    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.



  • 5.  Re: Custom js code on save button click

    Posted Sep 29, 2017 11:37 AM

    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.



  • 6.  Re: Custom js code on save button click

    Posted Sep 29, 2017 11:39 AM

    Rima, also, if the information that Lindsay had provided has helped, please mark his post as the correct answer.

    Thanks,

    Jon I.



  • 7.  Re: Custom js code on save button click

    Posted Oct 03, 2017 01:33 AM

    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.