${This message will be internationalized.}
However, this will NOT be.
```
--------------------------------
### $sp.getDisplayValue()
Source: https://serviceportal.io/docs/documentation/widget_server_script_apis.md
Returns the display value of a specified field from either the widget's sp_instance or the sp_portal record. It first checks the sp_instance record and then the sp_portal record if the field is not found or empty on the instance.
```APIDOC
## $sp.getDisplayValue()
### Description
Returns the display value of a given field (if it exists and has a value) from either the widget's sp_instance or the sp_portal record. Refer to the following diagram:
This map visualizes a service portal page with one widget on it. Calling $sp.getDisplayValue("title") would return the display value of the title field on the widget's sp_instance record. If the title field didn't exist or was empty, then it would try the same operation on the the sp_portal record for the current portal context.
> Note - Embedded widgets do not have sp_instance records.
### Method
$sp.getDisplayValue( fieldName )
### Parameters
#### Path Parameters
* **fieldName** (String) - The field name to get the display value of.
### Returns
#### Success Response
* **String** - A display value from either the sp_instance record or sp_portal record.
### Request Example
```javascript
(function() {
data.title = $sp.getDisplayValue("title");
data.catalog = $sp.getDisplayValue("sc_catalog");
})();
```
```
--------------------------------
### g_form API: Add Info Message
Source: https://serviceportal.io/docs/documentation/client_scripting.md
Displays an informational message to the user, typically at the top of the form.
```javascript
g_form.addInfoMessage(message)
```
--------------------------------
### Display Error Message with spUtil
Source: https://serviceportal.io/docs/documentation/widget_client_script_apis.md
Use to display a notification error message to the user. Accepts a string message.
```javascript
spUtil.addErrorMessage("There has been an error processing your request")
```
--------------------------------
### Set Glide List Filter and Items
Source: https://serviceportal.io/docs/documentation/client_scripting.md
Use g_list.get() to retrieve a glide list element and then reset, set the query, and add items. This API replaces g_filter on desktop client scripts.
```javascript
function onLoad() {
var myListCollector = g_list.get("my_list_collector");
myListCollector.reset();
myListCollector.setQuery("active=true^category=8c7b22230b402200b0b02c6317673a62");
myListCollector.addItem('3a700d39af5f4fc0aab978df90f4c692', 'Power Supply');
myListCollector.addItem('1cb93419a3a248318da8f814140b42f6', 'Backpack');
}
```
--------------------------------
### $sp.getFieldsObject
Source: https://serviceportal.io/docs/documentation/widget_server_script_apis.md
Retrieves an object containing valid field names from a GlideRecord.
```APIDOC
## $sp.getFieldsObject
### Description
Checks the specified field names, and returns an object containing the valid names.
### Method
$sp.getFieldsObject(GlideRecord, String)
### Parameters
- **GlideRecord** - The GlideRecord object.
- **String** (field names) - A comma-separated string of field names to check.
```
--------------------------------
### g_form API: Show Field Message
Source: https://serviceportal.io/docs/documentation/client_scripting.md
Displays a message (info or error) for a specific field, optionally scrolling the form to it.
```javascript
g_form.showFieldMsg(fieldName, message, type: "info | error", scrollForm)
```
--------------------------------
### GlideRecord: Go to Top
Source: https://serviceportal.io/docs/documentation/client_scripting.md
Resets the GlideRecord cursor to the first record in the result set.
```javascript
new GlideRecord(tableName).gotoTop()
```
--------------------------------
### $sp.getValue()
Source: https://serviceportal.io/docs/documentation/widget_server_script_apis.md
Retrieves the value of a specified field from either the widget's sp_instance or the sp_portal record. It returns the value if it exists and is not empty.
```APIDOC
## $sp.getValue()
### Description
Returns the value of a given field (if it exists and has a value) from either the widget's sp_instance or the sp_portal record.
### Method Signature
`$sp.getValue(fieldName)`
### Parameters
#### Path Parameters
- **fieldName** (String) - Required - The name of the field to retrieve the value of.
### Returns
- **Object** - A value from either the sp_instance record or sp_portal record.
```
--------------------------------
### g_form API: Submit Form
Source: https://serviceportal.io/docs/documentation/client_scripting.md
Submits the form, triggering onSubmit client scripts. Specify an optional submit action name.
```javascript
g_form.submit(submitActionName)
```