LogiUpSkill

ScriptedĀ RESTĀ API

Scripted REST API INDEX What is Scripted Rest API?……………………………………………………………… 1 Advantages of Scripted Rest API………………………………………………………. 2 Roles Required……………………………………………………………………………. 2 Fields of Scripted Rest API……………………………………………………………… 3 Difference between Rest API and Scripted Rest API………………………………. 3 Error Codes in Scripted REST API……………………………………………………… 4 Example……………………………………………………………………………………. 4 ​​  1. What is Scripted Rest API? Scripted REST APIs allow developers to create custom web service APIs in ServiceNow. These APIs enable external systems to interact with ServiceNow by defining endpoints, handling requests, and customizing responses beyond standard table APIs. Using Scripted REST APIs, developers can: Define custom endpoints (resources) Configure HTTP methods such as GET, POST, PUT, DELETE Accept and process query parameters, path parameters, headers, and request bodies Write scripts to control request handling, business logic, and response formatting Scripted REST APIs are created and managed using the Scripted REST Service form, available under: Scripted Web Services → Scripted REST APIs This is commonly used for: Integrating ServiceNow with external systems Exposing custom data and business logic Building reusable APIs for scoped applications 2. Advantages of Scripted Rest API It gives full control over how requests and responses work You can add custom business logic using scripts It can work with multiple tables at the same time You can return custom JSON responses It supports secure access using roles and authentication You can handle errors properly with clear messages It supports API versioning for future changes It is best for integrating ServiceNow with external systems 3. Roles Required The role required to create and manage a Scripted REST API in ServiceNow is web_service_admin. 4. Fields of Scripted Rest API Field Name Description Name Friendly name of the Scripted REST API API ID Unique identifier used in the API URI Namespace Application scope where the API is created Active Enables or disables the API Default ACLs Security rules applied to all resources Base Path Base URL path for the API Version API version for managing changes Short Description / Description Explains the purpose of the API Security Configure authentication and access control Content Negotiation Define supported request and response formats (JSON, XML, etc.) Resources Define API endpoints (URI paths) Request Headers Define expected HTTP request headers Query Parameters Define supported query parameters Ā  5. Difference between Rest API and Scripted Rest API REST API Scripted REST API Pre-built APIs provided by ServiceNow Custom APIs created by developers Mainly used for standard CRUD operations Used for custom logic and complex processing Limited customization Fully customizable using server-side scripts Follows strict ServiceNow table structure Can return custom response formats Faster to use for simple integrations Best for complex and non-standard integrations Less control over request/response Full control over headers, parameters, and payload Example: Table API, Attachment API Custom endpoints under Scripted REST APIs No scripting required Requires JavaScript scripting 6. Error Codes in Scripted REST API Error Code Meaning When It Occurs 200 OK Request successful API executed successfully 201 Created Resource created Record created via POST 400 Bad Request Invalid request Missing/invalid parameters or payload 401 Unauthorized Authentication failed Invalid or missing credentials 403 Forbidden Access denied User lacks required role/ACL 404 Not Found Resource not found Invalid endpoint or record 405 Method Not Allowed Invalid HTTP method Method not supported for resource 409 Conflict Duplicate/conflict Record already exists 415 Unsupported Media Type Invalid content type Wrong Content-Type header 500 Internal Server Error Server error Script error or exception 503 Service Unavailable Service down API temporarily unavailable 7. Example A catalog item named User Task Status exists in Instance A, which allows a manager to select a user to view the user’s task details. However, the actual task data (Incidents, Problems, and Change Requests) assigned to the selected user is maintained in Instance B. When the manager selects the User in catalog item in Instance A, the selected user information is sent to Instance B via integration. Instance B processes the request, fetches the count of Incidents, Problems, and Change Requests assigned to the user, and sends the response back to Instance A. The received response is then populated into the User Task Details variable of the catalog item. Steps of Implementation: Step 1: Create a catalog item in instance A 1.1. Create Variables Select User – reference – sys_user User Task Details – Multi Line Text 1.2. Final Catalog Item will Look Like this on Portal Step 2: Ā Create Scripted REST API in Instance B Create a New Scripted REST API. Navigate to ALL > System Web Services > Scripted REST API’s > New Give a name to new Scripted REST API and fill the mandatory fields as below: 2.1. Create Resource from related list Give name to a New Resource and fill mandatory fields as below: Script – This script retrieves the user from the request body, fetches the assigned user details from the User table, and returns the data in the response body to Instance A. Step 3: Create REST Message in Instance A Navigate to ALL > System Web Services > Outbound > REST Message > New 3.1. Provide Endpoint and Basic authentication details of Instance B. Give name to REST message and Endpoint of instance B 3.2. Basic Authentication Details Fill username and password details of the instance B 3.3. Create HTTP Method from related list Select HTTP method, Endpoint, HTTP Headers and Query Parameters Step 4: Create Script include to call REST Message in instance A Navigate to ALL > System Definition > Script Include > New Give a name to Script Include as below: Script- This script will fetch the user that is selected on the catalog item, calls the REST message we have created in instance A, and whatever response we get from instance B, script will fetch assignment details for the user. Step 5: Create catalog client script for your catalog item which is created in step 1 Fill the required details like Type, Catalog item, Variable Name and UI Type as below: Script – This script will get the value of the user from the

Table Names in Service-now

Table Names in Service-now Users – sys_user Roles – sys_user_role Group – sys_user_group Contains Roles – sys_user_role_contains UserRole mapping – sys_user_has_role GroupMember – sys_user_grmember Application menu – sys_app_application Modules – sys_app_module Choice – sys_choice Business Rules – sys_script UI Actions – sys_ui_action Client Script – sys_script_client Plugins – v_plugins Syntax Editor macros – syntax_editor_macro Dictionary Entries – sys_dictionary Tables – sys_db_object Remote Instance – sys_update_set_source Retrieved Update Sets – sys_remote_update_set Update Set Log – sys_update_set_log Local Update Set – sys_update_set Incident – incident Task – task Problem – problem Change request – change_request Field Classes – sys_glide_object Form Sections or Layouts Ā –Ā sys_ui_section Views –Ā sys_ui_view Dictionary Entry Override –Ā sys_dictionary_override Request – sc_request Catalog Item –Ā sc_cat_item Requested Item – sc_req_item Catalog Task – sc_task Add Your Heading Text Here

Domain Separation In Service-now

Domain Separation In Service-now 1. MSP –Managed Service Providers 2. It is a paid plugin, user needs a Maint Role to activate the plugin in your instance. 3. It is a logically defined entity used to 1. Separate Data 2. Separate Process 3. Administrative Tasks Ā  Ā  Ā  4. MSP deals with which user can see and access what data 5. By structure Service now has a Single Tenant Architecture but by using MSP plugin it can be used as Multi-Tenant Architecture 6. Multi-Tenant: It is a structure of application where single instance of the application serves multiple customers by sharing the application properties and a single database. 7. Service now with MSP Plugin: 1. Service now with MSP Plugin acts as a Multi-Tenant architecture where single instance serves multiple customers using single database. 2. Each customer data is isolated and remains invisible to other customers. 8. When we should not go with MSP Plugins- 1. In case of total separation of all system properties 2. Does not require the global reporting 3. Does not require a single global processes 9. System will not support the following tables from being domain Separated Access Control [sys_security_acl] Script Includes [sys_script_include] System Property [sys_properties] Dictionary Entry [sys_dictionary] Dictionary Entry Override [sys_dictionary_override] 10. Domain Scope: Domain scope defines what users can(data) and cannot access(data) and how(Process). 1. Session Scope Domain 2. Record Scope Domain 1. Session Scope Domain: a. User Domain b. User domain Picker Domain Session domain of users is nothing but the user record domain if we have the user domain and the domain picket domain is the same in case of not, session domain is the same like the domain which use has selected from domain picker. Users from parent domain they can change their session domain by changing from Domain picker. 2. Record Scope Domain: a. It is nothing but the domain of that targeted record. By Default the record scope take precedence over the session scope 11. We have following domains which has some special meanings. Global Domain: a. All the records which we have before enabling the MSP plugin, are part of global domain. b. Guest user is a part of global. Default Domain: a. We can set any domain as a default domain but only one can be a default domain. b. If you set default domain in an instance, instance will replace the global domain with default domain whenever the record creation happens. Primary Domain: a. Only the domain which does not have parent can be set as primary domain.

Reference Qualifier in Service-now Ā Ā 

Reference Qualifier in Service-now 1. Reference QualifierĀ  Ā :- It is used for filtering. They help refine the choices available in a reference field by defining conditions that the referenced records must meet. A reference qualifier is a filter applied to a reference field to restrict or refine the list of records that users can select from.Ā  If you want to set default value of reference field as current user javascript:gs.getUserID(); Types of reference qualifier:- 1. Simple Reference Qualifier: – Ā A simple reference qualifier in Service Now is often written as an encoded query string or a Glide Record query. It’s used to filter the choices available in a reference field based on specific criteria.Uses simple AND/OR conditions to filter records. For example, you can show only users where “Active” is “true”. Ā How to Reach Reference Qualifier in OOB Table or Custom Table: Ā Open any Table of Your Choice: – Incident/Problem/Change. Step 1:-Application Navigator>Table>Open Existing Record or Create New. Step 2:- Right Click on Any Reference Field i.e. assigned to and Configure Dictionary Step 3:- We are showing Reference Specification and applying Condition. 2. Dynamic Reference Qualifier: – Dynamic reference qualifiers enable you to use a dynamic filter option to run a query against a reference field to filter the returned data set. Dynamic filter options are stored filters that can contain encoded query strings, JavaScript, or script includes, and can be used in multiple dynamic reference qualifiers. Changes made to a dynamic filter option automatically apply to all reference qualifiers that use the same dynamic filter option. Use this type of reference qualifier when you want to use the same filter on multiple forms or to provide filter functionality to “non-code savvy” implementers. The base instance provides several OOB dynamic filter options. If a dynamic filter option that meets your needs does not exist, you can create a new dynamic filter option that is specific to your requirements.All the available dynamic filters are stored inĀ system definition>dynamic filter options.For creating the dynamic reference qualifier we must have a record in this dynamic filter options.After creating the dynamic reference qualifier you can add that filter from theĀ DynamicĀ  Ref qualĀ field. 3.Advanced Reference Qualifier: – Advanced reference qualifiers enable you to define an inline encrypted query string or JavaScript (actual code or the name of an existing script include or business rule) filter directly in the Reference qualified field of the reference qualifier. Similar to the other reference qualifier types, when the form loads, the filter is executed, and only the records that match the filter appear in the reference field. Use this type of reference qualifier for implementations that only require a simple, unique filter that cannot be handled by a simple reference qualifier, and is not used across multiple reference fields. Here Is Explanation of the code javascript: “sys_id IN” + new getgroupusers().getUser(current.u_assignment_group) 1.new getgroupusers().getUser(current.u_assignment_group) Calls the Script Include you created (getgroupusers). Passes the value of u_assignment_group (a group sys_id) to the function. The Script Include returns a comma-separated list of user sys_ids. 2. “sys_id IN” + This constructs a valid encoded query. Another way for doing Advanced reference qualifier is script include Step 1:-Application Navigator>Script Include> Create New. Step 2:- New<Name (getgroupusers)<Glide AJAX enabledScript Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo. Here Is The Code :- var getgroupusers = Class.create(); getgroupusers.prototype = Object.extendsObject(AbstractAjaxProcessor, { Ā  Ā  getUser: function(id) { Ā  Ā  Ā  Ā  var gr = new GlideRecord(“sys_user_grmember”); Ā  Ā  Ā  Ā  gr.addQuery(“group”, id); Ā  Ā  Ā  Ā  gr.query(); Ā  Ā  Ā  Ā  var arr = []; Ā  Ā  Ā  Ā  while (gr.next()) { Ā  Ā  Ā  Ā  Ā  Ā  arr.push(gr.getValue(“user”).toString()) Ā  Ā  Ā  Ā  } Ā  Ā  Ā  Ā  return arr.join(‘,’); Ā  Ā  }, Ā  Ā  type: ‘getgroupusers’ }); Ā  Here Is the code Explanation in Detail :- Ā Script Include named getgroupusers that extends AbstractAjaxProcessor, meaning it can be called from a client script (AJAX call). Function: getUser(id) This function returns a comma-separated list of user sys_ids belonging to a given group sys_id. Ā Step-by-step breakdown var getgroupusers = Class.create();getgroupusers.prototype = Object.extendsObject(AbstractAjaxProcessor, { Defines a Script Include. Inherits from AbstractAjaxProcessor → allows server-side methods to be called from client-side. 1. Query the sys_user_grmember table var gr = new GlideRecord(“sys_user_grmember”);gr.addQuery(“group”, id);gr.query(); Looks at the User Group Member Filters where group equals the passed id. Runs the query. 2. Build array of user sys_ids var arr = [];Ā while (gr.next()) {Ā Ā Ā  arr.push(gr.getValue(“user”).toString());} Loops over each record. Pushes the user field value (sys_id) into an array. 3. Return a comma-separated string return arr.join(‘,’); Ā  Here is the OutputĀ  :- Here, we get the group members in the Assigned To field from the group that we selected in the Assignment Group. This dynamic behavior ensures that the Assigned To field is populated only with valid group members, reducing manual errors and ensuring that work items are always assigned to users who actually belong to the selected group.

DictionaryĀ OverrideĀ Ā 

Dictionary Override Dictionary Override will come into a picture when we have a parent-child relationship between tables. By default, all fields and their attributes are inherited from parent table to child tables. Suppose you want to make a difference in one of the child tables for inherited fields then we will go for Dictionary override.Ā Ā  We can override followingĀ propertiesĀ Ā Ā Ā  Override ReferenceĀ Qualifiers:Ā AĀ Reference Qualifier in Dictionary OverrideĀ allows you toĀ change or customize the filtering conditionĀ of a reference fieldĀ only for a specific child table, without affecting the original parent table field.Ā  OverrideĀ Dependent:-Makes the field dependent on some other field, onlyĀ inĀ the child table.Ā  Override DefaultĀ Value:Ā Changes theĀ default valueĀ of the field for the child table.Ā Ā  Override ReadĀ Only: –Ā Make the fieldĀ read-onlyĀ for this child table only.Ā  OverrideĀ Calculations: –Ā Overrides theĀ calculation formulaĀ used by calculated fields.Ā  OverrideĀ Mandatory: –Ā Makes the fieldĀ mandatoryĀ orĀ not mandatoryĀ only for this child table.Ā  OverrideĀ Attributes:Ā Allows you to overrideĀ field attributesĀ only for the child table.Ā  Override DisplayĀ Values: –Ā Allows overriding how the field’sĀ display valueĀ is shown for this table.Ā  Making Dictionary OverrideĀ  Search Tables in Navigation Bar to Make TablesĀ & Click on New.Ā  After Clicking New Page will appearĀ inĀ that Add TableĀ NameĀ Ć Ā New Menu NameĀ Ā  for Making Child Table WeĀ HaveĀ Click on Extensible.Ā Ć Ā ControlsĀ Ć Ā Extensible Click on Box &Ā SubmitĀ it,Ā Your Table willĀ be madeĀ which is Parent Table.Ā  Now go to table for Making Child Tables in that Add Table Name, In Extends Table Give Name of parent Table to Make this table a child table &Ā submitĀ it.Ā  SearchĀ tables forĀ Parent & Child TablesĀ in NavigationĀ Bar,Ā PerformĀ Dictionary Override.Ā  UsersĀ mustĀ Make FieldĀ fromĀ Form LayoutĀ in Parent Table & That field will automatically Inherit to ChildĀ tables.Ā  Child Table All Fields Inherit from Parent Table.Ā  Now Add RecordsĀ inĀ Parent TablesĀ  Note:Ā If UserĀ addsĀ RecordsĀ toĀ ParentĀ Table,Ā then that record willĀ not beĀ visible in Child Tables. But when we insert records in Child tablesĀ then child table records willĀ visibleĀ Parent tables.Ā  If weĀ have toĀ do Perform operation on Parent table fieldĀ Ā  Go to Parent table fieldsĀ Ć Ā Configure DictionaryĀ Ć Ā In RightĀ side,Ā theirĀ optionĀ for doing Read only, Mandatory, Display.Ā  If weĀ haveĀ toĀ PerformĀ operation on child table fieldĀ Ā  Go to child table fieldsĀ Ć Ā Configure DictionaryĀ Ć Ā Dictionary override->Ā New->Ā There willĀ be allĀ operations.Ā  BaseĀ Table: –Ā is the parent tableĀ  Table: –Ā The tableĀ whereĀ we canĀ changeĀ overrideĀ property.Ā  These are the above properties byĀ using,Ā weĀ can performĀ dictionary override.Ā  Ex: –Ā IfĀ UserĀ wantsĀ to do Override the name field by Read-only thenĀ userĀ can do withĀ the belowĀ steps.Ā  Go to child Table->Right click on Name->Configure Dictionary->Ā  Click On Dictionary Override-> Click on New.Ā  Click on -> Override Read Only->Ā Sumit the Record.Ā Ā  AfterĀ submittingĀ the record checkĀ in theĀ childĀ table. If filed get read-only or not.Ā  And here the field is read only.Ā  Note:Ā When we Apply Override in ChildĀ table,Ā itĀ does notĀ Apply to Parent table. Summary:Ā Ā  Dictionary Override in ServiceNow is used when you have a parent–child table relationship and want a child table to behave differently from the parent. Normally, all fields and their properties are inherited from the parent table, but with a dictionary override you can change things like default values, read‑only settings, mandatory status, reference qualifiers, calculations, attributes, and display values only for the child table. To use it, you first create a parent table (by making it extensible) and then create a child table that extends it. Any field added to the parent automatically appears in the child, but records added in the parent do not show in the child, while child records appear in the parent. To override a field, open the child table, right‑click the inherited field, go to Configure Dictionary, and create a new Dictionary Override where you select the property you want to change. The override affects only theĀ child’sĀ table and never the parent.Ā 

Service-now Interview Questions

Service-Now Interview Questions Question & Answers What is difference between UI Policy and Client Script Client Script will execute first than UI Policy. UI Policy has condition but Client script does not (we need to write manually through code) UI Policy has condition where we can access the fields which are not on the form but client script does not, Client script can access only the fields which are on the form. What is import set table? Import set table is a temporary table where we will put the data for temporary purpose and later we can move the import set data to target table using transform map. Whenever we are pulling the data from external source, it is a standard process to get data into import set first and then validate the data using transform scripts and then transform the data into target table. Import set table always extends import set row table. By default import set table fields are of string type. Import set table can be used to debug the integration where we are pulling the data from external source. Update Set? Update set is used to capture the customization i.e. development in servicenow. Update set will capture the versions of every development components. Only the table data, which has update_synch attribute =true, get captured into update set. Only completed update set can be moved to another instance. We should not change the update set state from completed to in progress as per standard practice. Display business Rule? Display business rule will run when the data is getting populated on the form from server. Here we can use g_scratchpad global variable to send the service side information to client side script. For display business rule, we don’t have option like update, insert, query and delete in business rule form. Client Script will execute first than UI Policy. UI Policy has condition but Client script does not (we need to write manually through code) UI Policy has condition where we can access the fields which are not on the form but client script does not, Client script can access only the fields which are on the form. Import set table is a temporary table where we will put the data for temporary purpose and later we can move the import set data to target table using transform map. Whenever we are pulling the data from external source, it is a standard process to get data into import set first and then validate the data using transform scripts and then transform the data into target table. Import set table always extends import set row table. By default import set table fields are of string type. Import set table can be used to debug the integration where we are pulling the data from external source. Update set is used to capture the customization i.e. development in servicenow. Update set will capture the versions of every development components. Only the table data, which has update_synch attribute =true, get captured into update set. Only completed update set can be moved to another instance. We should not change the update set state from completed to in progress as per standard practice. Display business rule will run when the data is getting populated on the form from server. Here we can use g_scratchpad global variable to send the service side information to client side script. For display business rule, we don’t have option like update, insert, query and delete in business rule form.

ITSM

ITSM Question & Answers Processes in Service Operations Incident Management Problem Management Change Management Incident Management Any interruption in service is raised as an Incident Purpose is to restore normal service operations Purpose is to minimise the effect by workaround if restore is not possible Impact and Urgency are defining the Priority Challenges Detect an incident as soon as possible Incident workaround or resolution should get documented Incident assignment for L1, L2 and L3 support Correct assignment of priority in automated generated incidents Example: Not able to login in system Not able to swipe the swipe card Not able to send an emails Problem Management: Two or more incidents will raise problem Problem is to find out permanent solution for incidents through change. Reactive and Proactive Problems Known Error Workaround Examples: If we got more than one incidents like 10 users incidents that they are not able to login into system, it means something wrong with system. If we got more than one incidents for swipe card, it means the swipe machine has an issue rather than the swipe card, so we will raise one Problem for all the incidents and instead of working 10 engineers on incident will assign one engineer on Problem to fix all the incidents. Change Types Change is to enable beneficial changes to be made with minimum disruption to existing services. Definition: Change is ā€œthe addition, modification or removal of anything that could have an effect on IT servicesā€. Normal Change – go through routine change go through all the process Any service change that is not a standard change or emergency change. Standard Change – Ā pre-approved change— relatively low risk A pre-authorized change that is low risk, relatively common and follows a procedure or work instruction. Emergency Change – Ā must be deployed as soon as possible within 24 hours like system go down, serious defect. IT should have different group of approval(CAB=Change Advisory board) A change that must be implemented as soon as possible, for example to resolve a major incident or implement a security patch. Incident Management Problem Management Change Management Any interruption in service is raised as an Incident Purpose is to restore normal service operations Purpose is to minimise the effect by workaround if restore is not possible Impact and Urgency are defining the Priority Challenges Detect an incident as soon as possible Incident workaround or resolution should get documented Incident assignment for L1, L2 and L3 support Correct assignment of priority in automated generated incidents Example: Not able to login in system Not able to swipe the swipe card Not able to send an emails Two or more incidents will raise problem Problem is to find out permanent solution for incidents through change. Reactive and Proactive Problems Known Error Workaround Examples: If we got more than one incidents like 10 users incidents that they are not able to login into system, it means something wrong with system. If we got more than one incidents for swipe card, it means the swipe machine has an issue rather than the swipe card, so we will raise one Problem for all the incidents and instead of working 10 engineers on incident will assign one engineer on Problem to fix all the incidents. Change is to enable beneficial changes to be made with minimum disruption to existing services. Definition: Change is ā€œthe addition, modification or removal of anything that could have an effect on IT servicesā€. Normal Change – go through routine change go through all the process Any service change that is not a standard change or emergency change. Standard Change – Ā pre-approved change— relatively low risk A pre-authorized change that is low risk, relatively common and follows a procedure or work instruction. Emergency Change – Ā must be deployed as soon as possible within 24 hours like system go down, serious defect. IT should have different group of approval(CAB=Change Advisory board) A change that must be implemented as soon as possible, for example to resolve a major incident or implement a security patch.

Getting Started with Power BI – A Complete Beginner’s Guide

šŸ·ļø Keywords: power bi tutorial, business intelligence course, power bi for beginners šŸ“ Intro: Power BI is Microsoft’s leading business intelligence tool used to visualize and analyze data.This guide helps you understand its basics and how to create your first dashboard. šŸ”¹ Key Points: šŸ”š Conclusion: Power BI empowers professionals to turn data into decisions. Learn it step-by-step to boost your analytics career.