How to convert a string field into a date field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2018 12:38 AM
Hi Experts,
In the User Record, I have a field Termination Date (u_termintion_date) which is a string type. This value is populating from my AD(Active Directory) as a string Value. Screenshot provided below.
I want to convert this value to a Date value and populate the same value in the field Term Date (u_term_date) which is a Date type field.
Termination date values are a random values and every time this value will be changing for different users.
Could you please help me with the code which I need to run in the business Rule After Update.
What will be the script used if I use Term Date as a Date/Time Type .
Please find the screen shot below
Regards,
Raju Singh
- Labels:
-
Best Practices
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2018 12:14 AM
Hi Vishal,
Thank you for the code. However, I think this is an incomplete code as it doesn't deal with my fields which I specified in the example. How shall I assign this code to my field.
document.body.innerHTML = dateObject.toString();
Could you please provide the full code
Regards,
Raju Singh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2018 03:03 AM
HI,
Below is a perfect example to make a string field to a date time field:
var date = new GlideDate('u_termintion_date');
Thanks,
Ashutosh Munot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2018 12:19 AM
Hi Ashutosh,
Thank you for your help. I tried your code but it gives me the following error.
Error Message
var date = new GlideDate('u_termination_date');
gr.u_term_date = date;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2018 12:49 AM
HI,
Use this: var date = new GlideDate(current.u_termination_date);
Thanks,
Ashutosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2024 03:55 AM