How to change labels in contextual search formatters

__ __140
Tera Contributor

I would like to know how to change labels in the contextual search formatter.

The target part is the red frame part of the attached image.

 

Inkedスクリーンショット 2023-08-28 152809.jpg

1 REPLY 1

Kartik Magadum
Kilo Sage

Hello @__ __140 

 

Here's a general outline of how you might approach changing labels in the Contextual Search Formatter in ServiceNow:

 

Access Contextual Search Formatter Configuration:

Navigate to "System Properties" > "Contextual Search" > "Formatters" to access the formatter configurations.

 

Identify the Relevant Formatter:

Review the list of formatters to find the one you want to modify. Each formatter is associated with a search source, and you need to identify the correct one.

 

Modify Formatter Labels:

Edit the formatter configuration to modify labels. This typically involves writing scripts using server-side scripting languages like JavaScript or server-side scripting in GlideScript.

 

Save and Test:

After making changes, save the formatter configuration.
Perform test searches to see if the labels are displaying correctly and according to your changes.
Here's a simple example of what a GlideScript might look like to change labels in the Contextual Search Formatter:

 

// Assume you're editing the formatter for the "incident" search source
if (current.source == "incident") {
    // Change the label for the short description
    result.title = "Incident Title: " + result.title;

    // Change the label for the description
    result.description = "Incident Description: " + result.description;
}

 

Please Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.

 

Thanks & Regards,

Kartik Magadum