Sunday 9 December 2018

ServiceNow Useful Tips

ServiceNow Useful Tips
CSS Tips

// add customized style sheet

// studio->application->create application file 
// -> style sheet(content management) -> create

// then main_view-> Table
// -> "content_css" table to find the id of the style sheet

// then right click copy sis_id

// Studio -> Your application 
//-> UI_Scripts -> Your script






Other Useful Tips

  1.   Assign Role to ACL requires usr to evaluate to security admin Role 
  2.  password1` stores passwords with one-way encryption. It cannot be decrypted. `password2` stores passwords with two-way encryption. It can be decrypted. 
  3.  When user provides `0000000000`, meaning `password not changed`. Do nothing. 
  4.  System Definition->Tables -> Name = sys_properties -> Show List -> name = com.glide.communication to set httpclientverifyhost = FALSE if HTTPS server certificate expired 
  5.  ServiceNow REST API(INBOUND) has HTTP simple verification, needs to enable that on the client request script 
  6.   Glide Record retrieves a record from db with colum names and object values, to retrieve, use gr.getValue(column name);
  7.   ServiceNow RESTAPI(INBOUND) for incoming data received need to make restMessagev2() {Internal rest request} to IMPSET table(TEMP) -> Create Transform MAP, to map the data to -> Actual Tables. The rest message v2 is written in underneath the script section of RESTAPI your servicenow CRUD request. Transform map needs to sepcify fields to map, colases means whether the column should be unique during transfromatioj 
  8.  Usr need to have import admin privilege to have response and to see response when sending rest to impset table. usr also needs impset and actual table roles 
  9.  All servside scripts are in script_includes, each file is a constructor function in ESCMA 6 format which is a class. They are already included in all server side, they can be used by calling new class(); 
  10.  To show client side, needs to create application menu first. 
  11.  Then we need to create module under application menu, to use existing table just link module with table, to use customized ui page, link the module with ui page url 
  12.  All ui_scripts are in ui_scripts section, (Used in ui page), each file in ui_script should consists of constructor functions or ES6 class or functions. So when its included in UI page, its easy to pass in by function name, and call either by function name or create class function name() 
  13.  All tables created have forms, we can create customized forms linked to other tables. And also we can add customized sections by create and include an ui formatter. UI formatter is customized by UI macro 1
  14. In ui scripts, ajax request is achieved using glide ajax: https://docs.servicenow.com/bundle/kingston-application-development/page/app-store/dev_portal/API_reference/GlideAjax/concept/c_GlideAjaxAPI.html var ga = new GlideAjax('HelloWorld'); // HelloWorld is the script include class ga.addParam('sysparm_name','helloWorld'); // helloWorld is the script include method ga.addParam('sysparm_user_name',"Bob"); // Set parameter sysparm_user_name to 'Bob' ga.getXML(HelloWorldParse); /* Call HelloWorld.helloWorld() with the parameter sysparm_user_name set to 'Bob' and use the callback function HelloWorldParse() to return the result when ready */ // the callback function for returning the result from the server-side code function HelloWorldParse(response) { var answer = response.responseXML.documentElement.getAttribute("answer"); alert(answer); } 
  15.  In backend -> script includes -> communication are achieved by restMessagev2 
  16.  Incident table is there by default, we can do stuff upon CRUD to that table by setting up a business RULE. Remember business rule is triggered every time for each column changed, if 3 columns changed, business rule triggered three times 
  17.  To create attachment to incident table write to ecc_queue table, be sure of attCreator.source = 'incident' + ':' + current.getValue('sys_id'); to insert the correct incident to that ecc_queue table 
  18.  For incident in jakatara instance, the caller(Which is the person who reported this incident) field is optional and it will be set to the JSONRPC username if its created by FAZ app script. Where in London instance it is mandatory. Jakarata ends support on q1 2019. 
  19.  Scheduled script can be created using Scheduled script. 
  20.  Client side ui script vs client script:

No comments:

Post a Comment