|
$id
|
String or Number
|
Required. A unique ID for the metadata object. When you build the application, this ID is hashed into a unique sys\_id. For more information, see [ServiceNow Fluent language constructs](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/servicenow-sdk/fluent-constructs.md).Format: `Now.ID['String' or Number]`
|
|
name
|
String
|
Required. A name for the widget.
|
|
category
|
String
|
The type of widget.Valid values:
- standard
- otherApplications
- custom
- sample
- knowledgeBase
- servicePortal
- serviceCatalog
Default: custom
|
|
clientScript
|
Script
|
A client-side script that defines the AngularJS controller. This property supports inline JavaScript or a reference to another file in the application that contains a script. Format:
- To use text content from another file, refer to a file in the application using the following format: `Now.include('path/to/file')`. For more information, see [ServiceNow Fluent language constructs](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/servicenow-sdk/fluent-constructs.md).
- To provide an inline script, use string literals or template literals for multiple lines of code: `'Script' or `Script``.
Default:
```javascript
api.controller=function() { /* widget controller */ var c = this;};
```
|
|
serverScript
|
Script
|
A server-side script that sets the initial widget state, sends data to the widget's client script using the `data` object, or runs server-side queries. This property supports inline JavaScript or a reference to another file in the application that contains a script. Format:
- To use text content from another file, refer to a file in the application using the following format: `Now.include('path/to/file')`. For more information, see [ServiceNow Fluent language constructs](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/servicenow-sdk/fluent-constructs.md).
- To provide an inline script, use string literals or template literals for multiple lines of code: `'Script' or `Script``.
Default:
```javascript
(function () { /* populate the 'data' object */ /* e.g., data.table = $sp.getValue('table'); */ })();
```
|
|
controllerAs
|
String
|
A variable for a reference to the controller in the directive's scope. The client script accesses the server data object using the `c.data` variable by default.Default: c
|
|
htmlTemplate
|
String
|
The body HTML code that defines what is rendered when the page is shown. It can contain either static XHTML, dynamically generated content defined as Jelly, or call script includes and UI Macros. This property supports a reference to another file in the application that contains HTML or inline HTML.Format:
- To use text content from another file, refer to a file in the application using the following format: `Now.include('path/to/file')`. For more information, see [ServiceNow Fluent language constructs](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/servicenow-sdk/fluent-constructs.md).
- To provide inline HTML, use string literals or template literals for multiple lines of code: `'HTML' or `HTML``.
Default:
```xml
```
|
|
customCss
|
String
|
The CSS or SCSS that defines the widget style. This property supports a reference to another file in the application that contains CSS or inline CSS. Format:
- To use text content from another file, refer to a file in the application using the following format: `Now.include('path/to/file')`. For more information, see [ServiceNow Fluent language constructs](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/servicenow-sdk/fluent-constructs.md).
- To provide inline CSS, use string literals or template literals for multiple lines of code: `'CSS' or `CSS``.
|
|
dataTable
|
String
|
The table in which to store widget instance options. To define a custom option schema, you can add fields to a table that extends the Widget Instance \[sp\_instance\] table and set your widget to use the extension table as a data source. For more information, see [Store instance options in a table](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/platform-user-interface/c_WidgetInstanceOptions.md).Default: sp\_instance
|
|
demoData
|
String or Object
|
Data that demonstrates the widget functionality. This property supports inline strings, a reference to another file in the application that contains JSON, or inline JSON serializable objects.Format:
- To use text content from another file, refer to a file in the application using the following format: `Now.include('path/to/file')`. For more information, see [ServiceNow Fluent language constructs](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/servicenow-sdk/fluent-constructs.md).
- To provide inline JSON, use an object with key and value pairs: `{ key: value }`.
|
|
description
|
String
|
A description of the widget and its purpose.
|
|
docs
|
Reference
|
The variable identifier of the Service Portal documentation \[sp\_documentation\] that provides additional information about the widget and its purpose. To define Service Portal documentation, see [Record API - ServiceNow Fluent](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/servicenow-sdk/record-api-now-ts.md).
|
|
fields
|
Array
|
A list of column names from the data table to use in the widget option schema.
|
|
hasPreview
|
Boolean
|
Flag that indicates whether you can preview the widget from the Widget Editor.Valid values:
- true: You can preview the widget from the Widget Editor.
- false: You can't preview the widget from the Widget Editor.
Default: false
|
|
id
|
String
|
A unique ID for the widget. The ID can't contain spaces.
|
|
linkScript
|
Script
|
A link function that uses AngularJS to directly manipulate the DOM. This property supports inline JavaScript or a reference to another file in the application that contains a script.Format:
- To use text content from another file, refer to a file in the application using the following format: `Now.include('path/to/file')`. For more information, see [ServiceNow Fluent language constructs](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/servicenow-sdk/fluent-constructs.md).
- To provide an inline script, use string literals or template literals for multiple lines of code: `'Script' or `Script``.
Default:
```javascript
function link(scope, element, attrs, controller) { }
```
|
|
roles
|
Array
|
A list of variable identifiers of Role objects or names of roles that can access the widget. For more information, see [Role API - ServiceNow Fluent](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/servicenow-sdk/role-api-now-ts.md).
|
|
optionSchema
|
Array
|
A list of parameters that a Service Portal administrator \(sp\_admin\) can configure for a widget instance. The widget option schema supports reusing a widget and uniquely configuring instances of the widget on different pages. For more information, see [Widget option schema](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/platform-user-interface/c_WidgetInstanceOptions.md).```javascript
optionSchema: [
{
name: 'String',
label: 'String',
section: 'String',
type: 'String',
defaultValue: 'String',
hint: 'String'
},
...
]
```
- name: Required. The name of the parameter.
- label: Required. A label for the parameter that appears in the widget instance options.
- section: Required. The section of the widget instance options in which the parameter appears.
Valid values:
- data
- behavior
- documentation
- presentation
- other
- type: Required. The data type of the parameter.
Valid values:
- string
- boolean
- integer
- reference
- choice
- fieldList
- fieldName
- glideList
- glyphIcon
- defaultValue: The default value of the parameter.
- hint: A short description of the parameter that displays as tooltip when hovering over it.
|
|
public
|
Boolean
|
Flag that indicates whether the widget is available to unauthenticated users.Valid values:
- true: Unauthenticated users can access the widget.
- false: Only authenticated users can access the widget.
Default: false
|
|
dependencies
|
Array
|
A list of variable identifiers of SPWidgetDependency objects or names or sys\_ids of dependencies for the widget. For more information, see [SPWidgetDependency object](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/servicenow-sdk/fluent-service-portal-api.md).
|
|
angularProviders
|
Array
|
A list of variable identifiers of SPAngularProvider objects or names or sys\_ids of Angular providers for the widget. For more information, see [SPAngularProvider object](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/servicenow-sdk/fluent-service-portal-api.md).
|
|
templates
|
Array
|
A list of Angular ng-templates \[sp\_ng\_template\] to associate with the widget. Angular ng-templates contain content that is rendered only when you instruct it to render.```javascript
templates: [
{
$id: Now.ID['String' or Number]
id: 'String'
htmlTemplate: 'HTML' or `HTML`
},
...
]
```
- $id: Required. A unique ID for the metadata object. When you build the application, this ID is hashed into a unique sys\_id.
Format: `Now.ID['String' or Number]`
- id: Required. The ID of the Angular ng-template.
- htmlTemplate: Required. The HTML template content. This property supports a reference to another file in the application that contains HTML or inline HTML.
|
|
$meta
|
Object
|
Metadata for the application metadata.With the installMethod property, you can map the application metadata to an output directory that loads only in specific circumstances.
```javascript
$meta: {
installMethod: 'String'
}
```
Valid values for installMethod:
- demo: Outputs the application metadata to the `metadata/unload.demo` directory to be installed with the application when the **Load demo data** option is selected.
- first install: Outputs the application metadata to the `metadata/unload` directory to be installed only the first time an application is installed on an instance.
|