Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

How to get multi-line text g_form variable values from catalog item to workflow script?

bbf3562
Kilo Guru

In fulfiller workflow script, I am getting a multi text variable called get_name that array is assigned to in catalog client script. Here is what multi text variable looks like,

textarea.png

After submitted, In workflow script, gs.log(getList); is showing exactly log result as multi text box above,

log.png

However it seem when I try to use var lines = getList.split(','); to split members using comma and test it using log again but it not printing anything and sometime I get undefined. What is wrong with my code? Why getList is able to get string values but not lines variable? Here my sample codes,

find_real_file.png

1 ACCEPTED SOLUTION

Hi Bradley,



Can you try toString() and give it a try?


var lines = getList.toString().split(',');



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

7 REPLIES 7

amlanpal
Kilo Sage

Hi Bradley,



Can you please define the variable 'getList' as var getList = current.variables.get_name; instead of what is now and give it a try?



hope this helps. Please mark correct/helpful based on impact


I changed to var getList = current.variables.get_name;. The gs.log(getList); get same log result,


log.png


However the second log from lines doesn't print anything


omsa1
Kilo Guru

I have a requirement to get values from variable multiple line text box and update records in hardware table. how can i do this?

find_real_file.png