Need to put a more information annotation under or above Location field on Incident form

SNOW46
Tera Contributor

Hello All,

I want to put a annotation message or help information above or below of Location field in Incident form for the users to let them know if the current location is not their then they can reach out to IT Support to update their exact location.

This is how we can put in Record Producer but I want the same in Native Ui Incident form as well.

find_real_file.png

Can anyone help me out on this,

 

Thanks

13 REPLIES 13

Sourabh26
Giga Guru

Hi,

 

You can display the field message in the form based on submit, field change or on load of the form.

 

Method Detail
showFieldMsg(input, message, type, [scrollform])

Parameters
input — name of the field or control
message — message you would like to appear
type — 'info', 'error', or 'warning'; defaults to info if not supplied
scroll form — (optional) Set scrollForm to false to prevent scrolling to the field message offscreen

Example
Error Message
g_form.showFieldMsg('impact','Low impact not allowed with High priority','error');

Informational Message
g_form.showFieldMsg('impact','Low impact response time can be one week','info');
//or this defaults to info type
//g_form.showFieldMsg('impact','Low impact response time can be one week');

 

Mark this as Helpful/Correct, if Applicable.

 

Regards,

Sourabh

shloke04
Kilo Patron

Hi @SNOW

There are couple of ways you can handle this. First to mention you cannot do exactly similar to what you have shown in screenshot above in Native View:

Options available:

1) Add a Annotation below the field as per steps below:

Open the Incident form and Right click on the header and then select Configure-->Form Layout.

Then select Annotation and place it under the field you need as shown below and add the text:

find_real_file.png

find_real_file.png

Result:

find_real_file.png

Option 2: 

Use a Field Message to display the text you need:

For this you will need to write a On Load Client Script and use the script as below:

function onLoad() {
   //Type appropriate comment here, and begin script below
   g_form.showFieldMsg('caller_id','Your messgae','info');
}

Result:

find_real_file.png

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

SNOW46
Tera Contributor

Hello Shloke,

Actually Annotations didn't work for me. Even though I have added the text for Annotations and placed it under the Location field but still the message is not displaying. But the Onload Client Script did work for me. I just want to make the text bold and make it color change, so can you please help me out on this as well.

 

Thanks

@SNOW

Short Answer to making a text appearing from On Load client script as BOLD is NO. This cannot be done.

If you want to add a CSS or any custom styling like adding color or making it bold or anything else then you need to go with the  approach mentioned below i.e. by using Annotation as shown below:

1) Navigate to Annotation Table by typing "sys_ui_annotation_type.LIST" in Application Navigator menu as shown below:

find_real_file.png

Now click on New Button and give a Name which can be anything (meaningful) and add the CSS you want as for example shown below where I am adding a style to make the text as BOLD and adding a yellow color:

find_real_file.png

Now Save the record and Navigate and open your Form record and then Right click on the header and then select Configure-->Form Layout as shown below:

find_real_file.png

Now select Annotation from left slush bucket and place it on the Right side of the bucket under the field where you want as shown below:

find_real_file.png

Now you can select the Annotation name which you have created in step above as shown below and add your text as shown below:

find_real_file.png

Result:

Text is BOLD and in yellow color for example.

find_real_file.png

Refer the HI article below for more details:

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0870012

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke