- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-26-2019 05:07 AM
I have been having issues with a date field being passed into ServiceNow via a transform.
the date in the SQL table reads dd/mm/yyyy.
When the data populates into the import set, there are various issues.
I deleted the field on the import set table and ran another load of data in. This recreated the field as a string field and has corrected all of the issues I was seeing.
The problem is now transforming this into my user records.
If I set the transform map to read the field as dd-mm-yyyy i get the error:
Unable to format dd/mm/yyyy using format string dd-MM-yyyy for field u_dob
I think I am going to need a script to convert the string? But I have not been very successful to date and have tried several variations based on community posts. But nothing appears to work!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-26-2019 05:27 AM
Use the following script in field map and see if it works
var gdt = new GlideDateTime(source.u_field_name); // UPdate the field name to date field name on import set table
return gdt.getDate();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2020 06:50 AM
Hi dvp,
I am reopening the long post. I also have similar kind of requirement.
We receive a string from Splunk integration into servicenow. The value in the string which comes from Splunk is like this 2020-09-17T15:45:22.000+00:00
I need to convert this in to date and time
I have used the script which u have posted.
var gdt = new GlideDateTime(source.u_field_name); // UPdate the field name to date field name on import set table
return gdt.getDate();
By using this i am just getting only date but not time.
Could you please help with this requirement.
Thanks
