- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2020 10:42 PM
Hi,
I have a requirement to populate the value of one catalog variable in "DD-MM-YYYY" format. This will happen based on a change in another catalog variable which is in "YYYY-MM-DD" format. I have written a catalog client script and a script include but the date format is not changing. It will be of great help if you suggest something on this. Am I missing something?
Client Script
Script Include
Output
Thanks,
Rajarshi
Solved! Go to Solution.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2020 11:37 PM
Try this-
After line 9
var formatdate= day.getByFormat("dd-MM-yyyy");
return formatdate;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2020 12:01 AM
Hi Rajashri,
Could you mark my answer correct as I have invested my time in this and provided you the solution and code changes for your requirement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2020 12:12 AM
Definitely
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2021 07:08 AM
I tried this but it is not working
Script include
var date1 = Class.create();
date1.prototype = object.extendsObject(AbstractAjaxProcessor,{
date:function()
{
var pg = this.getParameter('sysparm_abc');
var day = new GlideDate();
day.setDisplayValue(pg);
var formatdate= day.getByFormat("MM/dd/yyyy");
return formatdate;
}
});
CLient script
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var cdt = g_form.getValue('requested_date');
var ga = new GlideAjax('date1');
ga.addParam('sysparm_name', 'date');
ga.addParam('sysparm_abc',cdt);
ga.getXML(testing);
function testing(response){
var ans = response.responseXML.documentElement.getAttribute('answer');
var ag = ans.toString();
alert(ag);
g_form.setValue('priority',ag);
}
//Type appropriate comment here, and begin script below
}
Can you let me know why?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2020 11:18 PM
Hi,
In addition to above, check this thread
Let me know if this helps.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2021 07:31 AM
I tried this but it is not working
Script include
var date1 = Class.create();
date1.prototype = object.extendsObject(AbstractAjaxProcessor,{
date:function()
{
var pg = this.getParameter('sysparm_abc');
var day = new GlideDate();
day.setDisplayValue(pg);
var formatdate= day.getByFormat("MM/dd/yyyy");
return formatdate;
}
});
CLient script
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var cdt = g_form.getValue('requested_date');
var ga = new GlideAjax('date1');
ga.addParam('sysparm_name', 'date');
ga.addParam('sysparm_abc',cdt);
ga.getXML(testing);
function testing(response){
var ans = response.responseXML.documentElement.getAttribute('answer');
var ag = ans.toString();
alert(ag);
g_form.setValue('priority',ag);
}
//Type appropriate comment here, and begin script below
}
Can you let me know why?