LogiUpSkill

Import data from MySQL into Service-now

Import data from MySQL into Service-now Mid Server To import data from My SQL server into service now we can use MID Server and Data source. MID Server is required when we need to access on premises data(i.e when machine/any server is in Virtual Private Network) Mid Server is a Java application, through which Service-now can communicate with external applications which are running in Clients VPN i.e. Virtual Private Network. Mid Server need to install in Clients Network to get or send data to Clients tool which are in their VPN. We used MID server here because client MySQL server is in VPN, so installed the mid server in client VPN and same mid server we are using in data source. ECC Queue – Mid Server talks with service now using ECC (External Communication Channel). Mid Server Script Include: Mid Server Script Include, are the script, which we will execute on Mid Server For example 1. If we need to connect with jira tool which is in VPN to create a ticket in JIRA and update the response which we are getting from jira into service-now ticket. 2. We need to create a Mid Server script include(Java code) , which will run on the Mid server, which will call the jira web service to create a ticket and take the response and the same response will send to service now table as an update by calling service now web service. 3. After creating mid server script include, we need to create a record into ecc queue against the specific mid server so that script will execute on that specific mid server. Mid Server Installation Steps – Download mid server from service now instance from left navigation menu. Create one folder(“MeghanaMidServer “) in C drive and extract the downloaded ZIP (MID Server setup) in this folder. Open “config.xml” file and configure ServiceNow instance details along with newly created user with “mid_server” role and mentioned MID server name as “MeghanaMidServer”(This name will appear in ServiceNow once we done with setting and mid server started). Once done with all configurations start midserver by running start.bat file Once the above configurations and observations are fine, and then check in whether our mid server is appearing and with status “UP” or not. Go to service now instance->MID Server->Server = MeghanaMidServer check its status and validate it(Validation means service now instance version and mid server instance is same).   Datasource Create New Data Source:     Name – Name of data source Import set table label – Provide any label for import set Import set table name – New import set will be created with this name   Type – Select type of data source (JDBC,FILE,LDAP etc) File JDBC LDAP OIDC Use MID Server  – Specify name of the mid server to which we need to connect from service-now MeghanaMidServer     Install XAMPP server on your machine. Start MySQL server – it will list port number.   Format – Specify data source format(MySQL,Oracle, SQL Server) — None — MySQL Oracle SQLServer Database name – Create database in any db server(Created in MySQL server) and specify that db name here Database port – Use db port number shown on XAMPP control panel against MySQL Discover moreSQL servermy sqlComputerClientSQLServerclientMicrosoft SQL ServerapplicationMySQLdatabase   Username  – Specify MySQL server user name and password Password   Open link –  http://localhost/phpmyadmin/ It will show you local host server address, use that address here.   Server   Query – It will query on table in such a way that it will return all rows from table, or we can write specific SQL (Select required fields or add filter conditions) All Rows from Table Specific SQL Table name – This table should be present in database. Import Set Click on Load All Records – It will load all the records from specified table(book) into import set(u_myimportset).   Verify data in import set from left navigation. Transform Map – To dump/ transform import set data into table, we need to create target table first. Create new table(book) from left navigation. add required fields (id,title,author) those are in MySQL db table. From left navigation go to transform map Name – Specify name for new transform map Source table – Select import set — None — Computer [imp_computer] Import Incident [u_import_incident] Location [imp_location] MyDataSource [u_myimportset] Notification [imp_notification] User [imp_user] Target table – Select table book in which we need to insert data Discover moredatabaseApplication softwarecomputerDatabaseSQLServerclientdbSQLmy sqlComputer Filed Mapping – Perform mapping of import set filed with actual table Click on transform – check the data is loaded in book table. here we are manually transforming import set data into table. but to automate this task we can use schedule job. Schedule Job : Go to your data source from left navigation -> configure-> Related list-> add  Scheduled Data imports   By selecting Run = Daily, This will transform data daily from data source into import set table.   Source Script – Open filed map – > select any filed Click on Use source script checkbox -> it will allow you to run any script on this filed, before inserting data into target table. In following example script, we are adding PR as prefix  to the title. Execute schedule job to load newly added data from my sql table to target table Check Prefix PR is added in title  

Practice Examples in Service-now

Practice Examples in Service-now Practice Examples from Shala Master Scenario1:-Cancel the incident form submission if user has typed “Credit Card” in short description.(User OnSubmit Client Script) function onSubmit() {    //Type appropriate comment here, and begin script below     var desc = g_form.getValue(‘short_description’).indexOf(“Credit Card”) > -1;     if ((desc == true)) {                         alert(“Please remove the word ‘Credit Card’ from your short description to Submit the form”);                         return false; }      } Scenario2:-User should not insert or update the incident record if user has entered “password” inwork notes or comments. (function executeRule(current, previous /*null when async*/) {             // Add your code here             var worknote = current.work_notes.getJournalEntry(1);     var worknoteContent = worknote.split(“(Work notes)n”);     var lastWorknote = worknoteContent[1];     var comment = current.comments.getJournalEntry(1);     var commentContent = comment.split(“(Additional comments)n”);     var lastComment = commentContent[1];             if(lastWorknote.indexOf(“password”)>-1){                         current.setAbortAction(true);             }             if(lastComment.indexOf(“password”)>-1){                         current.setAbortAction(true);             } })(current, previous); Scenario3:-Show AddINFO message “Caller and Assigned to are same” if caller and assinged tousers are same. (function executeRule(current, previous /*null when async*/ ) {     // Add your code here     if (current.assigned_to.name == current.caller_id.name) {         gs.addInfoMessage(“The caller and assigned to should not be same”);     } })(current, previous); Scenario4:-Show alert “Manager are same for Caller and Assinged to User” if the caller’s managerand assigned to user’s manager are same for incident. function onSubmit() {     //Type appropriate comment here, and begin script below     var cman = g_form.getReference(“caller_id”).manager;     var aman = g_form.getReference(“assigned_to”).manager;     if (cman == aman) {         alert(“Manager are same for caller and assigned to user”);     } } Scenario 5:-User should not select a user for assinged to field for incident record if user does nothave email id. function onChange(control, oldValue, newValue, isLoading, isTemplate) {     if (isLoading || newValue === ”) {         return;     }     var email = g_form.getReference(“assigned_to”).email;     if (email == “”) {         alert(“You cannot select user that does not have an email id”);                                 g_form.clearValue(“assigned_to”);     }     //Type appropriate comment here, and begin script below } Scenario6:-Make state readonly if loggedin user and caller are same on incident form. function onChange(control, oldValue, newValue, isLoading, isTemplate) {     if (isLoading || newValue === ”) {         return;     }     var user = g_user.firstName + ” ” + g_user.lastName;     var caller = g_form.getReference(“caller_id”).name;     if (user == caller) {         g_form.setReadOnly(“state”, true);     }     //Type appropriate comment here, and begin script below } Scenario7:-Make state readonly if state=New on incident form. Using UI Policy Scenario8:-Set Assinged to= Pavan if category=Network. function onChange(control, oldValue, newValue, isLoading, isTemplate) {     if (isLoading || newValue === ”) {         return;     }     if (newValue==”network”) {        g_form.setValue(“assigned_to”,”Pavan”);     }     //Type appropriate comment here, and begin script below } Scenario 9:-Show alert if the state changed from Resolved to In Progress. function onChange(control, oldValue, newValue, isLoading, isTemplate) {     if (isLoading || newValue === ”) {         return;     }     if (oldValue == 6 && newValue == 2) {         alert(“The state has now changed from Resolved to In Progress.”);     }     //Type appropriate comment here, and begin script below } Scenario10:-Whenever caller changed the comment field for incident set state=In Porogress. function onChange(control, oldValue, newValue, isLoading, isTemplate) {     if (isLoading || newValue === ”) {         return;     }     var user = (g_user.firstName);     var caller = g_form.getReference(“caller_id”).first_name;     if (user == caller) {         g_form.setValue(“state”,2);     }     //Type appropriate comment here, and begin script below } Scenario 11:User should not change the state from Resolved to In Progress without putting commenton incident form. function onChange(control, oldValue, newValue, isLoading, isTemplate) {     if (isLoading || newValue === ”) {         return;     }     if (oldValue != 6 ;& newValue != 2)         return;     g_form.setMandatory(‘comments’, true); } Scenario 12:-  Show Comment and worknote value in AddINFO message after insert or update ofincident record. (function executeRule(current, previous /*null when async*/ ) {     // Add your code here     var worknote = current.work_notes.getJournalEntry(1);     var worknoteContent = worknote.split(“(Work notes)n”);     var lastWorknote = worknoteContent[1];     var comment = current.comments.getJournalEntry(1);     var commentContent = comment.split(“(Additional comments)n”);     var lastComment = commentContent[1];     gs.addInfoMessage(“The additional comments are: ” + lastComment + ” <br/><br/>The Work Notes are: ” + lastWorknote); })(current, previous); Scenario13:-Caller user should not have access to Assignment group and Assigned to field onincident form. If user is caller is logged in user he will have assignment group and assigned to as read only function onChange(control, oldValue, newValue, isLoading, isTemplate) {     if (isLoading || newValue === ”) {         return;     }     var user = (g_user.firstName);     var caller = g_form.getReference(“caller_id”).first_name;     if (user == caller) {         g_form.setReadOnly(“assigned_to”, true);         g_form.setReadOnly(“assignment_group”, true);     } } Scenario 14:- User should see “xxx-xxx-xxxx” in short description on form whenever short descriptioncontains mobile number. function onSubmit() {     //Type appropriate comment here, and begin script below     var value = g_form.getValue(“short_description”);     var re = /^[0-9]{10}$/;     if (!re.test(value)) {         g_form.setValue(‘short_description’, ‘ xxx-xxx-xxxx’);         //         var res = value.replace(re, “xxx-xxx-xxxx”);         //         g_form.setValue(“short_description”, res);     } Scenario 15:- User should not submit the incident form without setting short description anddescription field values. Set the short description and description as mandatory fields. Scenario16:-Show alert if current loggedin user is member of particular group (Database). Display Business Rule (function executeRule(current, previous /*null when async*/ ) {     // Add your code here     // var groupID = current.assignment_group;     var groupName = “Database”;     var userID = gs.getUserID();     var gr = new GlideRecord(“sys_user_grmember”);     gr.addQuery(“group.name”, groupName);     gr.addQuery(“user”, userID);     gr.query();     if (gr.next()) {         g_scratchpad.grp = true} })(current, previous); On load Client Script function onLoad() {     //Type appropriate comment here, and begin script below     if (g_scratchpad.grp == true) {         alert(“The user is part of the Database group”);     } else {         alert(“The user is not part of the Database group”);     } } And since the System administrator

Update Sets in Service-now

Update Sets in Service-now Update Sets 1. Update sets are used to capture the configuration data of a table. Update sets can be used to migrate the configuration data that has been done from one instance to another instance (example: from developer instance to test instance).   Configuration Data- Creating tables, fields, business rules, client scripts, choices etc. Normally we will consider the data in system tables, we consider as a configuration data.Normal Data: Creating records in incident, problem, user tables. Update_Synch table attribute 2. The tables for which UPDATE SYNCH attribute value will be true only for those tables the configuration data will be captured. 3. Since XML import and export can be used to migrate only one entry at a time, hence we use update sets which are capable of migrating the configuration records of multiple table at same time. 4. To create update setsGo to navigation -> update sets -> local update set -> new  Difference between Submit and Submit and make current: If we want to create the update set we can use the submit button but if we use submit and make current that update set will be created and will be made current i.e it will capture the modifications from that point of time.  Retrieved Update set: To obtain the captured information from other users update sets we can use this option. Steps: -> Go to update source in navigation search -> New -> Enter the values in fields – >Name: Other users update set name. – >URL: other users URL – >Username and Password: Other User’s credentials  Preview update set : To check whether the update set have been retried successfully or not.If successfully retrieved we can commit the changes and if there are any other errors it has to be rectified before the commit option can be used. …………………………………………………………………………………………………………………………………………….. Customer are not able to add the update_synch attribute on custom table, seems like user need to contact Servicenow only.

ServiceNow Entity

ServiceNow GRC Entity 1.  Introduction: An Entity is a “person, place, object, or thing” that is tracked for risk, compliance, and audit purposes. Entities act as the fundamental building blocks for GRC activities, and they represent the specific components within an organization that are subject to controls and policies.  Examples: Examples of entities include business applications, departments, locations, or even specific IT assets like a server or a database. 2.  Roles Required: To create and manage entities, the following ServiceNow GRC Roles are required: User role Description sn_grc_ent_access.admin Role that is part of the Entity Based Access application. Assign this role to users who need to enable or disable the Entity based access on record types related to entity property and configure Entity Based Access. sn_grc_ent_access.reader Role that is part of the Entity Based Access application. Assign this role to users who require read access to the Entity Based Access configuration. sn_grc_ent_access.bulk_access_config_admin Role that is part of the Entity Based Access application. Assign this role to users who need write and update access to the bulk access update configuration. sn_grc_ent_access.bulk_access_config_reader Role that is part of the Entity Based Access application. Assign this role to users who require read access to the bulk access update configuration. sn_grc.eba_restriction_field_editor Role that is part of the Entity Based Access application. Assign this role to users who require write and update access to the Entity based access restriction field on issue records.     3.  Entity Framework Architecture This diagram shows how the GRC Entity Framework organizes business components in a clear structure. Entity Classes set the blueprint, rules, and structure for entities. Each entity has a level in the Entity Tier or Dependency Model, which shows where it fits in the organization. Entities are the real examples created from these classes, like a business unit or department. Entity Type defines the role of each entity, and the Entity Filter helps group or select entities based on their attributes. Together, these parts make it easy to manage and organize all entities in the system. 4.     Entity Types and Filters Entities that belong to more than one Entity Type are linked to all relevant types automatically without creating duplicates. Entity Types: These are the top-level categories used to organize entities in ServiceNow. Examples include: Regions Departments Applications Business Units ServiceNow TablesEach Entity Type is linked to a ServiceNow table that stores its records: Regions → Regions table Departments → Department table Applications → Business Applications table Business Units → Business Unit table EntitiesEntities are the actual records created from these tables. Examples: Regions: EMEA, APAC, AMERICAS Departments: Finance, Sales, Marketing Applications: ServiceNow, SAP Finance, MS Office Business Units: Finance BU, Sales BU, Marketing BU, HR BU In above diagram the Content is: Entity Type: Finance DepartmentsTable: DepartmentFilter Condition: Parent is Finance This selects only departments under Finance and creates entities such as Tax, Payroll, Accounts, and Revenue. These entities help manage business activities focused on Finance departments. 5.  Example: We want to create a Business Unit Entity for the Finance – Accounts Payable Department in ServiceNow GRC. Step 1: Go to Entity Type- Navigate to Entity type Entity:  A distinct, unique object or concept in the real world about which information is stored and managed. Examples include a specific person, a particular product, or a unique organization. In a database context, an entity often corresponds to a row in a table. Step 2: Select Entity Type- Entity Type:  A classification or category that defines the common characteristics, attributes, and behavior of a group of entities. It acts as a blueprint or template for individual entities. For instance, “Person,” “Product,” or “Organization” would be entity types, and specific individuals, products, or organizations would be instances (entities) of those types. Field Description Name Name of the entity type. Active Option to set the entity type as active. Compliance score (%) Compliance score of the entity type. The value is a percentage. This field is automatically set. Description Description of the entity type.         Save. Step 3: Apply Entity Filter- Entity Filter:  The Entity filters tab displays the following information: Entity filter type: Entity filter type such as Build your own conditions or select from predefined queries. Table: Table that contains the records to be queried, such as sn_audit_advanced_auditable_unit. Filter condition: Filter conditions for the source table to generate entities. Use owner field: Use the default owner to assign risks to a single user when the owner field is empty. Owner field: Person who owns any new entities generated from the entity type. Identify the user reference field on the source table to automatically identify risk and control owners. Click on New: Put filter conditions here After that click on Assignments and give fill all Mandatory Information: Assignments:  This refers to the process of associating entities with their respective entity types and entity classes, often facilitated by entity filters and rules. This assignment ensures that entities are correctly categorized and linked to relevant GRC policies, controls, and risk assessments. Step 4: Assign Entity Class- Entity Class:  Similar to an entity type, an entity class represents a collection of entities that share the same attributes and confirm to a defined structure. It can also refer to a programming construct (like a class in object-oriented programming) that models the structure and behavior of an entity within a system, often mapping to a database table. Step 5: Fill Mandatory Fields- Mandatory Field Empty Owner: Default Owner: The person or team who automatically owns the record when it is created. Do Not Create: Stops the record from being made if something is missing or not correct. Save. Click on Update Entities from Filters to automatically create entities based on the filter conditions. Step 6: Auto-Create Entities (If Using Filter)- 6.  Conclusion: Auto-creating entities with filter conditions make the process faster and reduces manual work. The filter selects all matching records, and the system creates the entities automatically, ensuring accuracy and consistency. This helps keep your GRC entity structure clean, organized, and up to date.