How to display the calendar exactly one year from day of request submission
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2023 04:34 AM
Hi All,
I want to display the data/time exactly one year from the day of request submission.
Currenlty, I am using the variable type as Date/Time but please help me to display exact one year.
Question : Duration of exception
Name : duration_of_exception
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2023 05:21 AM
Hi You can OnSubmit Catalog client script for below code
************Client script*************************************
function onSubmit() {
var gr = new GlideAjax('Validation');
gr.addParam('sysparm_name', 'setDate');
gr.getXML(PopulateDate);
function PopulateDate(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
g_form.setValue('start_date',answer);
}
}
*****************SI Code*****************************************************
setDate: function() {
var num = new GlideDateTime().getTime();
return num;
},
Please check and let me know if it helpful or not
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2023 05:52 AM - edited 03-23-2023 05:53 AM
Hi Kalyani,
Thanks for the reply.
It doesn't work.
I am getting this error.
Also, I am getting the same error for the script include code also.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2023 10:23 PM
Hi @taqdeer
Please confirm you select OnSubmit Client script or delete this one and try once on new OnSubmit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2023 06:53 AM
Hi Kalyani,
Is there any way that I can display the two columns from a table in the reference type variable on a catalog item in servicenow?
In the abave example only name is being displayed however we also want to display the code prior to it