How to add line breaks in alert message on onLoad catalog client script in servicenow

Utkarsha Saxena
Giga Contributor

Hi Experts,

I need to add an alert on the load of a service catalog form and that alert has spaces and line breaks as below but when written like that on onLoad client script it does not accept spaces and the spaces I need to remove. How to show the line break in the alert on onLoad client script, please tell me-

Needed alert -

Things to Remember :

1.Maximum size of the file to be shared is 1 GB.If the file is bigger than 1GB,you can split the file using 7-ZIP.

2.Quota (maximum allowed storage) is 10 GB.

3.Shared file encryption : you must use a strong password to send a file.

4.WINRAR file will not work.You have to use 7-Zip only."

 

Code :

function onLoad() {
//Type appropriate comment here, and begin script below
alert("Things to Remember : 1.Maximum size of the file to be shared is 1 GB.If the file is bigger than 1GB,you can split the file using 7-ZIP.2.Quota (maximum allowed storage) is 10 GB.3.Shared file encryption : you must use a strong password to send a file.4.WINRAR file will not work.You have to use 7-Zip only.");
}

1 ACCEPTED SOLUTION

Vikas-Malhotra
Mega Guru

Hi,

 

alert(" Things to Remember :\n"+

"1.Maximum size of the file to be shared is 1 GB.If the file is bigger than 1GB,you can split the file using 7-ZIP.\n"+

"2.Quota (maximum allowed storage) is 10 GB.\n"+

"3.Shared file encryption : you must use a strong password to send a file.\n"+

"4.WINRAR file will not work.You have to use 7-Zip only.");

 

Thanks!

Vikas

View solution in original post

5 REPLIES 5

Harsh Vardhan
Giga Patron

use \n to change line

 

 

eg:

 

 

alert("Things to Remember : \n 1.Maximum size of the file to be shared is 1 GB.If the file is bigger than 1GB,you can split the file using 7-ZIP. \n 2.Quota (maximum allowed storage) is 10 GB. \n 3.Shared file encryption : you must use a strong password to send a file. \n 4.WINRAR file will not work.You have to use 7-Zip only.");

Vikas-Malhotra
Mega Guru

Hi,

 

alert(" Things to Remember :\n"+

"1.Maximum size of the file to be shared is 1 GB.If the file is bigger than 1GB,you can split the file using 7-ZIP.\n"+

"2.Quota (maximum allowed storage) is 10 GB.\n"+

"3.Shared file encryption : you must use a strong password to send a file.\n"+

"4.WINRAR file will not work.You have to use 7-Zip only.");

 

Thanks!

Vikas

It worked šŸ™‚ Ty

did i mention something different solution ?