Transform map scripting date validation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2022 12:35 AM
in source table start date type is date/time and in target table start date type is only date now when i load the date with transform map excel sheet in excel if i put 02/03/2022 i target it coming as 01/03/2022 beacuase of time i need to ignore the time in script and just need to take date above script is written its not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2022 01:03 AM
Hi @veena mudaliar ,
Try below script:
answer = (function transformEntry(source) {
var startdate = new GlideDate();
if (source.u_start_date) {
var date = source.u_start_date.split(' ')[0]; //need space b/w source date and time
return date;
} else {
return startdate;
}
})(source);
ServiceNow Community MVP 2024.
Thanks,
Pavankumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2022 01:55 AM
still not working start date is not coming
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2022 07:01 AM
Hi @veena mudaliar ,
script is not same which I provided. on else return startdate not date.
If still not updating then that should be format issue if source and target formats are not same it will ignore.
Ex: source date=02/03/2022 and target start date - 02/03/2022
if both are different formats it will not update then you need send the target format.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2022 01:06 AM
return date; //in the last line
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2022 01:55 AM
still not working start date is not coming in target table