Field message with special characters

Lavanya Nagendr
Giga Guru

 

 

Hi All,

 

I need to display the below message which contains a url and some special characters in a Field message but i couldn't achieve it, It resulted with an Parsing error. Kindly help me on this,

 

Message: 

To report a data incident please go the the Data Protection intranet page on the following page:

https://service-now.com/sp

A data incident is where something goes wrong with personal information, i.e.:

1) it's released to a person who shouldn’t have access to it (e.g. an email containing personal information is sent to the wrong person);

2) it's not used for the purposes it should be (e.g. a Sky employee sends personal messages to a customer);
it's altered or destroyed without authorisation (e.g. a non-account holder makes unauthorised changes to a customer account);

3) it's lost, stolen or compromised.

 

Catalog Client Script:

 

 

function onCondition() {
if (g_form.getValue('what_is_the_issue_relating_to') == 'A potential data Incident') {

		var msg1 = "To report a data incident please go the the Data Protection intranet page on the following page:

https://service-now.com/sp

A data incident is where something goes wrong with personal information, i.e.:

1) it's released to a person who shouldn’t have access to it (e.g. an email containing personal information is sent to the wrong person);

2) it's not used for the purposes it should be (e.g. a Employee sends personal messages to a customer);
it's altered or destroyed without authorisation (e.g. a non-account holder makes unauthorised changes to a customer account);

3) it's lost, stolen or compromised.";
		g_form.showFieldMsg("what_is_the_issue_relating_to", msg1, "info");


	}
}

 

 

 

 

 

Error:
Parsing error: Unterminated string constant (on line no.9)
 
Thanks,
Lavanya
1 ACCEPTED SOLUTION

Sagar Pagar
Tera Patron

Hi @Lavanya Nagendr,

 

The show field messages do not support the HTML. Hence you need to split message and add multiple/ no of show field messages.

 

Catalog Client Script:

function onChange(control, oldValue, newValue, isLoading) {
	if (isLoading || newValue == '') {
		return;
	}

	if (g_form.getValue('what_is_the_issue_relating_to') == 'A potential data Incident') {

		var msg1 = "To report a data incident please go the the Data Protection intranet page on the following page:";
		var msg2 = "https://sky.service-now.com/techss?id=tss_cat_item&sys_id=91b3dc761b5ab09474de873be54bcb16";
		var msg3 = "A data incident is where something goes wrong with personal information, i.e.:";
		var msg4 = "1) it's released to a person who shouldn't have access to it (e.g. an email containing personal information is sent to the wrong person);";
		var msg5 = "2) it's not used for the purposes it should be (e.g. a Sky employee sends personal messages to a customer);";
		var msg6 = "it's altered or destroyed without authorisation (e.g. a non-account holder makes unauthorised changes to a customer account);";
		var msg7 = "3) it's lost, stolen or compromised.";

		g_form.showFieldMsg("what_is_the_issue_relating_to", msg1, "info");
		g_form.showFieldMsg("what_is_the_issue_relating_to", msg2, "info");
		g_form.showFieldMsg("what_is_the_issue_relating_to", msg3, "info");
		g_form.showFieldMsg("what_is_the_issue_relating_to", msg4, "info");
		g_form.showFieldMsg("what_is_the_issue_relating_to", msg5, "info");
		g_form.showFieldMsg("what_is_the_issue_relating_to", msg6, "info");
		g_form.showFieldMsg("what_is_the_issue_relating_to", msg7, "info");


	}
}

 


If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers! 👍🏻
Thanks,
Sagar Pagar

 

The world works with ServiceNow

View solution in original post

4 REPLIES 4

Sagar Pagar
Tera Patron

Hi @Lavanya Nagendr,

 

The show field messages do not support the HTML. Hence you need to split message and add multiple/ no of show field messages.

 

Catalog Client Script:

function onChange(control, oldValue, newValue, isLoading) {
	if (isLoading || newValue == '') {
		return;
	}

	if (g_form.getValue('what_is_the_issue_relating_to') == 'A potential data Incident') {

		var msg1 = "To report a data incident please go the the Data Protection intranet page on the following page:";
		var msg2 = "https://sky.service-now.com/techss?id=tss_cat_item&sys_id=91b3dc761b5ab09474de873be54bcb16";
		var msg3 = "A data incident is where something goes wrong with personal information, i.e.:";
		var msg4 = "1) it's released to a person who shouldn't have access to it (e.g. an email containing personal information is sent to the wrong person);";
		var msg5 = "2) it's not used for the purposes it should be (e.g. a Sky employee sends personal messages to a customer);";
		var msg6 = "it's altered or destroyed without authorisation (e.g. a non-account holder makes unauthorised changes to a customer account);";
		var msg7 = "3) it's lost, stolen or compromised.";

		g_form.showFieldMsg("what_is_the_issue_relating_to", msg1, "info");
		g_form.showFieldMsg("what_is_the_issue_relating_to", msg2, "info");
		g_form.showFieldMsg("what_is_the_issue_relating_to", msg3, "info");
		g_form.showFieldMsg("what_is_the_issue_relating_to", msg4, "info");
		g_form.showFieldMsg("what_is_the_issue_relating_to", msg5, "info");
		g_form.showFieldMsg("what_is_the_issue_relating_to", msg6, "info");
		g_form.showFieldMsg("what_is_the_issue_relating_to", msg7, "info");


	}
}

 


If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers! 👍🏻
Thanks,
Sagar Pagar

 

The world works with ServiceNow

Hi @Sagar Pagar ,

 

I have updated my client script per your script, but the link is not resulted as a hyperlink instead it resulted with a text, Kindly help me out on this.

 

function onCondition() {
	var url = '<a href="https://service-now.com/sp">Click</a>';
if (g_form.getValue('what_is_the_issue_relating_to') == 'A potential data Incident') {

		var msg1 = "To report a data incident please go the the Data Protection intranet page on the following page:";
		//var msg2 = '<a href="https://service-now.com/sp"></a>';
		var msg3 = "A data incident is where something goes wrong with personal information, i.e.:";
		var msg4 = "1) it's released to a person who shouldn't have access to it (e.g. an email containing personal information is sent to the wrong person);";
		var msg5 = "2) it's not used for the purposes it should be (e.g. a Employee sends personal messages to a customer);";
		var msg6 = "it's altered or destroyed without authorisation (e.g. a non-account holder makes unauthorised changes to a customer account);";
		var msg7 = "3) it's lost, stolen or compromised.";
	
	var message=[];
	message.push(msg1,url);

		g_form.showFieldMsg("what_is_the_issue_relating_to", message, "info");
		//g_form.showFieldMsg("what_is_the_issue_relating_to", msg2, "info");
		g_form.showFieldMsg("what_is_the_issue_relating_to", msg3, "info");
		g_form.showFieldMsg("what_is_the_issue_relating_to", msg4, "info");
		g_form.showFieldMsg("what_is_the_issue_relating_to", msg5, "info");
		g_form.showFieldMsg("what_is_the_issue_relating_to", msg6, "info");
		g_form.showFieldMsg("what_is_the_issue_relating_to", msg7, "info");


	}
}

 

Hi @Lavanya Nagendr,

 

There is limitations in show field message. It do not support the HTML, hence we cannot add hyperlink. It will appear as normal text only.

 


If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers.
Thanks,
Sagar Pagar

The world works with ServiceNow

Maik Skoddow
Tera Patron
Tera Patron

Hi

can you please us the source code feature of the text editor because I guess I know the issue but want to be sure it is not related to a copy and paste issue:

MaikSkoddow_0-1692170351075.png

Maik