Setting choice action in transform map

Divya95
Tera Contributor

Hi ,

In our transform map ,we have string field mapping .But if the input field length in > 10 ,we need to set choice action as reject .How do we achieve this .Please suggest.

We have written the below code on Source field script .But if we give >10 ,its still creating the record.

 

answer = (function transformEntry(source) {

var temp_customer = source.customer;
if (temp_customer .length == 12)
{
return temp_customer ;
}
else
{
reject =true;
}
// return the value to be put into the target field

})(source);

 

 

 

6 REPLIES 6

SanjivMeher
Kilo Patron
Kilo Patron

Try this

 

answer = (function transformEntry(source) {

var temp_customer = source.customer;
if (temp_customer.length<10)
{
return temp_customer ;
}
else 
{
reject =true;
}
// return the value to be put into the target field

})(source);


Please mark this response as correct or helpful if it assisted you with your question.

sachin_namjoshi
Kilo Patron
Kilo Patron

please use below code

 

answer = (function transformEntry(source) {

var temp_customer = source.customer;
if (temp_customer .length < 10)
{
return temp_customer ;
}
else 
{
ignore = true;
}
// return the value to be put into the target field

})(source);

Hi Sachin ,

 

Thanks .But above script didnt work .Also please note we need to stop record creation .As per my understanding ,ignore just skips that particular field updation but record still gets created

SanjivMeher
Kilo Patron
Kilo Patron

Did you try this

 

answer = (function transformEntry(source) {

var temp_customer = source.customer;
if (temp_customer.length<10)
{
return temp_customer ;
}
else 
{
reject =true;
}
// return the value to be put into the target field

})(source);


Please mark this response as correct or helpful if it assisted you with your question.