Transform map script

Kshitij Chakarv
Tera Contributor

Hi All, 

 

I am creating a script to extract some specific value followed after a keyword. 

 

answer = (function transformEntry(source) {

var GR = source.u_description.toString();
var index = GR.indexOf("Fault Offset:");
var offset = GR.substring(index, index + 9);
return "source.u_short_description + '' + offset";

})(source);

 

 

Intension is to get the value after 'fault offset:' from source description is set to a custom field. 

I see no result using this script. Please advise on this.

2 ACCEPTED SOLUTIONS

AnubhavRitolia
Mega Sage
Mega Sage

Hi @Kshitij Chakarv 

 

Which type of transform script are you writing?

 

Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.

Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023

View solution in original post

Slava Savitsky
Giga Sage

Try changing

return "source.u_short_description + '' + offset";

to

return source.u_short_description + ' ' + offset;

View solution in original post

9 REPLIES 9

AnubhavRitolia
Mega Sage
Mega Sage

Hi @Kshitij Chakarv 

 

Which type of transform script are you writing?

 

Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.

Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023

Hi Anubhav, I should have mentioned, This is field map script. 

Slava Savitsky
Giga Sage

Try changing

return "source.u_short_description + '' + offset";

to

return source.u_short_description + ' ' + offset;

Sure Slava, I'll try that