Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Transform Map Fixed Value with Source column

Dallas Fanchier
Tera Expert

I am imported a knowledge article id and it doesn't have KB in front of the article number.  I currently have the following.  What am I missing.  Don't judge I am newer to scripting.

 

answer = (function transformEntry(source) {

var abc =source.KnowledgebaseArticle;
var op = KB+abc;

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

})(source);

1 ACCEPTED SOLUTION

Dallas Fanchier
Tera Expert

This is perfect.  TY

View solution in original post

2 REPLIES 2

DrewW
Mega Sage

So this "KnowledgebaseArticle" is probably "u_knowledgebasearticle".  You need to check this on the import table.

And your KB should be "KB" because its a string value that you want to add.

Your return value looks like it should also be op and not abc.

So something like

answer = (function transformEntry(source) {
    var abc =source.u_knowledgebasearticle;
    var op = "KB" + abc;
    return abc; // return the value to be put into the target field
})(source);

// I would have done this.
answer = (function transformEntry(source) {
    return "KB" + source.getValue("u_knowledgebasearticle");
})(source);

Dallas Fanchier
Tera Expert

This is perfect.  TY