How to replace text in script include
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2019 03:08 AM
Hello,
I have catalog client script and script include to which I pass value of date_from field from form and I retrieve this in Script include, however I need to replace the dots in the output with slashes but it just does not work.
Anything I have been doing wrong?
Please see below...
Many thanks,
Milan
Client script code snippet from GlideAjax:
ga.addParam('sysparm_date_from', g_form.getValue('date_from'));
Script Include side:
1.) var date_from = this.getParameter('sysparm_date_from'); - when I view the output it gives me a date in this form: 30.10.2019 11:03:07
2.) var date_from = this.getParameter('sysparm_date_from').replace(/\//g, '.'); - the required output is 30/10/2019 11:03:07 however this gives me 'null' instead when being viewed...
- Labels:
-
Multiple Versions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2019 03:13 AM
can you try this!
var date_from = this.getParameter('sysparm_date_from');
date_from = date_from.toString().replace(/\//g, '.');
-Satheesh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2019 03:13 AM
Hi
Try with this -
var date_from = this.getParameter('sysparm_date_from');
var convertedDate = date_from.toString().replace(/\//g, '.');
gs.print(convertedDate);
Try this.
Regards
Omkar Mone
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2019 03:14 AM
Try this
this.getParameter('sysparm_date_from').toString().replace(/\//g, '.');

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2019 03:16 AM
var t = "30.10.2019 11:03:07";
gs.print(t);
var s = t.replace(/\./g,"/");
gs.print(s);
Thanks,
Ali
Thank you,
Ali