Load True/False data using Transform Maps

matthew_strecke
Kilo Contributor

I have two true/false fields on my csv file that I loaded into the system as a data source. After I map the data correctly, I run the transform map and the True/False fields are not being populated. I looked online for scripts to help with this problem and I tried a few scripts but nothing works. On the csv file, the true/false fields are in CAPS. This is my script so far and it didn't work,

answer = (function transformEntry(source) {

                      if (u_business_associate_agreement.u_avmed_baa_ == "TRUE") {

                              answer = true;

                      if (u_business_associate_agreement.u_avmed_baa_ == "FALSE") {

                              answer = false;

                              })(source);

u_business_associate_agreement is the source table

u_avmed_baa_ is the field

Would I need answer = false to be pointed to the target table?

12 REPLIES 12

Yeah when I go to the import set after loading the records, before running the transform map it has both the true/false fields set as strings but when I try to change them to true/false fields the option isn't in the type. Boolean isn't in the type either. I think the problem is the system cannot convert the string into a boolean.



Thanks,



Matthew Strecker


rob_pastore
ServiceNow Employee
ServiceNow Employee

sorry, replace the table name with source:



answer = (function transformEntry(source) {


                      if (source.u_avmed_baa_ == "TRUE") {


                              return true;


                      if (source.u_avmed_baa_ == "FALSE") {


                            return false;


                              })(source);


answer = (function transformEntry(source) {


if (source.u_non_avmed_baa_ == "TRUE") {


    answer = true;


if (source.u_non_avmed_baa_== "FALSE") {


    answer = false;


})(source);



Thank you for all the help but I finally got it to work. Above is the correct answer.



Thanks,



Matthew Strecker