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 04:17 AM
Hi Veena,
Can you try below script. It is working for me
if(source.u_start_date){
var gdt=new GlideDateTime(source.u_start_date);
target.u_start_date=gdt.getDate();
}
Thanks
Viswa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2022 05:30 AM
need a script for end date field validation
end date should greater than start date if it not greater null that value in target
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2022 06:46 AM
Hi,
Write below code in End Date source script.
if(source.u_end_date){
var gdt1=new GlideDateTime(source.u_end_date);
var edt=gdt1.getDate();
}
if(source.u_start_date){
var gdt2=new GlideDateTime(source.u_start_date);
var udt=gdt2.getDate();
}
if(edt < udt){ //End date is less than Start date
target.u_end_date='';
}
else{
target.u_end_date=edt;
}
Thanks
Viswa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2022 03:49 AM
Hi @veena mudaliar ,
If your issue got resolved close the question by Accepting solution and hit thumb icon.
If not reply and share details.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2022 11:21 PM
Hi @veena mudaliar ,
If your issue got resolved close the question by Accepting solution and hit thumb icon.
If not reply and share details will try to resolve your issue.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar