Role API - ServiceNow Fluent
The Role API defines roles [sys_user_role] that grant specific permissions to users of an application.
For general information about user roles, see Managing roles.
Role object
Create a role [sys_user_role] to control access to applications and their features.
| Name | Type | Description |
|---|---|---|
| name | String | A name for the role beginning with the application scope in the following format: <scope>.<name>. |
| assignableBy | String | Other roles that can assign this role to users. |
| canDelegate | Boolean | Flag that indicates if the role can be delegated to other users. For more information, see Delegating roles. Valid values:
Default: true |
| description | String | A description of what the role can access. |
| elevatedPrivilege | Boolean | Flag that indicates whether manually accepting the responsibility of using the role before you can access the features of the role is required. For more information about elevated privileges, see Elevated privilege roles. Valid values:
Default: false |
| grantable | Boolean | Flag that indicates whether the role can be granted independently. Valid values:
Default: true |
| containsRoles | Array | The variable identifiers of other Role objects that this role contains. |
| scopedAdmin | Boolean | Flag that indicates whether the role is an Application Administrator role. For general information about application administration roles, see Application administration. Valid values:
Default: false |
| $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. Valid values for installMethod:
|
import { Role } from "@servicenow/sdk/core";
const managerRole = Role({
$id: Now.ID['manager_role'],
name: 'x_snc_example.manager'
})
const adminRole = Role({
$id: Now.ID['admin_role'],
name: 'x_snc_example.admin',
containsRoles: [managerRole]
})