The CreatorCon Call for Content is officially open! Get started here.

scripting line break in comments field

Krischan
Giga Guru

I have an import, I want to add some scripts to and I start asking, how I can put various fields into the comment field.
So the idea is:
putting.



into one target field with a script 🙂 because the source data have 3 different comment fields (I hate it) and I need to get all of them into service now.

regards

Chrisian

1 ACCEPTED SOLUTION

CherylFlood
Giga Contributor

To add a line break:
answer = source.commentField1.toString() + "\n" + source.commentField2.toString() + "\n" + etc.


View solution in original post

6 REPLIES 6

CherylFlood
Giga Contributor

Try:
target. = source..toString() + source..toString() + source..toString();

Replace the items in <> with the correct field names and put this in a transform script in the transform map attached to your import. Or if you prefer to use a field map script, select the target field from the dropdown in the field map form and replace "target." with "answer".

answer = source..toString() + source..toString() + source..toString();


CherylFlood
Giga Contributor

Sorry, where there are two .. there were supposed to be field names.
target.commentField = source.commentField1.toString() + source.commentField2.toString() + source.commentField3.toString();
or in a field map:
answer = source.commentField1.toString() + source.commentField2.toString() + source.commentField3.toString();


CherylFlood
Giga Contributor

To add a line break:
answer = source.commentField1.toString() + "\n" + source.commentField2.toString() + "\n" + etc.


CapaJC
ServiceNow Employee
ServiceNow Employee

(removed redundant comment)