User Tools

Site Tools


ss

This is SS


Scheduled Reports

- You can use a “Scheduled Report” to email a file of arbitrary data records whenever you want. The file type supported are:

CSV
Excel
PDF

- Documentation Link - Scheduled Reports - San Diego

- Data Table

  1. This is the source of our data. It can be any table whatsoever.
  2. Example NewUserStagingTable

- Report Definition

  1. Table sys_report
  2. Example New User Data report
  3. Click Edit Report to make changes to the report or to Run the report.
  4. Use the LIST type of report if you just want to send out a list of records, and perform no aggregation on them.

- Scheduled Email of Reports - May be scheduled to run every day, every hour, etc. - Table sysauto_report - Example Scheduled Report of New User Data

  1. Click the “Execute Now” button to test.

- Email table

  1. The actual email generated may be seen in this table. Type “emails” into filter navigator.
  2. The record contains the actual attachment.
  3. Use the Preview button to see the full HTML of the email.
  4. Table sys_email
  5. Example Email: New User Data from ServiceNow

Scheduled Script Executions - Scheduled Scripts - Scheduled Jobs

- Takeaway - A Scheduled Script Execution (Scheduled Job) is a server-side script that executes periodically, for example every day, week, or month. Can be used to do things such as find overdue records, change record states, and assign records. The System Scheduler - Scheduled Jobs module can be used to see what Script Executions are scheduled to run. Scheduled Script Execution (On Demand) is also an excellent place to write, edit, and debug server side scripts. - Modules

Tables
	sysauto_script
	sys_trigger_list

System Definition - Scheduled Jobs - “Automatically run a script of your choosing”

System Scheduler - Scheduled Jobs - Today's Scheduled Jobs

System Logs - System Log - Application Logs - A Scheduled Script Execution is a server-side script that executes periodically:

  1. Daily
  2. Weekly
  3. Monthly
  4. Periodically (NOT Annually)
  5. Once
  6. On Demand

- Never triggered in response to an action taken by a user. - Never triggered by a database action such as a record update. - Not associated with records and have no access to the Previous or Current objects used by many other server-side script types. - Executes on Server Time, not on local user time.

  1. Use System Diagnostics - Stats to see the server time.

- Use Cases

Periodically Query a Database Table:
	- Find records with overdue Due dates.
	- Find records with Due dates in the near future.
	- Look for records that have been in a certain state, such as resolved, for too long.
Update Records
	- Set the State field to Closed Complete after a fixed time has elapsed.
	- Assign unassigned records to a user.
Testing
	- Test server-side script logic by executing the script on demand.

- Condition - If the “Conditional” checkbox is checked, you may write an additional script to set the “answer” variable to true or false, to determine if the actual Scheduled Script will execute or not. - Used to lower then level of nesting (indentation) in the main part of the script. - You end the script with “something that resolves to true or false; for example: “answer;” - For Debugging - This is an excellent place to write, save, edit, and debug server-side scripts, provided you have imported the custom UI Action “Debug Now”. - Gives you Code Completion and syntax highlighting. - Table is sysauto_script - Use the custom UI Action “Debug Now” in order to run your script on the fly instead of asynchronously. This allows you to set breakpoints. - This method also allows you to save your script and return at a later time to work on it. Don't forget to save though before you run! - “Run this Script”

  1. The name of the main part of the script.

- Note: Variables declared in the Conditional script are available to the “Run this Script” script. - Execute Now

  1. This button becomes available after a Scheduled Script is saved.
  2. It allows a developer to test a script without waiting for the scripts usual scheduled time to roll around.
  3. The Condition script must still evaluate to true in order for the “Run this Script” script to execute.
  4. Clicking this button puts the Scheduled Script on the schedule to be run asynchronously as soon as possible.

- Scheduler - To see what is on the schedule for today, use System Scheduler - Scheduled Jobs - Today's Scheduled Jobs - To see everything on the schedule, use System Scheduler - Scheduled Jobs - Scheduled Jobs - The “Job ID” column indicates how the job got onto the schedule; for example, did it come from the Flow Designer, from PA, or from a script. - On Demand jobs do not have a Job ID. - Quirk: To run a Scheduled Script on the last day of every month, create a monthly execution set to run on day 31. It will automatically run on the last day of the month, even for months with fewer than 31 days.

Scope - Application Scope - Scoped Apps - Scoped Applications

Takeaway Scope refers to what objects (or artifacts) may be seen or interacted with. This includes Access Controls, Business Rules, Script Includes, Tables, and Client Scripts. If an object is “in scope” it may be accessed. Scope is implemented through the use of a Namespace, a globally unique identifier prefix which is applied to every file of a Scoped Application. The namespace identifier is generated automatically by ServiceNow when an application is created in Studio, and it includes the company code and the first 12 characters of the name of the application. Scope is used to protect applications from conflicting with each other, and may also be used to limit cross-application access. The term “Scope” is nearly synonymous with “Application”. An application may permit access by objects in other application scopes; this is done at the Table level, so one Table may permit access while another does not. By default, other applications are given Read Only access. The “Application Picker” may be added to the banner of the Platform UI, allowing you to see what Scope you are working in. There is a “Global” scope which is used for Apps created before the Scope concept was introduced to ServiceNow. Application Scope - Modules Application - “Runtime Access Tracking settings” System Applications - Application Cross-Scope Access - Scope is a globally unique identifier prefix (or namespace) which is applied to every file of a Scoped Application. - Scope uniquely identifies an application and its components and files. Using Scope prevents naming conflicts between files from different applications. - Scope may also be used to restrict, or grant, access to application files by other applications. - Scope determines which parts of an application are available to (be acted on by) other applications. - The scope identifier is generated automatically by ServiceNow when an application is created in Studio, as follows:

x_ + <glide.appcreator.company.code system property> + _ + First Twelve Characters of App Name.
x_CompanyCode_First12OfAppName

- The baseline ServiceNow applications are in the Global scope. - Application Picker - In Personal Settings, you can add an Application Picker control to the main banner, via Settings - Developer - Show Application Picker in Header. - Use Application Settings to determine whether an application can access resources from another application. - Application Access Set at the table level. Does NOT apply to scripts executed in the Global scope. Allows a developer to: Grant read, create, update, or delete privileges to Server Side Scripts in other Application Scopes. Grant or deny table access via web services The “Allow Configuration” setting permits other application scopes to Create the following application File types:

  1. Dictionary Entries
    1. New Fields
  2. Business Rules
  3. Client Scripts
  4. UI Actions

- If a script attempts to perform an operation that is not allowed, admin users see a message. - A script operation may be denied access, but may continue to run. It does not necessarily throw an exception when access is denied. - Cross-Scope Tables

  1. ?

- Cross-Scope Scripts - Application “Runtime Access Tracking settings” allow you to control what level of authorization your own application requires, such that its scripts may access resources from other applications. Options are: - None - No authorization is required for application scripts to access resources from other applications as long as the other application allows it. - Tracking - Allows app scripts to access resources from other applications. A record for the access is automatically inserted in the Application Cross-Scope Access table with a Status value of Allowed. - Enforcing - Allows scripts to access resources from other applications only after an admin authorizes the access. A record for the access is automatically inserted in the Application Cross-Scope Access table (sys_scope_privilege) with a Status value of Requested. An admin must manually open the PREVIEW (i) for this record, and change the Status from “Requested” to “Allowed”. Often used as a Testing Tool. It allows a developer/admin to see what applications are trying to access other applications. If a developer uses the Enforcing setting he should document this fact, so that admins are not frustrated by it. - When creating a new Table in a Scoped Application, “cross-scope-access” (read access) is turned ON by default. - Believe that scripts which are executed in the global scope can access any resources from scoped applications. - The server side log message type (gs.log) is not supported in scoped applications: - The “Allow Configuration” setting permits other application scopes to create the following application file types: Dictionary Entries (New Fields), Business Rules, Client Scripts, UI Actions. (But not new tables.) - If a script attempts to perform an operation that is not allowed, admin users see a message. (Believe this is an info message at the top of a form.) - Application Runtime Access Tracking Settings Include the following: None, Tracking, and Enforcing - By default, when you create a brand new table, the following are allowed:

Accessible from "All application scopes"!
Can read
Allow access to this table via web services.

- What is NOT allowed are:

  1. Create, Update, Delete
  2. Configuration

Scratchpad

https://docs.servicenow.com/bundle/rome-application-development/page/script/business-rules/concept/c_ScriptingWithDisplayBusinessRules.html - The scratchpad may be populated ONLY be a Display type of business rule on the server, and not any other kind of server-side business rule. - The scratchpad is accessed on both the server, and the client, using the g_scratchpad object:

Server
	g_scratchpad.MyVariable = "XYZ";
Client
	g_form.setValue("description", g_scratchpad.MyVariable); //

Script - Scripts - Scripting - Platform Scripting

- Takeaway - ServiceNow uses standard JavaScript (ECMAScript5) to extend / customize application functionality. There are 3 main script APIs, Client-Side, Server-Side, and REST. Script may be used to do almost anything in the system, including displaying messages, triggering events, launching workflows, querying tables, querying web services, validating data, and writing to log files. - See Also

Client Side Script
Server Side Script
	Business Rules
	Script Includes

- ServiceNow uses standard JavaScript to extend / customize application functionality. - You can use script to extend your instance beyond a standard configurations to automate processes, add functionality, integrate with outside applications, etc. - The flavor of script used by ServiceNow is JavaScript / ECMAScript 5 / ES5 which was introduced in 2009. - It is considered good practice to use Condition Builders wherever possible, rather than script, because this is easier to debug after ServiceNow upgrades. - Reminder: Script is very error-prone. Typing “addInfoMessage” instead of “addInfoMessage” can cause your entire script to simply abort, with no error messages, and without producing the expected behavior. Suggest to make changes ONE line at a time, and test each new line.
- Application Programming Interfaces (APIs) - There are 3 Application Programming Interface (API) categories:

	1) Client-Side
		- GlideAjax
		- GlideForm
		- GlideRecord		(client side version) (works on Platform UI only; does NOT work in Service Portal)
		- GlideUser
		- JSON			(client side version)
		- spModal		(portal only?)
	2) Server-Side
		- GlideAggregate
		- GlideDateTime
		- GlideElement
		- GlideRecord		(server version, global)
		- GlideRecord		(server version, scoped)
		- GlideSystem
		- JSON			(server version)
		- Workflow
	3) REST

- Visit the ServiceNow Developer Portal to find the complete API reference. The API reference documents the classes, methods, and non-method properties comprising the API. - Good Practice: Refer to the API documentation early and often when building apps on the Now platform. - Errors - If you mistype an object name, what will often happen is the following:

	1) At runtime, a warning will be sent to the event log from the "Evaluator".  It will show the offending line of code.
	2) The code will NOT be executed.  Thus, no exceptions will be generated.

–The “Evaluator” will only pick up on certain types of errors. For example:

	MyObjectNameMisspelled 			this will be detected as undefined.

MyObjectName.MyPropertyNameMisspelled this will not be detected, as it may be valid code, but the value will be undefined. - Hidden Features - In a script editor, you can (sometimes) right click an identifier to show the API documentation in a popup dialog. - To automatically re-indent script (fix indentation) highlight the script, and press Shift Tab. - Important! Hidden Feature: You can often enter Ctrl + Spacebar in order to see all of the objects available to you in a script. This is tremendously useful, and I'm not sure how you would know if you can do this unless you just “knew” about the keyboard shortcut. - Inline Scripting Video: Learn JavaScript on the Now Platform Inline Scripts

  1. Used to enable simple data conversion or transformation without having to create a custom action or flow.

- Syntax Editor

  1. The ServiceNow built-in text editor.
  2. Ctrl + Spacebar to pull up known objects.
  3. Find References speed menu command is specific to this editor. You right click on anything in black.
  4. Important! You can right click a known table name and do Find References. This is extremely important for finding example code!

- Syntax Editor Macros *

  1. Tables

syntax_editor_macros

  1. Import File:

syntax_editor_macros.xml

  1. These are snippets / excerpts / chunks / selections / extracts of code which may be inserted into any code editor with a keyboard shortcut.
  2. These do NOT function in Scripts Background.
  3. System Definition - Syntax Editor Macros.

- Hidden Feature: To make use of Macros in a script editor, type one of the following keywords, and hit the Tab key:

  1. help - To see all the macros which are available.
  2. doc
  3. for
  4. info
  5. method
  6. vargr - A common pattern of creating and querying a GlideRecord
  7. vargror - Example GlideRecord Or Query

- Throw - Throwing a custom exception from script. - You can use the JavaScript throw keyword to throw a custom exception. - Example

throw "GGB.  This is a test exception.";

- This will show up in the System Log with a log level of Error. You can see this under System Log - All or System Log - Errors - The Source will be com.glide.ui.ServletErrorListener - The Message will include a block of source code including the line of the throw itself. This can be confusing. - The Message will start with “JavaScript evaluation error on:” - Important: The actual message thrown will show up in the line starting with a colon, as follows: : org.mozilla.javascript.JavaScriptException: The Actual Message that I threw - Use Cases - Display alerts, messages, or confirmations - Launch jobs - Launch workflows - Query tables - Query web services - Trigger events - Validate data - Write to log files - zMisc - System Definition - Scripts - Background

  1. May be used to run a script (run an arbitrary script) at any time!
  2. Has no Syntax Highlighting.

- Debugger not directly available. But you CAN call a Script Include with breakpoints set, and they will be triggered; just remember that you need to lunch the Script Debugger first, either from that Platform UI, or from Studio. - System Definition - Client Scripts

  1. Allows you to attach a Client Side Script that will be activated for any form attached to a particular table.

- Example Scripts

	https://github.com/chucktomasi/sn-learn-javascript  //

Script Includes

Important!

  1. Discussion of the use of the “Client callable” checkbox!!!

- Takeaway - A Script Include is a unit of reusable server-side script logic that defines a Function or Class, or extends an existing class. A Script Include is called by another script and may be used by multiple applications. The GlideAjax class may be extended to allow client-side code to invoke script on the server. Many applications use a single Script Include named <AppName>Utils to store the majority of the server-side logic. - Modules

System Definition - Script Includes

- Tables

sys_script_include

- A Script Include is a unit of reusable server-side script logic that defines a Function or Class. - Must be explicitly called by other scripts. - May be used by multiple Applications. - Script Include logic may be defined in three different ways:

1) On Demand / Classless.
2)  Extending existing Class such as GlideAjax.
3)  Defining a brand new Class.

- The API name is used to call the Script Include from an out-of-scope application. - GlideAjax - Can be used to allow client-side scripts to call a server side Script Include. - Often extended with custom methods, so that client-side script can interact with server-side objects. - The client-side script passes parameters to the Script Include. The Script Include returns data as XML or a JSON object. - Important: Although not required, many applications have one or more Script Includes to store the majority of the application's server-side logic. If there is a single Script Include for an application, it is often named <App Name>Utils. For example, NeedItUtils. - Protected Status

  1. If a script is set to a protection policy of “Read Only”, it may, obviously, not be modified by those who install the application.
  2. If a script is set to “Protected” it may not be viewed at all.
  3. If it has no protection policy or is set to “write”, it may be modified. ===== Searching for Text - Text Search ===== - See the following: Application File Table Global Search ===== Self-Service / Employee Self Service (ESS) ===== - A Platform UI Application which includes many modules such as: Homepage Dashboards Incidents Knowledge Service Catalog Visual Task Boards

Server-Side API Classes / Server Side API Objects / Server Side Classes / Server Side Objects

- GlideRecord - The way to interact with the ServiceNow database from a script (instead of writing SQL queries). - An object containing 0 or more records from the same table (an ordered list). - General Approach 1) Create a GlideRecord object for the table of interest.

	2)  Build the query conditions.

3) Execute the query.

	4)  Apply script logic to the records returned in the GlideRecord object.

- One trick for placing queries into script is to use the GUI to construct a filter, right click the last item in the breadcrumbs for the filter, and then use the “Copy query” command. This string can then be fed to the “addEncodedQuery()” method of a GlideRecord object. - Use addQuery() for each And condition you wish to add. - Use addOrCondition() to add Or conditions. - update() is used to save changes to the records in the GlideRecord. If a record did not exist before, it is inserted. - getRowCount() - Not a recommended method. - addAggregate - GlideRecordSecure

  1. Performs the same functions as GlideRecord AND enforces Access Controls.

- GlideDateTime - - When working with the GlideDateTime methods, pay attention to the date format and time zones. Some methods use GMT/UTC and some use local time zones. Some methods use the date in milliseconds and some do not. - There are also useful methods for managing dates in the GlideSystem API, for example, gs.daysAgo(). - You can create a GlideDateTime object from a GlideDate object by passing in the GlideDate object as a parameter to the GlideDateTime constructor. ===== Server-Side Script - Server Side Script ===== https://[YourInstanceName].service-now.com/nav_to.do?uri=sysauto_script.do?sys_id=8db51d3c1b9d7c109b1376ae034bcb15__zGGB_ServerSideDebugMessages https://[YourInstanceName].service-now.com/nav_to.do?uri=sysauto_script.do?sys_id=e41a03cddbd134500f9ce4e1ca96198c__zGGB_GlideRecordDatabaseAccess - Modules System Definition - Scripts - The two types of Server-Side scripts are: Business Rules Script Includes - Capabilities of Server Side Scripts: - Determine if a user has a particular role. - Set fields when a database query runs. - Set field values on a related record when a record is saved. - Generate, or respond to, an event. - Log a message. - Send an email. - Execute an API call to another system. - Send a REST message and receive a result. - Manage a failed login attempt. - A script object can have, as properties, all of the fields from the TABLE that it is based on. For example, ”.number“. - To run a one-time script, you can use System Definition - Scripts - Background.

Service Catalog - Request - Request Management

- Takeaway - The Service Catalog is a robust ordering system which allows a user to request products and services offered by the various departments of an organization. A Request (REQ) record is analogous to an Order; it contains one or more desired Request Items (RITMs). Each Item may have its own fulfillment process which may involve the creation of one or more Service Catalog Tasks (SCTASKs) which track what needs to be done to deliver the Item to the requester. - Modules - Service Catalog - Catalog Definitions - Maintain Items - Record Producers - Maintain Categories - Service Catalog - Catalog Variables - Variable Sets - Self-Service - My Requests - Flow Designer - Designer - New - Flow - Roles catalog_admin - Tables sc_request sc_req_item sc_task - Note, there is no Developer training on the Service Catalog (as of 11/04/2020), I guess because configuring catalog items is not considered Development. - Catalog-Specific Logic - Catalog Client Script

  1. Used to manage the user interface and user experience.
  2. Used to validate data.
  3. Maybe be used to make variables Mandatory, Read Only, or Visible, with script.
  4. May be used to Get or Set variable values.

- Catalog UI Policy (and Catalog UI Policy Actions) - A set of conditions against one or more variables which, upon collectively evaluating to True, triggers 1) a corresponding set of Catalog UI Policy Actions, and optionally 2) an arbitrary Script - Upon evaluating to True, executes a set of Catalog UI Policy Actions.

  1. Catalog UI Policy Actions
    1. Set form fields to Read Only, Mandatory, or Visible, without the need to write any script.

- Optionally, reverse the Read Only, Mandatory, or Visible status if the “Reverse if false” flag is set at the Catalog UI Policy level.

  1. May also be setup to Reverse the Catalog UI Policy Actions, and run a second script, when the conditions evaluate to False.
  2. Arbitrary script may be executed, by selecting the Advanced view link (or Script tab).
  3. Applies to either a specific Catalog Item, or to any item that uses a specific Variable Set.
  4. May optionally be designated to run on form Load, as well as when a variable value changes.

- Categories - Catalogs are broken up into Categories and one or more Subcategories that users may navigate to, to find the items they want. - Any Category may be assigned a Parent category, which effectively turns it into a Subcategory. - You can add a category to the Service Catalog Home page by navigating to the Service Catalog and then using the + icon at the very top right, to the right of the Search Catalog box. - Flows - Flows run behind the scenes of the Service Catalog. - Flows communicate the stages of the approval process to the requester, and drive the request fulfillment. - Example: - Flow Designer - Designer - New - Flow - Trigger : Service Catalog - Action : ServiceNow Core - Default - Update Record

  1. Record : Trigger Requested Item Record
    1. Add Field Value : State - Pending

- Action : ServiceNow Core - Service Catalog - Create Catalog Task

  1. Record : Previous Action's Requested Item Record
    1. Fields : Assignment Group - Service Desk
      1. State : Open
  2. Wait Checkbox - When checked, pauses the flow until this entire task is completed (marked Closed Complete).

- Action : ServiceNow Core - Default - Send Email

Trigger - Service Catalog - Requested Item - -> Request -> Requested For -> User -> Email.

- Action : ServiceNow Core - Default - Update Record

  1. Record : Trigger Requested Item Record
    1. Add Field Value : State - Closed Complete

- Action : ServiceNow Core - Default - Update Record

  1. Record : Trigger Requested Item Record → Request Record
    1. Add Field Value : Request State - Closed Complete

- Forms - Often the Service Portal catalog forms are simplified versions of the full forms available in the Platform UI. - Item

Create or edit a catalog item 

- Catalog Items can be shared by multiple catalogs. - A Catalog Item might be a new laptop, a chair, or a password reset request. - Catalog items may be hidden from groups of users based on “User Criteria”, including User, Group, Role, Company, Location, and Department. - Within a Catalog Item, the Available For and Not Available For related lists are used to configure User Criteria.

  1. Note, these Related Lists are not on the form by default! They must be added, by configuring the form.

- Catalog items may also bet set to show up via the Desktop UIs, the Mobile UI, or both. - When creating a new catalog item, you can specify many variables, data types, etc., that the user will populate when he orders the item. - Each Request Item may flow through a different fulfillment process. - Order Guide - An Order Guide presents multiple catalog items grouped together logically as one request. Questions can be used to present item options and present users with only relevant choices at the appropriate time in the ordering process. - Outcomes - There are 2 possible outcomes when an item is ordered from the Service Catalog; 1) Service Catalog Request Items (RITMs) are generated, or 2) a Record is inserted into a System Table such as the Incident table. - Service Catalog Roles: - Administrators can manage all aspects of the Service Catalog. - Catalog Administrators can do all those functions except writing Scripts. - Catalog Manager can edit and update a Service Catalog, including categories and items, and can reassign a Catalog Manager. - Catalog Editors can edit and update a Service Catalog, including categories and items. - Request - Acts like a Container or Order or Shopping Cart. There is only one, no matter how many items are requested. - Has record prefix REQ. - A Request is made up of Request Items (RITMs). - A “Cart” and “Wish List” may be available for Requests. - After a request has been entered, the requestor can easily track it by going to Self-Service - My Requests. - Sections

  1. Defined with “Container Start” and “Container End” variable types.

- Service Catalog - A robust ordering system (with a simple e-commerce type user interface) for users to request Services and Products offered by various departments in the organization. - Service Catalog is functional capability more than a UI. Customers order things. When they submit the form it triggers a workflow. The workflow may contain approvals, tasks, etc. If the capabilities of the Service Catalog meet your business requirements, then that is the way you go. Service Catalog is fast to implement and generally easy to support. You can access the Service Catalog via the Platform UI or the Service Portal UI. These days most people use the Service Portal because it looks nicer. - May be ordered by Employees, Customers, and Suppliers??? - There can be more than one Service Catalog, and a Service Catalog can contain almost anything (any Product or Service). - Often Requests for Service Catalog products and services originate from the Search Dialog. - When a user places an order through the Catalog, a Request, a Request Item, and catalog Tasks are all created. - Hidden Feature: When you click a “Data Pill” icon, to select a field from an available record in context, you can then use the right arrow to “dot walk” to additional tables and fields; you can do this over and over again. - Forms should be used, rather than the Service Catalog, if users will need access to Context Menus, Editing capabilities, or the ability to Personalize the User Interface. - Service Portal Access to the Service Catalog

  1. There is a Catalog Item widget, and an Order Item Widget, which, together, are used to surface Catalog Items to the Portal.
  2. Hidden Feature: Right clicking blank areas of a Service Portal Widget should bring up many configuration items.

- Record Producer / Service Request - A simplified version of the full Service Request Form. Results in a record in a system table such as the Incident table. - Can include Graphics, arbitrary HTML (?), and Help; unlike regular forms (?). - Easy to create, since the Variables are selected from the existing fields in the target table. - Script may be written to access the record producer variables (and perhaps edit them) before the record is written to the database. Do Not call current.update.

  1. producer.FieldName is use to access the fields the user entered.
  2. current.FieldName is used to write to fields which will be written to the database.

- You specify any URL as the target page for after the Record Producer completes. - Task - The SCTASKs track what to do, the assignment group, the assigned to user, the task state, and work notes. - Each Flow or Workflow may involve several “Catalog Tasks” which need to be performed. - Variables / Questions

Types of Service Catalog Variables 
- After saving a new catalog item, the Variables list appears.
- The Order field determines the relative order that the variables appear on the Catalog Item page.

- Variables for Tasks Only - If you want a Service Catalog Variable to be available for use on Catalog Tasks, but you do not want it to show up at the time the user is ordering the Catalog Item, you can create a regular old variable (do NOT set the variable to hidden), and then you can use a Catalog UI Policy and Catalog UI Policy Action to set the variable to Visible == False. But in the “When to Apply” section, you need to check the checkboxes that say “Applies on Catalog Item View” and “Applies on Requested Items”. Leave the checkbox that says “Applies on Catalog Tasks” UNchecked, obviously. - If you want a Workflow IF Condition to be able to make use of a catalog item variable, in the Conditions section set the field choice to “Variables”, then select the Catalog item itself, then the name of the variable. Example:

- For some reason it seems like you cannot use the “Set Values” Workflow Activity to set a Catalog Item Variable. But you can easily use the “Run Script” Action instead, as follows: current.variables.myhiddencheckboxvariable = true; current.variables.mycheckboxvariable = true; current.variables.myselectboxvariable = “MyQuestionChoiceOne”; current.variables.mysinglelinetextvariable = “MyNewValue123”; - Variable Set - A collection of Variables (Questions) that can be reused across multiple catalog items and order guides. - It is a Container, so it only has two fields, Name and Description. - After you save the Variable Set, a Relates List will appear where you can add as many variables as you need. - Request Item Checkout Options - Platform UI Options - These catalog item options on the main part of the form seem to affect the Platform UI only, not the Service Portal. - Initial Buttons

		Quantity			"No quantity" to turn off.
		Order Now			"No order now" to turn off
		Add to Cart			"No cart" to turn off
		Note:  "No order" turns off ALL 3 of the above.

- Then, within the cart

		Proceed to Checkout		"No proceed checkout" to turn off.

- Selecting No Quantity and No Cart leaves you with Only the “Order Now” button, which is simple for the user. - Selecting “No Cart” removes the “Add to Cart” button, but does not remove the Delete Item / Edit Cart step from the ordering process :( - Portal Tab Options Request Method = Order gives the user the Order Confirmation dialog, which is a confusing additional step. Request Method = Request gives the user the Request Confirmation dialog, which is a confusing additional step. Request Method = Submit, with Hide Quantity and Hide Delivery Time are good options for a simple checkout procedure. - zMisc - In a typical workflow, such as for provisioning hardware, a user can order on behalf of another user and switch the Name field in the shopping cart. - A Module may be setup to point to a Service Catalog Item by setting the Link Type to “URL (from Arguments)” and setting the Arguments to “com.glideapp.servicecatalog_cat_item_view.do?v=1&sysparm_id=<Service Catalog Item sys_id> - Good Practices

  1. Use Service Catalog Record Producers instead of forms, for a friendly user interface.
  2. Restrict access to forms and lists with security, and instead use the Service Catalog as the primary user interface.
  3. Use clear and easily understood questions to prompt users for input.
  4. Use the smallest possible number of variables to make the interface lightweight.
  5. Craft carefully worded questions so your users give appropriate responses.
  6. Use Catalog UI Policies and Catalog Client Scripts to enhance the user experience.

- You can make a Lookup Select Box variable display data from Multiple field by specifying multiple fields in the “Lookup label field(s)” text box. Just list multiple values, separated by commas, such as: u_profile, u_description. Spaces are OK. Do not use semi-colons. - zSee also Record Producers Request Fulfillment !! (Fulfillment Process) ===== Service Catalog Request Fulfillment / Request Fulfillment (Process Engine) ===== - Takeaway - A Fulfillment process defines what happens when a user requests something from the catalog. Request Fulfillment is handled via an Execution Plan or a Workflow. An execution plan is a simple, linear process consisting of a set of tasks. Tasks include instructions to the task fulfiller, an assignment group, and an expected time of delivery. - Modules Service Catalog - Catalog Administration - Execution Plans - Roles catalog_admin - The Fulfillment process defines what happens when someone orders an item or requests a service from a catalog. - Request Fulfillment is handled via an Execution Plan or a Workflow - Execution Plan - An alternative to a workflow. It is a simple, linear process, consisting of a set of tasks. - Often you will copy and modify an existing execution plan, rather than building one from scratch. - An execution plan has a Name, a Short Description, a calendar (which specifies at what point during the week the execution plan's tasks will be worked), And a list of Tasks. - Tasks Examples: - Approve - Procure - Configure - Deliver - Tasks Properties: - Name - Short Description - Instructions to the task fulfiller - Order - Fulfillment Group - Delivery Plan - Delivery Time (expected) - SLA - Next Action (Upon Approval or Upon Reject) - See also - Workflows

Service Desk

Modules

Service Desk - My Work
Service Desk - My Groups Work

- An aggregate of several types of records such as Incidents, Problems, Changes, and Service Catalog tasks. - An Incident may be “promoted” to a problem. The original Incident appears in the Related List for the Problem. A Change Request may be created directly from a Problem record. - My Groups Work displays tasks from all the groups that you belong to. ===== Service Level Agreement (SLA ) ===== - An SLA is an agreement between a service provider and a customer that defines the scope, quality, and speed of the services being provided. - An SLA can track the amount of time that a task has been open, to ensure that tasks are completed within an allotted timeframe.

ServiceNow - Platform As a Service (PaaS )

- Takeaway - ServiceNow is a cloud-based application development and execution platform which includes multiple suites of pre-built applications. It helps an organization automate the flow of work throughout the enterprise, standardize service delivery, and provide intuitive user experiences. It includes features for workflow automation, data capture and editing, data import and export, reporting, knowledge management, and integration, to name a few. ServiceNow has subscription-based licensing, and is designed to be easy to scale up or down. It is built on a single, highly flexible table schema which helps eliminate “data silos” and enables the construction of powerful workflows. ServiceNow aims to be a “single system of engagement” for the entire enterprise, not just one or even a few departments. Finally, ServiceNow facilitates rapid custom application development by providing several low-code (or no-code) design tools which allow customization via simple configuration, rather than the writing of code. Where code is needed, ServiceNow utilizes a single standard language (JavaScript) throughout the entire platform. - ServiceNow Platform Capabilities include: Data Collection Knowledge Management Reporting Storage Workflow Automation - ServiceNow helps you: - Digitize the flow of work throughout the enterprise - Standardize service delivery - Deliver intuitive experiences to users - ServiceNow is an “Application Platform”. - ServiceNow is also a Workflow Automation tool delivered “As-a-Service”. - Used by nearly 800 of the Forbes Global 2000 companies. - Integrates easily with other systems. - Specifically designed for rapid development. - A Platform As a Service (PaaS) means that you can develop, run, and manage (applications) without having to maintain your own infrastructure. - When software is delivered “As-a-Service”, it includes the following characteristics: - Delivered through the Cloud - Low Capital Expenditure - Easy to scale Up or Down - Subscription-Based Licensing - ServiceNow is built upon a Single Data Model, and a flexible table schema. This helps to eliminate “Data Silos”, and helps to enable Workflows. - ServiceNow is designed to be a “single system of engagement” for the entire enterprise, not just one, or even a few, departments. - Cloud Architecture: - Multi-Tenant Cloud Architecture: Application, Middleware, Operating System, Virtual Machine, Hardware. Each company's data is comingled with data from other customers. There can be availability issues. Any action that affects the database can affect all customers. - ServiceNow Cloud Architecture: Uses Customer-Specific “Instances” where all layers except the Hardware are specific to a customer, so changes do not affect other customers. One organization may have more than one Instance. They are well-isolated, but can still communicate with each other. - Redundancy is built in at every layer of the ServiceNow cloud. - Cloud-Based (Internet) deployment. Accessed via a Web Browser with a URL, Username, and Password. - Domain Tenancy / Multi-Tenancy - A logical grouping of Data, Processes, and Administrative Tasks. Users may be assigned to, or excluded from, a domain. - ServiceNow is designed to facilitate rapid development with features such as:

  1. No/Low Code Development
  2. Standard Coding Language (JavaScript)

- ServiceNow was always intended to be a Platform. They added the ITSM modules First. ===== ServiceNow App Store - App Store ===== - An online marketplace for downloading and installing ServiceNow applications. - Store.ServiceNow.com - Applications on the ServiceNow App Store are certified by ServiceNow for compliance with best practices. - Some apps here are free; others are fee-based. - Apps on the ServiceNow “Share Site” are not vetted by ServiceNow, but they are available at No Cost.

ServiceNow Implementation Methodology (SIM )

- Takeaway The ServiceNow Implementation Methodology (SIM) is a collection of ServiceNow's Best Practices for implementing the Platform, based on over 6,000 deployments. It covers Process, Technology, and People, and is used by ServiceNow Professional Services and many Implementation Partners. ServiceNow itself is used to run a ServiceNow configuration/implementation project. Risks, Issues, Decisions, Actions, Changes, User Stories, Defects, and Tests should all be tracked within the tool. There are expected artifacts such as a Project Charter and Statement of Work, and process steps such as Workshops and Agile Standup Meetings. “Collateral” is available including globally standardized templates, checklists, process guides, and data packs. There are also Templated Presentations. Formal training of customer personnel is highly recommended. - ServiceNow's Best Practices and standard delivery approach for implementing the ServiceNow Platform. - Based on over 6,000 deployments. - Covers the Process, the Technology, and the People, required for a successful project. - Used by ServiceNow Professional Services, and many Implementation Partners. - Issues / Roadblocks are worked at the lowest level possible. When they cannot be resolved in a timely manner, they should be escalated one level. - There should be a handoff from Sales to the Delivery team. “Internal Project Knowledge Transfer”. - A common Language/Vocabulary is valuable. - ServiceNow is used to implement ServiceNow.

  1. Single system of record for the project.
  2. Theoretically, spreadsheets, emails, and folders of files are OUT.
  3. Risk, Issues, Decisions, Actions, and Changes are tracked within ServiceNow as part of the project.

1) Process

  1. Initiate
    1. Understand business goals. Staff delivery team. Kick off the engagement.
    2. Customer should take training on the platform.
    3. Initial Project Knowledge Transfer (IPKT)
      1. The Engagement Manager gathers information from the Sales team.
    4. Customer Introduction Call
      1. Engagement Manager meets the customer for the first time.
      2. EM officially takes over project responsibility.
      3. SOW is reviewed.
      4. Discuss logistics such as Desk Availability, acquiring Access Badges, etc.
    5. Pre-Kickoff Meetings
      1. Document Business Objectives.
      2. Create Project Charter & Initial Plan
      3. Discuss SIM.
      4. Customer should take introductory Training.
    6. Formal Kickoff
      1. Customer Project Team opportunity to meet with EM, Delivery Team, and Sales Team.
      2. Review SOW and Assumptions
      3. Discuss Roles and Responsibilities
  1. Prepare
  2. Hold workshops. Finalize timeline. Refine configuration requirements.
  3. All workshop types produce User Stories.
  4. Some stories may have System Components as the “User”.
  5. Workshop Types:

Core

  1. Gather technical requirements:

Users, Groups, Color Scheme, Branding, Location Hierarchy, Departments.

  1. May not be necessary if the customer already has a version of ServiceNow.

Process

  1. Compare ServiceNow Best Practices against unique Customer Needs.
  2. Capture required platform changes.
  3. Produces Process Documentation.

Integration

  1. Determine best method of connecting external systems to the ServiceNow platform.
  2. May not be needed.
  3. Do Release planning.
  4. Each Story is assigned to a Project or a Release, or both.
  5. Create
  6. Run Agile Scrum cycles.
  7. Perform Story Implementation and Testing.
  8. Perform Demonstrations.
  9. Definition of Done, and thus Story Point Estimation, typically includes:
  10. Acceptance Criteria has been met / SME agrees the story is done.
  11. Unit testing complete.
  12. Peer code review complete.
  13. Update Set packaged for release. Or Data has been Exported.
  14. Documentation drafted/updated.
  15. Story is ready for demo in a Sprint Review
  16. Transition
  17. Support UAT.
  18. The customer is accountable for UAT.
  19. Role-based scenario testing.
  20. Test Management Application may optionally be used.

- Provide training. - Defect/Incident remediation. May continue in a Sprint fashion. - Provide post-go-live support.

  1. Knowledge transfer session.
  2. Discuss upgrade process
  3. Make sure customer has identified roles for maintaining the system.
  4. Close out Meeting

- Final chance to discuss: - Lessons learned - Accomplishments - Success against benchmarks. - Issues and Next Actions

  1. Sales or Account team should be included, and should again become the primary point of contact.

2) Technology

  1. Project
    1. Plugin: Project Portfolio Suite with Financials
    2. Gant Chart with Critical Path
    3. Right click on a task to edit it
    4. Components:
      1. Projects
      2. Tasks
      3. Phases
      4. Dashboards

- Agile

  1. Plugin: Agile Development 2.0
  2. Use Data Pack to define products and assign product owners.
  3. Define Groups of people.
  4. Define the Scrum cycle of sprints; independent from any single project schedule. Multiple projects may be worked at once.
  5. Components
    1. Products
    2. Stories
    3. Releases
    4. Sprints
    5. Tasks
    6. Dashboards

- Test (Management) - Demand - Enhancement

  1. Used AFTER a solution is in production, to designate an improvement to existing functionality.
  2. Helpful if there is a great deal of input. (Larger than a few stories).

- Defect

  1. Represent functionality that is not working as expected.
  2. Can come up in UAT, or after Go Live, in response to an Incident record.

3) Collateral

  1. Globally standardized templates, checklists, process guides, and data packs.
  2. Most projects have many things in common.
  3. Templated presentations are included, for example.
  4. Process Documents / Process Guides
  5. Templates
    1. Presentations which can be modified to add Partner-specific branding.
    2. Available to partners via Partner Portal - Knowledge Base - Services - ServiceNow Implementation Methodology
  6. Data Packs
    1. Collections of Instructions
    2. Sample Project Plans

- Sample Stories - Aligned to specific ServiceNow products. 4) Expertise

  1. Training is available.
  2. In some cases a sprint may begin before the Prepare phase is completed. They run in parallel.
  3. There can be some variation to SIM, based on the number of teams or timeline considerations. ===== Service Portal - Portal - Storefront ===== - Takeaway - A Portal is a ServiceNow user interface (UI) which provides an alternative user experience to the Platform UI. Some actions such as creating users, managing security, and administering tables, can NOT be done via a Portal. A Service Portal may be setup as a user's default page, or a user may access a Service Portal via a “Home” module in the Platform UI, or by appending a string such as /sp to his instance URL. The Service Portal Framework is a set of tools, APIs, AngularJS services and directives, and components used to create portals. A portal is made up of pages, and additional chrome including a header and footer. A portal page is divided up into rows (Containers) with one or more Columns. This is the “Bootstrap” Grid System. Columns (cells?) are stacked, if required, by space limitations. Service Portal Widgets perform the main functionality of a Service Portal, and they are placed into the Portal Containers. - Modules Service Portal - Service Portal Configuration - On the Portal, Ctrl + RIGHT CLICK MOST WIDGETS TO GET TO PAGE DESIGNER!!! Ctrl Right Click. Control Right Click. - A Portal is a ServiceNow user interface (UI), built using the “Service Portal” framework, which provides an alternative user experience to the Platform UI. - There are two user interfaces (two user experiences) the Platform UI and the Service Portal. The Platform UI is much less work to develop on, but it is not “pretty”. It is fast and simple and easy to support. But the problem with the Platform UI is that you cannot really control the user experience. If it is just a bunch of IT folks entering tickets, then it is no big deal. But when you are dealing with untrained customers, user experience becomes very important. You cannot train customers on how to use the system, so you need to design the user interface so that it is really intuitive, and they can figure it out themselves without any help. In this situation it is worth going to the extra time and expense of using Service Portal to design a UI that is elegant and simple to use. - Portals provides an alternative, dedicated user interface for users (customers) to access platform components. It's common for there to be one Portal for end users (customers/requestors), and one for Human Resources. - Geoff Note: Building Portals this way is relatively easy, as long as there are Widgets that do all the things you need them to. - Portals allow users to access most platform components. - You cannot do the following via a Service Portal: Create Users, Add Roles, Manage Security, Administer Tables. - Portal Rows are each divided into columns which use the Bootstrap Grid System - Hidden Feature: The URL of the ServicePortal is often the same as that of the Platform UI, with /sp appended. - There may be a Home module in the Platform UI, or users may be sent directly to a Service Portal when they login. - Some Service Portals may have a Live Chat feature, which also displays the wait time. - Virtual Agents may also be available, which can answer basic chat questions and perhaps guide the user to a solution. - ServicePortal Widgets cannot be added to a Dashboard. - Access - Users access a portal using a URL or a Module. - Example URL: https://yourdomain.service-now.com/sp - Containers - Containers are used to organize Portal Pages. - They organize a Page into Sections. - A Container usually contains a single Row, but may have multiple Rows. - Containers often have more than one Column. - Width - Fixed Layout - Page elements remain the same size as the page widens or narrows. - Fluid - Page elements are a percentage of the screen size. Element width varies as the page width changes. - Note that even in Edit mode, some containers may not appear if they are set to become hidden for certain screen sizes. - You may have to resize your window to see all containers. - Framework - The Service Portal framework is a set of tools, APIs, AngularJS services and directives, and components used to create portals. - The Service Portal Framework helps developers and non‑technical administrators create attractive and engaging user experiences which drive employee adoption of critical enterprise applications. - Pages - Portals are made up of Pages. - A Page may be used in multiple Portals. - A Portal applies theming, a header, a footer, and additional metadata to a Page, allowing reuse of the page without changes to the Page's definition. - Service Portal Configuration Page - This is really the starting point for Portal Development. Type “Service Portal Configuration” into filter navigator. - Brand Editor - Used to apply a Color Theme and Branding to a Portal. - Theme Preview provides a quick way to determine if the colors in a theme look good together. - Page Editor - Provides a tree view of every element on a Portal Page, so that a developer can configure any page element. - Designer / Portal Designer - Remember that you can click the Portal Name to change to editing other Portals. - Remember that you can click the Page Name to change to editing other Pages. - The Preview tab allows you to see your widgets as a user would. - Widget Editor - New Portal - Get Help - Real Estate - Service Portal page layouts are Responsive to device type and screen resolution. - Column width is dynamically adjusted. - Columns are stacked if required by space limitations. - Viewports - The Bootstrap v3 Grid System has 4 viewport sizes: Extra Small, Small, Medium, and Large. - The Viewport size is determined by the width of a page in pixels. - As a user resizes a page or changes devices, the Viewport size changes. This in turn causes elements to be resized. - Some containers or their widgets become unusable when the viewport size becomes small or extra small. - Use the “Parent class” field to specify the Viewport size at which a container should be hidden. - Studio - For scoped applications, use Studio to create application files for Service Portal. - Service Portal - Service Portal Page - Widget - Theme - Style Sheet - JS Include - Widget Dependency - See Also Widgets

SFTP File Transfer

- In order to FTP (SFTP) files, you can use several different options, including the following:

Workflow

SFTP File Transfer Workflow

Flow
	SFTP Step  //

Shopping Cart

{
                "//comment": "No Shopping Cart in snow in SP for Main Menu SP Header Menu"
                "enable_cart": {
                                "displayValue": "false",
                                "value": false
                },
      "enable_wishlist": {
        "displayValue": "false",
          "value": false
      }
}

===== Single Sign On SSO =====

- Takeaway ServiceNow supports Single Sign On (SSO) Authentication and includes a Guided Setup wizard for it. When a user goes to login to ServiceNow, ServiceNow can redirect the user's web browser to an Identity Provider (IdP). The IdP provides a login web page, performs whatever sequence of actions it is configured for to authenticate the user, and then redirects the user's web browser back to ServiceNow, along with a Security Assertion Markup Language (SAML) Response Document. Finally ServiceNow checks various tokens in the SAML document and if satisfied, logs the user in. - ServiceNow may be integrated with a Directory Server and Identity Provider to manage authentication and user data. - There is a Guided Setup for Single Sign-on. - Security Assertion Markup Language - SAML - An open standard for exchanging authentication and authorization data between parties, in particular between an identity provider and a service provider. SMAL is an XML-based markup language for security assertions. - Identity Provider (IdP) - Login Steps

  1. User attempts to login to ServiceNow.
  2. ServiceNow checks for an active SSO Identity Provider cookie. If found, user is authenticated. Done.
  3. ServiceNow selects an IdP.
  4. ServiceNow builds an AuthnRequest XML Doc and generates a RelayState which contains the ServiceNow instance URL in an encoded URL parameter.
  5. Client browser is redirected to the IdP URL along with the encoded URL parameters including the AuthnRequest and RelayState.

- The Identity Provider decodes the AuthnRequest statement, saves the RelayState for future use, and provides a login page for the user if he does not already have an active session.

  1. The Identity Provider authenticates the username and password.
    1. The IDP does Some-Set-Of-Operations (whatever it thinks is good enough) to verify you are who you say you are.

- The Identity Provider builds and encodes an XML-based SAML Response document, grabs the RelayState, and tells the browser to redirect back to ServiceNow with the SAML Response and RelayState as POST parameters. - ServiceNow decodes the SAML response, validates security assertions (such as cert values and signature) and looks for the NameID token (such as email address) to determine which user should be logged in. - ServiceNow redirects the user to the URL as specified in the RelayState. ===== Slack ===== - A web-based Email alternative. - Webhook - A simple way to post a message from an external source into “Slack”. Makes use of HTTP requests. Used for posting general messages as well as for posting the details of Changes, Incidents, or Problems.

Slow Patterns

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0550593 Slow Patterns: Slow Queries / sys_query_pattern - Groups SQL queries by hash of anonymized query Slow Transactions / sys_transaction_pattern - Groups transactions by URL's, referenced by syslog_transaction table Slow Scripts / sys_script_pattern - Groups scripts by file name (Client Scripts, Transform Scripts, Business Rules, etc.) Slow Events / sysevent_pattern - Groups by event name Slow Cache Builds / sys_cache_build_pattern - Groups by cache name Slow Mutexes / sys_mutex_pattern - Groups by mutex name Stack Traces / sys_stacktrace_pattern - Groups by stacktrace pattern, inactive by default in London
===== Slow Scripts - Slow Performance- Slow Business Rules - Script Performance - Slow Running Scripts ===== https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0997495 https://community.servicenow.com/community?id=community_article&sys_id=821a1d7c1b99d45017d162c4bd4bcbdf
- Filter Navigator - System Diagnostics - Slow Scripts - Workload Formula: Workload = Script Execution Time * Number of Executions Per Day - Client Side - Client Side Stopwatch object
- https://developer.servicenow.com/dev.do#!/reference/api/quebec/client/c_StopWatchAPI - Example
var sw = new StopWatch(); var item_ref = g_form.getReference('request_item');
Blocking AJAX Call. Table is implied. Works on Service Portal.

		g_form.addInfoMessage("sw.getTime(): " + sw.getTime()); \\

- Server Side

  1. OCTimer API

- https://developer.servicenow.com/dev.do#!/reference/api/sandiego/server_legacy/c_OCTimerAPI - Good to know about, but could not handle the situation of a business rule getting invoked 500 independent times, and that business rule in turn calling a function that we need to total time for. In other words, there is no straightforward way to instantiate and maintain this object Outside the context of a business rule, such that it persists across multiple business rules. - Using GlideDateTime to measure code execution time:

	var gt1 = new GlideDateTime();
	var n1 = gt1.getNumericValue();
	gs.log(n1);
- Using Session Variables to measure Execution Count and Total Execution Time of a chunk of code which is run many times.
	//Variables to measure the total duration of a chunk of code.
	var startTime;		var endTime;		var msDuration;	var counter=0;
	//Variables to measure the total duration of a chunk of code Across Multiple Invocations of a Business Rule.

var startTimeAll; var endTimeAll; var msDurationAll;

var session = gs.getSession();

	var msSessionDuration = session.getClientData('msSessionDuration');	if (msSessionDuration == null) { msSessionDuration = 0; }
	var sessionCounter = session.getClientData('sessionCounter'); if (sessionCounter == null) { sessionCounter = 0; }
	startTimeAll = new GlideDateTime();
	START LOOP
		++counter;
		++sessionCounter;
		startTime = new GlideDateTime();
		DO WORK WE WANT TO MEASURE
		endTime = new GlideDateTime();
		msDuration = GlideDateTime.subtract(startTime, endTime).getNumericValue();
		gs.log("GGB. " + "  counter: " + counter + "  msDuration: " + msDuration, "Phoenix");
	END LOOP
	endTimeAll = new GlideDateTime();
	msDurationAll = GlideDateTime.subtract(startTimeAll, endTimeAll).getNumericValue();
	msSessionDuration = +msSessionDuration + +msDurationAll;

gs.log(“GGB.” + ” + ” msDurationAll: “ + msDurationAll + ” sessionCounter: “ + sessionCounter + ” msSessionDuration: “ + msSessionDuration, “Phoenix”);

	session.putClientData('msSessionDuration', msSessionDuration);
	session.putClientData('sessionCounter', sessionCounter);

- Long Running Transactions - To see which Business Rules (and/or SQL Statements) are involved in a current Long Running Transaction, do the following: - In one browser window, start the long-running transaction. - In another browser Session (Chrome Incognito Window - Ctrl + Shift + N), open up “Active Transactions”: https://[YourInstanceName].service-now.com/nav_to.do?uri=%2Fv_transaction_list.do%3Fsysparm_query%3Dforeground%253Dtrue%26sysparm_first_row%3D1%26sysparm_view%3D - As the transaction runs, you will see the number of SQL Statements and the number of Business Rules increase, as you refresh the v_transaction table. - Each time you refresh, the table will show EITHER an SQL Statement OR a Business Rule. Both may be useful.

SNUtils

SN Utils - This is the utility that Christopher Falco uses.

Solution Delivery Management (SDM)

? ===== Source Control - GitHub - GIT ===== - Takeaway In ServiceNow, Developer Studio manages source code files in a local “Repository”. It also connects via HTTPS to a remote source code management system called GitHub. GitHub allows a developer to back up his work, find code easily, manage versions, work in parallel with other developers, track changes, and resolve conflicts. GitHub is only accessed from Studio when you explicitly Import files or Commit files. In GitHub you can “Fork” a repository to copy it from one GitHub account to another. Forking is used to copy Developer Training source code from a central GitHub Repository to your own personal GitHub Repository. Then in Studio, the “Import From Source Control” operation may be used to “clone” a repository from GitHub into Studio. In Studio you may “Stash” your changed and uncommitted application files. This removes them from the current application, but saves them in a safe place so they may be reapplied later. A Branch (of an Application) is a named set of code files, inside a repository. A branch is used to work on application files separately from the main (trunk) application. A branch may be used for fixing a bug, developing new code, or experimenting with new functionality. When a developer wishes for his code to be pulled back into the Trunk, he creates a “Pull Request” in GitHub. In Studio, a developer may only work on one branch at a time. Switching branches removes the application files (and any transactional records created) for the current branch and installs the files for the newly selected branch. - Roles: source_control - Some benefits of Source Control: - Code Organization. - Backup on a remote computer. - Version control and ability to roll back. - Parallel Development. - Change Tracking. - Conflict Avoidance and Resolution. - No need to manage Update Sets (XML files). - An application can be moved from a one non-production environment to another without managing Update Sets. - GIT is a cloud-based source control management system. - Creation order for the application and repository does not matter. The application can be created before the repository or the repository can be created before the application. - When both the application and repository are created, the application can be linked to the repository. - Important: ServiceNow tracks scoped application changes in a user-specific Update Set. - When an application is developed on a Single Instance, conflicts can be avoided. When a developer opens a file it will be Locked if another user has already edited it. - Studio supports Git platforms such as Git Hub and Git Lab. - Apply Remote Changes - Allows a developer to pull in changes which may have been made to the Remote Repository. - Branch - A set of code files, inside a Repository, under the same account, but with a unique name. - Developer Studio may be used to create a Branch via Source Control - Create Branch - You create a Branch in order to do development on application files separately from the main (trunk) application. - You create a branch to develop new code, create a fix or application issue, or experiment with new application functionality. - Create a branch to work on a new versions of an existing application. - A developer can commit work to a Branch, one or more times. - Pull Request - A request, created by a developer in Git Hub, to pull branched code back into the trunk. - Others can review the proposed changes, add comments, and discuss. The developer may make additional changes and commit them. - To view a different branch in GitHub, click the Branch button. - Switch Branch - A developer can only work with one active branch for an application at a time in an instance. - Switching Branches changes which Branch is active. - Switching Branches removes the application files for the current branch and installs the files for the newly selected branch. - Switching Branches removes any data which may have been created for testing. You will lose local changes! - Note that an Application can only have one Active branch at a time, so all Developers working on an Application need to work in the same branch. - Note: The Developer Portal training repositories use a “branch” label of “master”. - Merge - Combining changes from different branches, or local and remote changes. - When development on a branch is completed and committed, a developer merges the branch into the trunk (or the parent branch). - Developers use GitHub to merge branches from a Pull Request. - Delete After a branch is merged, or to abandon the work in a branch, delete the branch from the GitHub repository. - Clone - You can “Clone” a repository from your own GitHub account to ServiceNow. When you do so, in GitHub, you are given a link such as this: https://github.com/GeoffreyBishop/devtraining-needit-orlando.git - This link may be used in ServiceNow Studio via the “Import From Source Control” button. This results in a new application appearing in ServiceNow. - Commit Changes / Check In - Each User's “Update Set” is listed. - There's a Compare button on the right side of each commit record which may be used to compare a file to what is in the repository, before committing. - For Script and HTML fields, you may need to click on the “More Details” icon to see a line-by-line comparison between the Committed version and the changed (current) version. - It's a good idea to include your initials in the Commit Comments. - On GitHub, the Code tab shows the list of commits and commit comments. - Fork - A copy of an entire repository, placed under a new account. Includes all branches. - You can go to an existing repository and press the “Fork” button to copy that repository into your own GitHub account. - Master - A name given to the main branch (the trunk) of an application - By default the git repository has one branch named master, and considered to be the definitive branch. - You may want to set the value glide.source_control.default_branch_name in order to have the ServiceNow default branch match up with the Git default branch. - Repositories - Remote Repository - The remote Git repository where source files are stored and managed. - Local Repository - The working repository inside of Developer Studio, where developers create and change application files. - Quirks - If the Commit Changes menu item is disabled, but changes have been made, reload the Studio browser window! - Records / Transactional Records - To include records with an application in source control, open the List for the table, select the records to include, and choose “Create Application File”. - Warning: New records in tables that use auto-numbering may be assigned the same number as records saved as application files. To avoid records with duplicate numbers, change the Number values to fall outside the auto-numbering or change the start of the auto-numbering to begin with a value higher than the sample data. - Stash - Storing local changes on our instance, for later application. - To stash something is to store that something in a safe place. :) - Stashing saves local changes for an application to apply to any branch, later on. - The locally stashed changes do not need to be committed to the remote repository. - Stashing a change removes the change from the current application (??), and saves the change for a developer to apply later, or to discard. - A stash will be lost if the corresponding application is deleted or the instance is wiped. - All uncommitted application files changes are included in the stash. - In Developer Studio, the Manage Stashes menu item is used to manage stashes. - If the Manage Stashes menu item is not active, the application has no stashes. - Applying a stash does not delete the stash. After applying and committing the changes in a stash, the stash can be deleted. - Creating a stash takes ALL local changes. You cannot pick and choose which changes to stash. - When you “apply” a stash, all changes from the stash are applied. - Conflicts occur when there are local changes that conflict with the more recent files in the repository. Conflicts must be resolved manually. - Tags - A point-in-time marker. Once set, it cannot be modified. Can be used to create a Branch in ServiceNow. - A tag is a label applied to a fixed set of application files. - You Tag a Revision of an application. - A tag may be used to return/retrieve a specific commit in the development of an application. - Commit all changes to include in a tag before creating the tag. - Studio pushes the tag to the remote repository as a part of the tag-creation process. - To view a Tag in GitHub, click the code tab and then the release tab - To utilize a Tag saved previously, in Studio, create a Branch from the Tag. - GitHub - https://github.com/ - A graphical, web-based Source Code data store, which ServiceNow Studio can connect to. GitHub works over HTTPS. - You supply your GitHub credentials to the “Import From Source Control” dialog. - You may import a partially built application to begin working through each module from a baseline state that contains all the application files you need for a training module. - GitHub allows you to load your saved work to continue work on a new PDI. - The standard practice is for each application to have its own Repository??? - GitHub Steps ONE TIME 0) Create a GitHub account. OCCASSIONALLY 0) Sign in to your own GitHub account 1) Follow a URL to a published Repository provided by ServiceNow or another third-party. 2) At the top right of the screen, click the Fork image button. 3) At the middle right (in green) click the Clone or Download button… Copy the URL out of the text box displayed. 4) From the newly forked Repository, using the URL you obtained, import the Application into Studio… With Studio already open… File - Import from Source Control - Paste URL - Branch:“Master” - and Provide GitHub Credentials. Click “Select Application” - Then select the name of the application in the repository, that you wish to work on. 5) Use Developer Studio Source Control to “Create a Branch” from a particular Tag in the repository. EVERY MODULE 0) Create a Branch from an existing Tag. (The branch name appears at the bottom right of studio.) 1) Do work. 2) Commit Changes (files) to the GitHub repository, from your “Update Sets”. - Repositories: Geoffrey Bishop Repository Dev Training Repository - I believe that Branches and Tags exist only in GitHub, and Stashes exist only in Studio, the general hierarchy being as follows: GitHub Public Repository Personal Repository Application 1 Trunk Tag1 Tag2 Branch1 Tag1 Tag2 Branch2 Application 2 Studio Application1 Stash1 Stash2 Application2 - Publish The process of sending the current local application to the ServiceNow repository. - Import To bring an existing app in a Git repository into the Now Platform. - Link To connect a local ServiceNow application to a Git repository.
===== Strings - String Fields ===== ServiceNow string fields with a “choice” value of “Dropdown”, automatically pull their values from the sys_choice table, with an automatic filter as follows: Table = Table that the field belongs to (table for which you are defining the field). Element = Column name of the field in question (field you are defining). You cannot see these “filter” settings in the Related List of the sys_dictionary form. ===== Store - ServiceNow Store ===== - Once you purchase an application from the ServiceNow Store, it magically appears in your instances under System Applications - All Available Applications - All

Studio - Service Now Studio - Developer Studio

Takeaway Developer Studio is ServiceNow's Integrated Development Environment. Studio may be used to create or edit any Application Files including those containing business logic or table definitions. A Guided App Creator wizard may be used as the starting point for a new Application. Studio supports integration with GitHub for source code control. Studio also includes a Script Debugger tool where you can set breakpoints and step through script. - Module System Applications - Studio - Service Now's Integrated Development Environment (IDE) - Use studio to lay out forms, create business logic, configure fields for tables, or edit application files. - After creating an application in Guided App Creator, use Studio to enhance and build on the application. - Studio can be used to add fields, create form layouts, create form sections, and create views. - Note that when you create a new table in Studio, many other supporting objects such as Menus and Roles are also normally created. - The use of the term “file” in the “Create Application File” button, is misleading. Files in this case are practically anything, including Forms and Modules. - Use the Source Control - Commit Changes menu item to save all the work you have done in Studio back to GitHub. - Always reload ServiceNow after you make changes in Studio. - Useful Tools in Studio

  1. Code Search
    1. Studio - Code Search (link at top right) - Search in all applications - Search
  2. Script Debugger

1) Set Breakpoint 2) Open Script Debugger 3) Trigger Code 4) Hit Breakpoint 5) Step Through Code - You apparently never “Need” to go outside of Studio to do development. - There is a way to edit ServiceNow script using the Visual Studio editor: ServiceNow Extensions for Visual Studio Code
- Note that when you Create a Branch from Source Control, you may lose transactional records if a table is dropped and a new table is created. Records in application tables are not preserved as part of an application, unless they have been added to the application as files. - Limitations

Studio does NOT have the following features:
	Form Layout Designer
	Update Sets
	Testing Capabilities (?)
	Branch Merge Capability
	Data Import

- An application can be opened in only one Studio window at a time. Multiple studio windows can be open, but each must contain a different application. - Note, as you move through the various Training Modules and Lessons, and you create Branches and switch Branches, you will lose data records. When you Create a Branch from a Tag, it removes what you have in place and reloads whatever is in the Tag. - To save the NeedIt records as part of the application, open NeedIt > All and check the boxes for the records you want to keep. At the bottom of the list, click Actions on selected row - Create Application File. - You should save your work regularly by committing your work to source control or creating Update Sets. ===== Subscriptions ===== Modules Subscription Management - Subscriptions Subscription Management Application in ServiceNow itself can show you what Subscriptions the customer already has.

Success Pillars

https://www.servicenow.com/success.html - Success Pillars are ServiceNow recommendations for how to be successful with the product. They are suggested activities created from asking ServiceNow's most successful customers about their best practices. - The “Success Navigator” is a tool that asks you questions to help assess your business readiness and it gives you checklists and action plans! - The four pillars (along with sub-pillars) are: 1) State and Measure your business goals. State your transformation vision and outcomes Build your business case Build a phased program plan, identify quick wins Baseline and track performance, using KPIs and metrics 2) Actively lead your business transformation. Engage an executive sponsor to drive change and remove roadblocks Find, manage, and coordinate capable certified partners Build a dedicated, dynamic governance process, policies, and team Reimagine how you want work processes to flow Define and map out your business services Manage platform demand 3) Get your ServiceNow technology foundations right. Manage to out-of-the-box Discover and map your service assets Plan your architecture, instances, integrations, and data flows Plan for upgrades at least once a year 4) Create user excitement, drive adoption. Design an engaging self-service employee and customer experience Design an optimal agent and rep experience Create a change management plan Build an internal team of ServiceNow experts and train users Build a community of champions
===== System Definition ===== - A ServiceNow Application that contains many foundational configuration items. - Allows you to control which menus are available to which users. - You can create your own “Application Menus” and Modules (which display data from tables that you select).
===== System Diagnostics ===== Modules System Diagnostics - Stats System Diagnostics - Stats - Open Source Software

System Export Sets

- Use Export Sets to generate data files, such as CSV files, from ServiceNow. These files may then be sent via FTP to other downstream systems. - In Filter Navigator, type in “System Export Sets” to see all the relevant records.

- Data Table

  1. This is the source of our data. It can be any table whatsoever.
  2. Example NewUserStagingTable

- Export Definition - Table sys_export_definition - Example New User Data Export Definition nH

  1. Defines What to export.
    1. Table to pull data from.
    2. Fields to extract from the table.
    3. Filter to apply to the table to specify which records are retrieved.

- Export Target

  1. Table sys_export_target
  2. Example New User Data Export Target

- Specifies “Where” to export the data.

  1. MID Server to export to.
  2. File Path to append to the “agent\export\” folder.

- Export Set

  1. Table sys_export_set
  2. Example New User Data Export Set
  3. The top level record for defining all the attributes of a data export. Links to the export Definition and Target.
  4. Specifies the following:
    1. Filename
    2. File Format (CSV, Excel, XML, JSON)
    3. Timestamp Suffix (Yes or No)

- Scheduled Export / Scheduled Data Export

  1. Table scheduled_data_export
  2. Example New User Data Scheduled Data Export

- Specifies Schedule, User, and if a “Delta” type export is needed. Also has Pre and Post scripts.

- Export History List View

  1. Table sys_export_set_run
  2. Example Export Set = New User Data Export Set

- A history of each export set run

  1. Includes Start time, end time, and run time.
  2. Includes the actual Export Set Attachment data which you can directly download and view, so there is no need to go to the actual Mid Server.
  3. If you drill into the attachment record, you can see the full name of the attachment including any Date which was appended to the base name.
  4. You can also download the actual file which was generated.

- Mid Server Attachments

  1. Table ecc_agent_attachment

- Example: Export Set Attachment

  1. Specifies the following:
    1. File size in bytes
    2. Create Date.
    3. Link to actual file!
    4. Note, Microsoft Excel may SHOW the data in a way that is not 100% representative of the raw data. Use a different app to see the raw data. —– =====Specifying which columns appear===== - Just open the dialog like the user would, and then in the menu for any column choose Configure - List Layout.

—–

ServiceNow SLA Targets

- Keep in mind that these are targets and not contractual commitments. - Customers may submit a case with ServiceNow via phone or web and with ServiceNow’s authorized reseller as directed by the reseller. All support requests are tracked online and can be viewed by the customer’s authorized contacts. Response times do not vary if the case was filed via phone or web. ServiceNow or its authorized reseller, as applicable, will use reasonable efforts to meet the target response times and target level of effort stated in the following table. Support from the reseller may be limited to business hours only. Priority Target Response Times Target Level of Effort P1 30 minutes Continuously, 24 hours per day, 7 days per week P2 2 hours Continuously, but not necessarily 24 hours per day, 7 days per week P3 24 hours As appropriate during normal business hours P4 48 hours Varies =====Service Mapping===== - Hierarchy: Business Service Business Service Configuration Item (Hardware) - Service Mapping is one method to populate the CMDB. - Service Mapping requires a MID Server. - Top Down - A technique used by “Service Mapping” to find and map CIs that are a part of Business Services such as Email. - Service Mapping Application: - Provides the contextual map that shows how Cis are deployed to support the delivery of a specific service. - - Business Services and Technical Services can be used to REDUCE THE NUMBER OF RELATIONSHIPS depicted in the CMDB. - Business Service - An organizational element which may represent a series of CIs which together represent one “Offering”. - Technical Service - A collection of CIs, grouped together, and used to support an upstream business application. - Such as a grouping of Web Services. - The ITOM Suite includes: Discovery Service Mapping Event Management Cloud Management - To upgrade to a new version of ServiceNow, the basic steps are: - Do a fresh clone down to Sandbox - Upgrade Sandbox to latest City version of ServiceNow - Review each Skipped Change - Open up an Update. (note, you will need to open an update set for EACH Application Scope you work on) - If you “Revert to Base System”, that is, to the ServiceNow Out of the Box version of an object, a Customer Update will be generated. ??? - If you “Merge” a Customer Update will be generated. - An Upgrade Details record will also be captured in the update set. (Table sys_upgrade_history_log)

Sending Emails from ServiceNow

- To enable email sending from a particular type of record (particular table), configure the Dictionary record for that table…

  1. In the Attributes field for the dictionary record, add the following: email_client=true
  2. Doing this will activate the More Options - Email menu option available at the top right of any form for the table.

- To configure the different options for users when thy go to draft an email for a particular table…

  1. Under Email Client - Email Client Configuration, create a new record to represent the table you want to configure emails for.

- To compose Snippets or Chunks or Email Content which may be inserted into an email message which is being composed…

  1. Under Email Client - Quick Messages (also called Canned Messages), create a new message and specify the table it relates to.

- When the user has the “Compose Email” dialog open, and is composing a message, a special “Quick Messages” dropdown will appear at the top right. Selecting an item from this dropdown will insert the message into the message body wherever the cursor is positioned.

??? Use table Email Client - Email Drafts (sys_email_draft) for staging Coop emails??? =====Steps for Finding Useful Code FROM the Service Portal===== - Ctrl Right Click the form element or error message on the portal to get the name of the widget: - In this example, the widget name is “IBFS Record Producer Wrappter”.



You want to be working in the Widget Editor tool for the following reasons:

  1. You can display the FULL LISTING of the HTML Template, Client Script and Server Script.

- When you press Ctrl F for Find, symbols will be found EVEN IF they are not visible in the web browser window. In other words, they will be found even if they are Scrolled Off of the visible text editor panes.

ss.txt · Last modified: 07/18/2023 08:11 by johnsonjohn