Load True/False data using Transform Maps

aishwarya53
Kilo Contributor

I have true/false fields on my excel file . After I loaded 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 excel file, the true/false fields are yes/no in excel. This is my script so far and it didn't work,

 

answer = (function transformEntry(source) {

 

                      if (source.u_released == "yes") {

 

                              return true;

 

                      if (source.u_released == "no") {

 

                            return false;

 

                              })(source);

 

u_released is  the source field

But on of the resource tells like 

""    source released field equals to the string of yes then mark the Boolean in target field as true ""

But i am not sure what it means. i tried various scripts but still it is show as false 

7 REPLIES 7

Tanushree Doiph
Mega Guru

Please try this,

https://community.servicenow.com/community?id=community_question&sys_id=e46acfa9db5cdbc01dcaf3231f96...

 

If my answer is impacted then please mark correct and helpful.

Thanks

Tanushree

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Aishwarya,

What is the data type of the target field that is mapped to u_released?

 

- Pradeep Sharma

Boolean type

Prateek kumar
Mega Sage

Can you try?

answer = (function transformEntry(source) {

if (source.u_released.toLowerCase() == "yes") {

return true;

if (source.u_released.toLowerCase() == "no") {

return false;

})(source);


Please mark my response as correct and helpful if it helped solved your question.
-Thanks