Add Dynamic single line text variable in Service Portal

salu
Mega Guru

Hello Experts,

Can some one please give an solution for my issue.

I have a single line variable.My requirement is need to add multiple data in to that field.It's not reference field so I cannot use glide_list.

They don't need it as comma separated also..

How can we achieve it?

Thanks

Saranya

1 ACCEPTED SOLUTION

Info from Share (i have attached the files as well):



With this update set I have setup a widget that you can apply to a catalog variable to create a dynamic input table of information. This widget gives flexibly in setting the title, columns and structure of the table to input data. This table can be made to limit the number of rows or allow for the user to create an endless number of rows to input their data. In short, this gives you the ability to create a spreadsheet type of variable for users to input their data.



When the request is submitted the table data is written into an HTML variable for display on request items along with a JSON variable that can be used for processing the raw data. I set this up so that you can use the widget both for display of the variable table but also edit the definition when you are logged on as an administrator.


View solution in original post

48 REPLIES 48

Hi Lars,



Thanks for the post on share.   I have been having a look at your solution and it looks like a good base for what we need, but the table we need will have 30 columns.


I added extra columns, but the system starts to truncate the fields, and after 20 columns they then go beyond the limits of the screen.




I was wondering if there is a way to stop fields truncating too small, and also to incorporate some form of scroll bar to stop extra columns going beyond the screen limits?


Alternativly was wondering if it is possible to use something similar but alter the format of the columns e.g. split them into sections or something:



E.g.



Section A contains the first 10 columns


Section B the next 10


Section C the next 10



You fill in each section and then click add and it creates 3 new sections?



I was just wondering your thoughts on how best to approach this, or any other ideas on how to solve this issue, and any suggestions around the code changes that would be required - I am still fairly new to servicenow with no coding experience previously.   I have slowly started getting to grips a bit more with the javascript side of things, but have done very little with the CSS and HTML.



Any help is greatly appreciated.



Thanks



Sam



P.S Thanks once again for the great work in this update set.


Hi All,



Firstly big thanks for this great post, I was able to make some progress, but so near yet so far.



My requirement is:   I need two tables on the portal, I duplicated pretty much everything [I think] but when the portal renders on the portal, it captures only the the data that is at the end of the form.   Screenshots below:







Where is the code that captures ALL the data?  



Thanks in advance for all your help!


This is beautiful.


Is there a comparable method if I users choose to use the Service Catalog UI instead of the Portal view?


larstange
Mega Sage

Hi



I have never used it my self, so I am just quoting the documentation



You map the output of the table to two variables. One containing and rendered HTML and the other the content in json.


find_real_file.png



If you use this functionality in a record producer, you need add logic to your processing script and map the JSON to the incident.


Alternatively you can simply map the "html_output" to the work_notes field. Then the HTML version of the table should be shown in the activity stream.


Hello Lars,


I tried to map the html_output to work_notes field,


But its now no luck



find_real_file.png