How do i add a space in this script

carlm1984
Mega Contributor

Hello All,

I am not very good at scripting and have basically copied others here to get what i need.

I am trying to create a task script to do the below, but I have "Test" as a first name and "Testing" as a surname.

I currently have the below script, which show of works but I want a space between the first name and surname?

var comp = current.variables.eur_start_date.getDisplayValue();

var first = current.variables.eur_first_name.getDisplayValue();

var last = current.variables.eur_last_name.getDisplayValue();

task.short_description = 'New Account Required for'+ ' - ' + first + last + " - " + comp;

This is how it currently shows?

find_real_file.png

How can i get about sorting this out?

Cheers in advance

1 ACCEPTED SOLUTION

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Carl,



task.short_description = 'New Account Required for'+ ' - ' + first + last + " - " + comp should be


task.short_description = 'New Account Required for'+ ' - ' + first + ' ' + last + " - " + comp


View solution in original post

5 REPLIES 5

sourabhd87
Tera Contributor

Try below:



task.short_description = 'New Account Required for'+ ' - ' + first +" "+ last + " - " + comp;


Thank you this has fixed my issue


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Carl,



task.short_description = 'New Account Required for'+ ' - ' + first + last + " - " + comp should be


task.short_description = 'New Account Required for'+ ' - ' + first + ' ' + last + " - " + comp


Thank you this has fixed my issue