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

When that happens, I usually go into the import set table to see how the data is being stored. I didn't think it was case sensative, but looking at how the data got pulled from the csv into the import set table should help see whats going on. Another thing to check is if the import set table column is set as a true/false, or just a string - can try either way to see if that fixes it.


rob_pastore
ServiceNow Employee
ServiceNow Employee

You do not need to map the target field in your script, make sure the "target table" and "target field" fields are set correctly. That is what maps answer to the value on the record.


They're set correctly but for some reason it doesn't like true/false fields everything else populates fine when I load the data/transform map but the only fields that do not populate correctly are the true/false fields it might just be something with the import set and serviceNow when trying to load those fields.


Ahhh,


That's because we were looking to deep, it's a much simpler issue!



answer = (function transformEntry(source) {


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


                              return true;


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


                            return false;


                              })(source);


I put this exact code in for each true/false field and it still doesn't populate. I thought it was a simple issue too.