how to bring a catalog item list variable br row wise in description of sc task

raj765_32
Tera Contributor

Hi can anyone help me with scenario for the catalog item variable (list type) to be displayed in description of sc task in row wise.

i have written a script :

 

task.description = current.variables.requested_role.getDisplayValue();
but it is displaying as 

For example:

asset manager,change manager,incident manager,problem manager .

It should display as:
Asset manager
change manager
incident manager
problem manager

I want to display as list in description field

 

2 ACCEPTED SOLUTIONS

Karunakaran
Mega Guru

Hi @raj765_32 ,

 

I think you can achieve this as below.

 

Karunakaran_0-1714070996238.png

 

 

Your final script will be like this.

 

var descString = current.variables.requested_role.getDisplayValue();
task.description = descString.replace(/,/g, '\n');
 
Please let me know, if you need more help.
 
Thank you.
 
Regards,
Karunakaran.

View solution in original post

Brad Bowman
Kilo Patron
Kilo Patron

Try this:

var desc = current.variables.requested_role.getDisplayValue();
desc = desc.toString().replace(/,/g, '\n'); //replace all commas in the value with a carriage return character
task.description = desc;

View solution in original post

2 REPLIES 2

Karunakaran
Mega Guru

Hi @raj765_32 ,

 

I think you can achieve this as below.

 

Karunakaran_0-1714070996238.png

 

 

Your final script will be like this.

 

var descString = current.variables.requested_role.getDisplayValue();
task.description = descString.replace(/,/g, '\n');
 
Please let me know, if you need more help.
 
Thank you.
 
Regards,
Karunakaran.

Brad Bowman
Kilo Patron
Kilo Patron

Try this:

var desc = current.variables.requested_role.getDisplayValue();
desc = desc.toString().replace(/,/g, '\n'); //replace all commas in the value with a carriage return character
task.description = desc;