How to add new lines using multi row variable set

lucky6
Tera Contributor

Hi,

How to add new lines using multi row variable set in scripts?.

Do we have any limitations for multi row variable  set to not use "\n" or <br/>" ?

2 REPLIES 2

Amit Gujarathi
Giga Sage
Giga Sage

HI @lucky6 ,
I trust you are doing great.
To add new lines using a multi-row variable set in scripts, you can use the following code snippet:

var multiRowVar = new GlideRecord('u_multi_row_variable_set_table_name');
multiRowVar.initialize();
multiRowVar.setValue('request_item', current.sys_id);
multiRowVar.setValue('u_variable_name', 'Multi-row variable name');
multiRowVar.setValue('u_value', 'Line 1\nLine 2\nLine 3');
multiRowVar.insert();

Regarding your second question, there are no limitations for multi-row variable sets to not use "\n" or "<br/>". You can use either of them to add new lines in your multi-row variable sets.


Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi



Thanks for the reply.. but still i am not getting the data in next line instead of that it is showing spaces. please check the below script.

 

var gr = "test1\ntest2\ntest3";

 

var gc = new GlideRecord("sc_req_item");
gc.get("7f9e8c94076ae110debdfa9e7c1ed04b");
           var mvr = gc.variables.mrvs;
            var newRow = mvr.addRow();
            newRow.test = gr;

            gc.update();

lucky6_0-1683109922883.png