The CreatorCon Call for Content is officially open! Get started here.

Line breaks in Flow Designer

Cirrus
Kilo Sage

Please can anyone advise what the correct syntax should be to acheive the following in a create task description field using flow.

Requested for: u_requested_for

Contact details: contact_variable

Have scripted the following and tried several variations - both insert correctly on their own but as soon as I try and join them it fails)

 

return('\n' + "Requested for: " + fd_data._1_get_catalog_variables.u_requested_for.getDisplayValue() + '\n'
+ "Contact details: " + fd_data._1_get_catalog_variables.req_contact.getDisplayValue()))
1 ACCEPTED SOLUTION

Bhavya11
Kilo Patron
Kilo Patron

hi @Cirrus ,

 

can you try something like this 

 

 

var requestedFor = fd_data.trigger.request_item.variables.request_for;
var contactDetails = fd_data.trigger.request_item.variables.short_description;

var details= 'Requested for: ' + requestedFor + '\n' +
                   'Contact details: ' + contactDetails;

return details;

 

 

 

 

 

Please mark helpful & correct answer if it's really worthy for you.

 

Thanks,

BK

 

 

View solution in original post

6 REPLIES 6

Rajesh Chopade1
Mega Sage

hi @Cirrus 

 

To concatenate strings in a Flow Designer script for creating a task description field in ServiceNow, you need to ensure that you correctly reference the variables and format the string properly. Below is the corrected syntax:

 

return '\n' + 
       'Requested for: ' + fd_data._1_get_catalog_variables.u_requested_for.getDisplayValue() + '\n' +
       'Contact details: ' + fd_data._1_get_catalog_variables.req_contact.getDisplayValue();

 

 

This should work within the Flow Designer in ServiceNow, combining both fields into the task description. Ensure that the variable names (u_requested_for and req_contact) match exactly with what you have defined in your catalog variables.

 

i hope my answer helps you to resolve your issue if yes, mark my answer correct & helpful

 

THANK YOU

rajesh chopade

Rajesh Chopade1
Mega Sage

Hi @Cirrus 

 

Modify your code as bellow and try once again:

return '\n' + 
       'Requested for: ' + fd_data._1_get_catalog_variables.u_requested_for.getDisplayValue() + '\n' +
       'Contact details: ' + fd_data._1_get_catalog_variables.req_contact.getDisplayValue();

 

I hope my answer helps you to resolve your issue if yes, mark my answer helpful & correct.

THANK YOU

rajesh chopade

Bhavya11
Kilo Patron
Kilo Patron

hi @Cirrus ,

 

can you try something like this 

 

 

var requestedFor = fd_data.trigger.request_item.variables.request_for;
var contactDetails = fd_data.trigger.request_item.variables.short_description;

var details= 'Requested for: ' + requestedFor + '\n' +
                   'Contact details: ' + contactDetails;

return details;

 

 

 

 

 

Please mark helpful & correct answer if it's really worthy for you.

 

Thanks,

BK

 

 

Thanks Bhavya, works a treat