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.

Need to concate the string

vinuth v
Tera Expert

Hi All,

 

I am working on the Schedule Script execution for creating a RITM in this I wrote a script it's working as expected. but I need to display two lines string and I am not able to concatenate the strings.

Script:
createCart();
function createCart() {
    var cart = new Cart();
    var item = cart.addItem('c8dd800a1b367d14d7354157dc4bcb1c');
    cart.setVariable(item, 'requester', 'e5159d97136b2b08c9dfb6076');
    cart.setVariable(item, 'email', 'Mario.ddd@xxxxxxx.com');
    cart.setVariable(item, 'request_title', 'Routine Task');
    cart.setVariable(item, 'request_description', 'This is to Update Browsers, Windows & Drivers on Non-Prod xxxx'+/n+'abc');
    var rc = cart.placeOrder();
}
I need to display the string like below,
vinuthv_0-1719587213324.png

Please any one suggest me, how to do this

 

Thanks in advance,

Vinuth

 

 

2 REPLIES 2

Robbie
Kilo Patron

Hi @vinuth v,

 

Can you try first try using a swapping the forward slash for a back slash: \n

If that doesn't work, try using using <br/> instead of /n

Examples:

cart.setVariable(item, 'request_description', 'This is to Update Browsers, Windows & Drivers on Non-Prod xxxx' + '\n' + abc);

or

cart.setVariable(item, 'request_description', 'This is to Update Browsers, Windows & Drivers on Non-Prod xxxx' + '<br/>' + abc);

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.


Thanks, Robbie

SAI VENKATESH
Kilo Patron

Hi @vinuth v 

 

If you want to get that worked you need change the field type from single line text to Multi line text. and then use the below code I have checked in my PDI it is working Fine.

 

 

createCart();
function createCart() {
    var cart = new Cart();
    var item = cart.addItem('c8dd800a1b367d14d7354157dc4bcb1c');
    cart.setVariable(item, 'requester', 'e5159d97136b2b08c9dfb6076');
    cart.setVariable(item, 'email', 'Mario.ddd@xxxxxxx.com');
    cart.setVariable(item, 'request_title', 'Routine Task');
    var abc = "1) https://dev.com/caselinesdevops/Aquarius/_wiki/wikis/Aquarius.wiki/444/Updating-the-DevOps-Pipelinet...";
    var description = 'This is to Update Browsers, Windows & Drivers on Non-Prod xxxx'+'\n' + abc;
    cart.setVariable(item, 'request_description', description);
    var rc = cart.placeOrder();
}

 

Thanks and Regards

Sai Venkatesh