The CreatorCon Call for Content is officially open! Get started here.

Transform Script - how to update target table field by comparing source table field.

Jk_
Tera Contributor

Hi All,

I have list of users in excel sheet that needs to be created in sys_user table. Excel sheet(source) is having two fields called 'start date' and 'end date' from those dates the user updated from excel should be marked active true and active false.

Jk__0-1692703685586.png

 

 

Thanks

 

1 ACCEPTED SOLUTION

Nayan  Dhamane
Kilo Sage

Hello @Jk_ ,

You can achieve this open create a maping which sets target as active field and check the source script field

 

In the script use the below code snippet:
var gd = new GlideDateTime();

var gd1 = new GlideDateTime(source.u_start_date);

var gd2 = new GlideDateTime(source.u_end_date);

if (gd1<gd && gd<gd2){

return true;

}

else{

return false;

}

 

If my answer solved your issue, please mark my answer as Correct & Helpful based on the Impact

Best Regards,
Nayan Dhamane
ServiceNow Community Rising Star 2023.

View solution in original post

1 REPLY 1

Nayan  Dhamane
Kilo Sage

Hello @Jk_ ,

You can achieve this open create a maping which sets target as active field and check the source script field

 

In the script use the below code snippet:
var gd = new GlideDateTime();

var gd1 = new GlideDateTime(source.u_start_date);

var gd2 = new GlideDateTime(source.u_end_date);

if (gd1<gd && gd<gd2){

return true;

}

else{

return false;

}

 

If my answer solved your issue, please mark my answer as Correct & Helpful based on the Impact

Best Regards,
Nayan Dhamane
ServiceNow Community Rising Star 2023.