Can I set some variables in multiple line text field?

Kohei4
Giga Expert

Hi,
I would like to set some variables in CI comment field in multiple lines during discovery.
I know there is "Set Parameter Value" operation in the pattern designer.
Can I set variables in multiline text like below?
<Comment field>
 Variable A: xxxxxx
 Variable B: yyyyyy
 Variable C: zzzzzz

find_real_file.png

1 ACCEPTED SOLUTION

SiD2
ServiceNow Employee
ServiceNow Employee

Hi,

You can definitely have multi line text i guess, but the pattern designer doesn't have direct capability. So you need to use eval scripts to format the multi line text.

In the same step in Value field, type EVAL() and then you get edit option beside and then select "Other" in top right for groovy code.

Please refer the 2nd example in groovy section in below KB and you can add multi line text accordingly.

 

Please refer this KB article in how to write eval scripts.

https://hi.service-now.com/kb_view.do?sysparm_article=KB0647736

Please mark Helpful / Accept Solution so that it helps others with similar questions.

View solution in original post

5 REPLIES 5

SiD2
ServiceNow Employee
ServiceNow Employee

Hi,

You can definitely have multi line text i guess, but the pattern designer doesn't have direct capability. So you need to use eval scripts to format the multi line text.

In the same step in Value field, type EVAL() and then you get edit option beside and then select "Other" in top right for groovy code.

Please refer the 2nd example in groovy section in below KB and you can add multi line text accordingly.

 

Please refer this KB article in how to write eval scripts.

https://hi.service-now.com/kb_view.do?sysparm_article=KB0647736

Please mark Helpful / Accept Solution so that it helps others with similar questions.

Hi, 

Thanks for your info.
It is very helpful!

Could you please tell me the difference between the two option Javascript and other?
I didn't understand why I should choose other...

BR
Kohei

SiD2
ServiceNow Employee
ServiceNow Employee

Hi,

Great that it helped!!!

We support groovy code and there might be support for other languages as well which I'm not aware as of now. So they have that toggle button to identify for javascript code and other would refer groovy or any other languages supported as the code constructs differ.

Reason for me choosing groovy is just that I know it worked for me earlier, but on javascript I couldn't get it working and switched to groovy. However you can give a try with java script as well.

I see you marked my response helpful, can you also please go ahead and accept answer.

Please mark Helpful / Accept Solution so that it helps others with similar questions.

Thanks for sharing your experience!
And marked your answer as correct one!