In this video I covered a very important concept that is processing the json and creating task records from it. This can be used in Scripted REST APIs also.
JavaScript Basics Videos:
1. Looping over arrays and objects
• JavaScript Array and Objects | JavaScript ...
2. JavaScript Array Methods | Part 1
• JavaScript Array Methods or Functions | Ja...
3. JavaScript Array Methods | Part 2
• JavaScript Array Methods or Functions | Ja...
Timeline:
00:00:50 Processing the JSON to created records in Baackground Script
00:08:18 Creating Scripted REST API
Question:
Write a script to process the following JSON and create Incidents and Normal Change Requests
{
"incident":[
{
"short_description":"Unable to access email",
"description":""
},
{
"short_description":"VPN connection failure",
"description":"User cannot access the corporate VPN since 8 AM today. The error message displayed reads, 'Connection Timeout.' The issue affects remote access to internal resources, impacting work productivity. Restarted the system, but the issue persists."
}
],
"change_request":[
{
"short_description":"Upgrade database to latest version",
"description":"This change request proposes an upgrade to the database server to version 12.1 to enhance security and performance. The upgrade will involve a brief downtime for users, expected to last approximately 30 minutes. Testing will ensure system integrity post-implementation."
},
{
"short_description":"",
"description":"The server OS needs to be upgraded to address known security vulnerabilities and ensure compliance with company standards. This change affects all services running on the server and will require a 2-hour maintenance window during off-peak hours. A backup will be taken prior to the upgrade, and testing will be conducted post-upgrade to confirm stability."
}
]
}
Note:
1. If the short description is empty then don't create incident or change request
2. If description is empty then add short description in description field
#servicenow #servicenowcommunity #servicenowdeveloper #servicenowadmin #servicenowinterviewsupport #servicenowonlinetraining #servicenowcourse #servicenowscripting #servicenowuniverse #servicenowjobs