Monday, 17 December 2018

settimeout / Sleep / wait in ServiceNow


setTimeout in ServiceNow


function onChange(control, oldValue, newValue, isLoading) { 
if (newValue == oldValue){
return;
}  
window.setTimeout(Test,4000);
}  
function Test(){
// do your stuff here
alert('Wait for 4 Seconds.');
var caller = g_form.getReference('<field_name>');

}
Note: You should always use setTimeout(Test,4000) instead of setTimeout(Test(),4000); 


Sleep in ServiceNow
Note : We cant user gs.sleep function in scooped application it has to be used in non-scooped application
sleep: function (duration) {
gs.sleep(duration);
},

Monday, 10 December 2018

Client-Server call in ServiceNow / Ajax Call / Asynchronous Call

AJAX (asynchronous JavaScript and XML) is a group of interrelated, client-side development techniques used to create asynchronous Web applications.
AJAX enables web applications to send and retrieve information to and from a server in the background, without impacting the user experience with the displayed web page.


GlideAjax:


The GlideAjax class allows the execution of server-side code from the client. GlideAjaxcalls pass parameters to the script includes, and, using naming conventions, allows the use of these parameters.

Using GlideAjax:
·         Initialize GlideAjax with the name of the script include that you want to use.
·         When creating the script include, you must set the name field to be exactly the same as the class name.
·         When creating the script include, you must select the Client callable check box.
·         Specify the parameter sysparm_name. GlideAjax uses sysparm_name to find which function to use.
·         Any extra parameters may be passed in, all of which must begin with sysparm_. Avoid using predefined parameter names:
o   sysparm_name
o   sysparm_function
o   sysparm_value
o   sysparm_type
·         Code is then executed with the getXML() or getXMLWait() functions.



Example of asynchronous GlideAjax call
Client Side:
var ga = new GlideAjax('HelloWorld');
ga.addParam('sysparm_name', 'helloWorld');
ga.addParam('sysparm_user_name', "Bob");
ga.getXML(HelloWorldParse);
 
function HelloWorldParse(response) {
  var answer = response.responseXML.documentElement.getAttribute("answer");
  alert(answer); }

Server Side Code:
var HelloWorld = Class.create();
HelloWorld.prototype = Object.extendsObject(AbstractAjaxProcessor, {
   helloWorld:function() { return "Hello " + this.getParameter('sysparm_user_name') + "!"; } ,
   _privateFunction: function() { // this function is not client callable     
    }
 });


Note: You must set the name of the script include to HelloWorld.
  • ·         The sys_script_include code must extend the AbstractAjaxProcessorclass and be client-callable.
  • ·         Function names starting with "_" are considered private and are not callable from the client.
  • ·         Avoid overriding methods of AbstractAjaxProcessor, including initialize. While it is possible to invoke methods of your superclass object which you have overridden, it is complicated and best avoided altogether.




ServiceNow System Administration Part 8



 v  Import Sets
Ø  What is the transform map used for? (A guide for moving data from import set tables to target tables)
Ø  When should you coalesce fields on an import? (Before data transform)
Ø  What happens when a match is found using the coalesce field? (The existing record will be updated with the information being imported)
Ø  What happens if a match is not found? (A new record will be inserted into the database)
v  ACL’s
Ø  What is an access control? (Security rule defined and set at the row and column levels)
Ø  What three ways can ACL’s be defined? (Roles, conditional expressions, and scripts)
Ø  How are record ACL rules processed? (In order of most specific to most general)
Ø  How are Table ACL rules processed? (Match table name, match the parent table name, match any table name [wildcard])
v  Tables
Ø  What does each record correspond to in a table? (Row)
Ø  What does each column correspond to in a table (Field)
Ø  What are the three attributes of a field? [Label (user friendly term), Name (unique term to the system) Value (actual data) ]
v  Service Catalog
Ø  What are the major components of the Service Catalog? (Items, Record Producers, Variables, Variable Sets, Workflows)
Ø  Variables are global by default. (True/False)
Ø  Filter conditions
Ø  What are the three components of a filter condition? (Field, Operator, Value)
v  Settings Menu
Ø  What categories are in the Settings Menu? General, Theme, Notifications, Lists, Forms and Developer
Ø  Where can users define Notification channels and subscriptions? (Gear Icon Settings)

v  Connect Presence
Ø  Using this, are you able to see Editing in real-time on a form?  (True/False)
v  Application Navigator
Ø  What is displayed when using the Filter Navigator? Applications and Modules
Ø  Where can you search text? (Knowledge, Filter Navigator, Chat)
v  Lists
Ø  Personalizing a list, who does it affect?  (Only the user)
v  Forms
Ø  What kinds of fields are typically on a form? (String, choice, true/false, reference)
v  Saving Forms
Ø  When does Submit appear on a form? (When it is a new record)
v  Users
Ø  What are some authentication methods? Local database, LDAP, Multifactor, SAML 2.0, OAuth 2.0, Digest Token, SSO
Ø  Can roles contain other roles? (Yes, a role may contain other roles and any access granted to one role is automatically granted to any role that contains it.)
v  Tables
Ø  A table that is not extending another table but is itself extended is called what? (Base table)
Ø  Can Assignment Rules be scripted? (Yes)
Ø  How do you define a field on an extended table differently than the parent table? (Dictionary Overrides)
v  Events
Ø  How are events triggered? (User Actions, Scripts, Business Rules and Workflows)
v  CMDB
Ø  How do you create CI relationships? (Use the CI Relationship Editor)
Ø  What do you use to display the infrastructure view for a CI and its business services? (Dependency View)
v  Reports
Ø  What are metrics used for? (Used to measure and evaluate the effectiveness of IT service management processes)


v  Workflows
Ø  What represents the entire structure of the workflow and the definition of the processing a Workflow can accomplish? (Workflow Model)
Ø  When a workflow is checked out, who do the changes apply to? (The user who has the Workflow checked out)
Ø  What are the Workflow States? (Checked Out, Unpublished, and Published)
v  SLA’s
Ø  What is an SLA? (A record which defines a set amount of time for a task to reach a certain condition.)
Ø  SLA’s can only run against tables that extend which table? (Task Table)
v  Development
Ø  UI Policies run on which side? (Client side)
Ø  A UI action with an order number of 50 will display after a UI action with an order number of 60 (True/False)
Ø  Business Rules monitor fields on a form (True/False)
v  Upgrades
Ø  What are exempt in upgrades? (Customizations)
Ø  When should you clone your instance? (Before a formal testing cycle, after a comprehensive or long development cycle, after the completion of an application upgrade)
v  Update Sets
Ø  If several update sets have modified the same object, like a form, which change will be the one moved to the new, merged update set? (The most recent one)
Ø  What data records are captured in an update set? (None. Data is not captured in an update set.)

ServiceNow Prerequisites

To better understand the ServiceNow Prerequisites you have understand ITIL concepts.

Click on the below link for ITIL Concept


You can create your own Service-Now instances (10 Mins) 


Kindly find the below screenshots of instance creation for your reference.


1. Click on register on the right hand corner side at the top as shown below.











2. Fill the fields as below and click on submit button.



















3. Login with username and password and it will redirect to the page to enter country, pin-code and click on submit
4. After that it will redirect to the page below.




5. Go to manage>Instance
6. Click on request instance and select the version(Jakarta).
7. click on the url and login to the instance with the credentials which has been mentioned at the bottom of the page and reset your password accordingly.
8. After instance creation go through below e-learnings which gives you the overall view of service-now navigations and concepts


Foundation e-Learning


Click on the below link for html, css, Java script
html, css, Java script