• Call us: +91 9501707741
  • tutorialzdiary@gmail.com

ServiceNOW

ServiceNOW Training

ServiceNow Training Course
ServiceNOW Admin Training Course
ServiceNOW Development Training Course

ServiceNOW Hands on

ServiceNOW : How to get personal ServiceNOW instance to start exploring
ServiceNOW : List & Forms Administration
ServiceNOW : Reporting Module
ServiceNOW : Scheduling and Publishing Reports
ServiceNOW : Scripts & APIs
ServiceNOW : Workflows
ServiceNOW : Service Catalog Module
ServiceNOW : Incident Management
ServiceNOW : Change Management
ServiceNOW : Configuration Management
ServiceNOW: Business Rules & basic functions
ServiceNOW: Business Rule- Sample Scripts
ServiceNOW: Client Script-Sample Scripts
ServiceNOW : Knowledge Management
ServiceNOW: Client Script & basic functions
ServiceNOW : Changes in Incident,Change & Service Catalog Module in Helsinki(latest version of ServiceNOW)
ServiceNOW : Reference Qualifier

ServiceNOW Interview Questions and Answers

Part 2: USER ADMINISTRATION & ESS
Part 1 : CMDB
Part 3: SLA
Part 4 : Scripts
Part 5: Table & Data Dictionary
Part 6: ACL
Part 7: Workflow
Part 8: Service Catalog

ServiceNOW: Business Rules & basic functions

A business rule is a server-side script that runs when a record is displayed, inserted, updated, or deleted, or when a table is queried. Use business rules to accomplish tasks like automatically changing values in form fields when certain conditions are met, or to create events for email notifications and script actions.

Business Rules runs on below condition:

  1. Before : After the user submits the form but before any action is taken on the record in the database.
  2. After : After the user submits the form and after any action is taken on the record in the database.
  3. Async : When the scheduler runs the scheduled job created from the business rule. The system creates a scheduled job from the business rule after the user submits the form and after any action is taken on the record in the database.
  4. Display : Before the form is presented to the user, just after the data is read from the database.

 
Business rule runs on 4 database action:

  1. Insert : When the user creates a new record and the system inserts it into the database.
  2. Update: When the user modifies an existing record.
  3. Query: Before a query for a record or list of records is sent to the database. Typically you should use query for before business rules.
  4. Delete: When the user deletes a record.

 
HOW TO CREATE NEW BUSINESS RULE

  1. Navigate to System Definition > Business Rules.
  2. Click New.
  3. Fill in the fields, as appropriate (see table). Note: Some fields are only visible when the Advanced check box is selected.
  4. Click Submit.
Creating New BR

Creating New BR

BASIC FUNCTIONS

  1. addErrorMessage(Object) : Adds an error message for the current session. Session error messages are shown at the top of the form. Use getErrorMessages() to retrieve the list of error messages .
  2. addInfoMessage(Object) : Adds an info message for the current session. Session info messages are shown at the top of the form below any error messages.
  3. addMessage(String, Object) : Adds a message for the current session.
  4. flushMessages() : Clears session messages saved using addErrorMessage(Object) or addInfoMessage(Object). Session messages are shown at the top of the form. In client side scripts use g_form.clearMessages() to clear all session messages.
  5. getErrorMessages() : Gets the list of error messages for the session that were added by addErrorMessage(Object).
  6. getImpersonatingUserDisplayName() : Returns the display name of the impersonating user.
  7. getImpersonatingUserName() : Returns the name of the impersonating user or null if not impersonating.
  8. getInfoMessages() : Gets the list of info messages for the session that were added via addInfoMessage(Object.
  9. getMessages(String) : Gets the list of messages of the specified type for the session that were added viaaddMessage(String, Object).
  10. getPreference(String, Object) : Gets a user preference.
  11. getSession() : Returns a GlideSession object.
  12. getSessionID() : Accesses the GlideSession Session ID.
  13. getTrivialMessages() : Gets the list of error messages for the session that were added with the trivial flag.
  14. getUser() : Returns a reference to the User object for the current user
  15. getUserDisplayName() : Returns the name field of the current user
  16. getUserID() : Returns the sys_id of the current user.
  17. getUserName() : Returns the username of the current user
  18. getUserNameByUserID(String): Gets the username based on a user ID.
  19. hasRoleInGroup(Object, Object) : Determines if the current user has the specified role within a specified group.
  20. isInteractive() : Checks if the current session is interactive.
  21. eventQueue(String, Object, String, String, String) : Queues an event for the event manager.
  22. getCurrentScopeName() : Gets the name of the current scope.
  23. getDisplayColumn(String) : Gets the display column for the table.
  24. getDisplayValueFor(String, String, String) : Gets the display value for a given field.
  25. getEscapedProperty(String, Object) :Gets the property and escapes it for XML parsing.
  26. getMessage(String, Object): Retrieves translated messages to display in the UI. If the specified string exists in the database for the current language, then the translated message is returned. If the specified string does not exist for the current language, then the English version of the string is returned. If the string does not exist at all in the database, then the ID itself is returned.
  27. getMessageS(String, Object) : Retrieves translated messages to display in the UI and escapes all ticks (‘). If the specified string exists in the database for the current language, then the translated message is returned. If the specified string does not exist for the current language, then the English version of the string is returned. If the string does not exist at all in the database, then the ID itself is returned.
  28. getNodeValue(object, Integer) : Gets the node value for specified index.
  29. getNodeName(Object, Integer) : Returns the node name for specified index.
  30. getProperty(String, Object) : Gets the value of a Glide property.
  31. getScriptError(String) : Returns the script error found in the specified script, if there is one. The script is not executed by this function, only checked for syntax errors.
  32. getStyle(String, String, String) : Returns the style defined for the table, field and value.
  33. getXMLText (String, String) : Gets the xml text for the first node in the xml string that matches the path query.
  34. getXMLNodeList(String) : Constructs an Array of all the nodes and values in an XML document.
  35. log(String message, String source):Logs a message to the system log and saves it to the syslog table.
  36. logError(String message, String source) : Logs an error to the system log and saves it to the syslog table.
  37. logWarning(String message, String source) : Logs a warning to the system log and saves it to the syslog table.
  38. nil(Object) : Queries an object and returns true if the object is null or contains an empty string.
  39. print(String): Writes a message to the system log. This method does not write the message to the syslog table unless debug has been activated.
  40. workflowFlush(Object) : Deletes all existing workflow operations for the specified GlideRecord.
  41. beginningOfLastMonth() : Gets the date and time for the beginning of last month in GMT.
  42. beginningOfLastWeek() : Gets the date and time for the beginning of last week in GMT.
  43. beginningOfNextWeek() : Gets the date and time for the beginning of next week in GMT.
  44. beginningOfNextMonth() : Gets the date and time for the beginning of next month in GMT.
  45. beginningOfNextYear() : Gets the date and time for the beginning of next year in GMT.
  46. beginningOfThisMonth() : Gets the date and time for the beginning of this month in GMT.
  47. beginningOfThisQuarter() : Gets the date and time for the beginning of this quarter in GMT.
  48. beginningOfThisWeek() : Gets the date and time for the beginning of this week in GMT.
  49. beginningOfThisYear() : Gets the date and time for the beginning of this week in GMT.
  50. beginningOfToday() : Gets the date and time for the beginning of today in GMT.
  51. beginningOfYesterday() : Gets the date and time for the beginning of yesterday in GMT.
  52. calDateDiff(String, String, boolean) : Calculate the difference between two dates using the default calendar. Note: Calendars are now legacy.
  53. dateDiff(String, String, boolean) : Calculates the difference between two dates. The parameters must be in the user/system date time format.
  54. dateGenerate(String, String): Generates a date and time for the specified date in GMT.
  55. daysAgo(int) : Gets a date and time for a certain number of days ago. The result is expressed in GMT.
  56. daysAgoEnd(int) : Gets a date and time for end of the day a certain number of days ago.The result is expressed in GMT.
  57. daysAgoStart(int) : Gets a date and time for beginning of the day a certain number of days ago. The result is expressed in GMT.
  58. endOfLastMonth() : Gets the date and time for the end of last month in GMT.
  59. endOfNextYear() : Gets the date and time for the end of next year in GMT.
  60. endOfThisMonth() : Gets the date and time for the end of this month in GMT.
  61. lastWeek() : Date and time one week ago in GMT.
  62. minutesAgo(int) : Gets a date and time for a certain number of minutes ago.The result is expressed in GMT.
  63. minutesAgoEnd(int) : Gets a date and time for the end of the minute a certain number of minutes ago.The result is expressed in GMT.
  64. minutesAgoStart(int) : Gets a date and time for a certain number of minutes ago. The result is expressed in GMT.
  65. monthsAgo(int) : Gets a date and time for a certain number of months ago.The result is expressed in GMT.
  66. monthsAgoEnd(int) : Gets a date and time for the last day of the month a certain number of months ago.The result is expressed in GMT.
  67. monthsAgoStart(int) : Gets a date and time for the first day of the month a certain number of months ago.The result is expressed in GMT.
  68. now() : Gets the current date using GMT date time.
  69. nowNoTZ() : Gets the current GMT date time.
  70. nowDateTime() : Gets the current date and time in the user’s time zone.
  71. quartersAgo(int) : Gets a date and time for a certain number of quarters ago. The result is expressed in GMT.
  72. quartersAgoEnd(int) : Gets a date and time for the last day of the quarter a certain number of quarters ago. The result is expressed in GMT.
  73. quartersAgoStart(int) : Gets a date and time for the first day of the quarter a certain number of quarters ago. The result is expressed in GMT.
  74. yearsAgo(int) : Gets a date and time for a certain number of years ago.The result is expressed in GMT.
  75. yesterday() : Gets yesterday’s time. The result is expressed in GMT.
  76. isFirstDayOfMonth(Object) : Checks whether the date is the first day of the month.
  77. isFirstDayOfWeek(Object) : Checks whether the date is the first day of the week. This uses the ISO standard of Monday being the first day of the week.
  78. isFirstDayOfYear(Object) : Checks whether the date is the first day of the year
  79. isLastDayOfMonth(Object) : Checks whether the date is the last day of the month.
  80. isLastDayOfWeek(Object) : Checks whether the date is the last day of the week.
  81. isLastDayOfYear(Object) : Checks whether the date is the last day of the year.
image_pdfimage_print

Leave a reply

Your email address will not be published. Required fields are marked *


Newsletter
Training Enquiry