Append field in a transform

KB15
Giga Guru

Can I append a target field in a transform? I have files being imported to a table and it can affect the same field multiple times.

I was trying: "target.field = target.field + source.field" but that doesn't seem to work.

1 ACCEPTED SOLUTION

Hey Kkim,



I also tried to do the way you were trying to achieve and i was able to get the value in logs but was not able to append in table.



I believe it will not work in this way. In transform map source field you need to do GlideRecord, I tried to send incident short_description and it worked in this way. Please glide the record based upon you coalesce field.


find_real_file.png


find_real_file.png



Please find the sample code below:



answer = (function transformEntry(source) {


// Add your code here


var gr = new GlideRecord('incident');


gr.addQuery('incident', source.u_number); // pass the source coalesce field


gr.query();


if(gr.next())


{


var val = gr.short_description + ' ' + source.u_short_description;


return val; // return the value to be put into the target field


}


})(source);



Hope this helps.


View solution in original post

5 REPLIES 5

For any one searching the forums, I don't believe this works anymore. I instead wrote on the table transform map script the following code

target.Targetfield += source.u_souceField

This should work and ofc can append multiple fields from your transform map