ServiceNow is ready with the next release which is Xanadu and Introduced Domain specific Programming language Fluent and also SDK and IDE for ServiceNow users.
What is ServiceNow fluent ?
A TypeScript-based domain-specific language (DSL) called ServiceNow Fluent is used to define the metadata files [sys_metadata] that comprise applications. It also contains APIs for various sorts of metadata, including roles, tables, ACLs, business rules, and tests written using the Automated Test Framework.
ServiceNow Fluent includes APIs for the following types of metadata.
- Access control lists (ACLs)
- Application menus
- Automated Test Framework tests
- Business rules
- Client scripts
- Lists
- Properties
- Records
- Roles
- Scripted REST APIs
- Tables
Instead of using a form or builder tool user interface, developers create this metadata in a few lines of code. ServiceNow Fluent is compatible with applications developed using the ServiceNow IDE or ServiceNow SDK.
ServiceNow Fluent facilitates bidirectional synchronisation, enabling modifications to source code to be synchronised back to metadata across the instance and modifications to metadata to be synchronised from different Now Platform user interfaces into source code.
Automated test framework supports only one way synchronisation.If code is written for ATF and if metadata is changed outside the script then it will not synchronise the code which is written
ServiceNow fluent is built and executed using ServiceNow SDK and IDE only. And to deploy it we must use SDK and IDE only
Fluent Examples
Record Creation
//Create record in sys_app_category table
import { Record } from '@servicenow/sdk/core';
export const appCategory = Record({
table: 'sys_app_category',
$id: Now.ID[9],
data: {
name: 'example'
},
})
Business Rule Creation
//creates a business rule that pops up state change message whenever a todo record is updated
import '@servicenow/sdk/global'
import { BusinessRule } from '@servicenow/sdk/core'
import { showStateUpdate } from '../server/script.js'
BusinessRule({
$id: Now.ID['br0'],
action: ['update'],
table: 'x_snc_example_to_do',
script: showStateUpdate,
name: 'LogStateChange',
order: 100,
when: 'after',
active: true,
})
Client Script Creation
//creates a client script that pops up 'Table loaded successfully!!' message everytime todo record is loaded
import '@servicenow/sdk/global'
import { ClientScript } from '@servicenow/sdk/core'
ClientScript({
$id: Now.ID['cs0'],
name: 'my_client_script',
table: 'x_snc_example_to_do',
active: true,
applies_extended: false,
global: true,
ui_type: 'all',
description: 'Custom client script generated by Now SDK',
messages: '',
isolate_script: false,
type: 'onLoad',
script: script`function onLoad() {
g_form.addInfoMessage("Table loaded successfully!!")
}`,
})
Above are the limited set of examples, for detail examples please refer ServiceNow Fluent API reference
Also we can combine all the code in one file. ex. We can combine table creation , business rule creation and client script creation in one file but for this we need to import required packages
ServiceNow SDK
Software Development Kit (SDK) is is a set of platform-specific building tools for developers.
SDKs put everything you need to develop and run software in one place.This helps us to merge everything in one package
ServiceNow SDK is the NPM package which contains the required file that we can import while writing script in ServiceNow fluent.
The ServiceNow software development kit (SDK) provides the core libraries and tools for authoring applications with application metadata written in code using the ServiceNow Fluent language, as well as server-side JavaScript modules and third-party libraries. The SDK aims to transform the ServiceNow development experience by providing a source-driven model with modern, industry-standard development paradigms.
ServiceNow IDE
ServiceNow Integrated Development Environment (IDE) is a new application in ServiceNow Xanadu release.
IDE is based on the visual studio code which enables developer to built scope application using code.
We can write code in IDE using ServiceNow Fluent Language also, It manages different application in source control with common Git providers.
If we change something in the metadata which is created using IDE in normal view then it gets synchronise with the IDE code as well.All the libraries are available in the IDE.
Below image shows how IDE looks like

ServiceNow IDE is available on ServiceNow store but It is not available to install on ServiceNow PDI.
Content written in the blog is referred from the ServiceNow official site.

Leave a comment