- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2020 11:36 PM
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2020 11:58 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2020 11:58 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2020 01:14 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2020 02:54 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2020 09:37 PM
Thanks for sharing your experience!
And marked your answer as correct one!