LogiUpSkill

Custom Scoped Application 

Custom Scoped Application   Overview    Application scoping protects applications by identifying and restricting access to application files and data. This document walks through the key operations for creating and managing custom scoped applications in ServiceNow.    Navigate and search for in ServiceNow Studio  Click on Create Application UI action.  Provide Name and in the advanced setting select scoped.  Provide required roles.  Give the table name.  Another way click on CREATE NEW TABLE     We can create new table which is extended from task  If we select from list we can create the table from here  Another way click on CREATE NEW TABLE   Navigate to studio and click on create new.  Select table from the data model.  Goto scope=list view  Goto Data model ⇒ table   Configure related list  Since table extended from task so it is always we need to edit in GLOBAL scope  Open assigned to field.   You will see the field which is extended from the task table.  Goto file and click on create file .  See my table and other table     create=form which table you want this form   After creating ⇒ see form design    We know there are two ways to configure a form .   a.form design   b.form layout   Do changes as per your requirement  Also verify after you apply those changes.  You will see the form which we have designed.   We can create module for that purpose search for application menu on the navigation pane.  On the related list click on New ui action.  Make sure your module is in the global scope.  You are able to create module in global scope because of application access =All application scope     Now GOTO è module  work_assignment è Configureè Table  You will see it is accessible from All application scope only.  Now change to this application scope.  Changed scope to global.  Open application.  And Create module.  You will see there are no matched found.  Next, create script include in Global application.  Check in Background script  Output  You will see your script include with same scope.  Check in Background script-same scope.  Output  Also, Check in global scope.  Output  Open the application.  See From here we can publish in update set  Scoped application caller tracking and caller restricted    caller tracking –After calling script then get access, it will track data.  caller restricted- After calling script then restricted   Application -work assignment, caller restricted Associable from=all application scope  SCRIPT INCLUDE created in work_assignment application and now we will write background script on Advanced work_assignment.  Function is caller restricted.  Output  To remove restricted access.  Goto =application  Application administration = true.    In the Related section you will see restricted caller access privileges    Now check in advanced work_assignment scope   Output  Create 2nd script include  Application scope should be –work_assignment.  Caller Access -caller tracking.     And accessible from=all application scope.  You will see the scope is advanced work_assignment in background script.  Output  Navigate and type sys_scope_privilege.LIST  Custom Application Form fields   Field name   Type  Description  Name  String  The display field for the package  Version  String  Identifies the latest version of the package in dot decimal notation  Scope   String Read only  Identifies unique application scope   [x_companyCode_shortAppID]  See properties   Glide.appcreator.company.code  Application administration  Boolean  When checked system administration will be preventing from accessing the application  Can Edit Application in Studio     Boolean  Allow user to edit application file in studio  Run time access tracking   Choice    a. Tracking log-access the system and allows script to execute   b.Enforcing log – access the request but required administration authorization before script executation proceed   Script interaction with other application is controlled by the system runtime access system        Use Runtime Access Tracking to manage script access to resources from other applications        Restrict Table Choices  Boolean  Restrict design time access to table outside application scope   Licensable   Boolean  Licensable or not   Subscription requirement  Choice     a.Monitor   b.Required   Subscription requirement for usage of this package   Subscription model   Choices     a.NA  b.fulfiller /requestor  c.procedure  d.capacity   e.mixed  f.Application in use   Subscription model is defined here    Subscription  Reference   Refer to license_details  Menu  Reference  Refer to sys_app_application  This application primary menu where default table module will reside   User role  Reference  Refer to  sys_user_role  Role required for end user to access this application and its table  Short description  string  Short description for application  logo  User_image  Logo for application  Guided Setup   Reference     Refer to   gsw_content  Guided Setup to start when to application is installed/upgraded      Related links Manage Collaborators  Collaboration descriptors let you assign, manage, and monitor permissions for each application or across multiple applications consistently  Collaborators -a person who works together with others for a special purpose  Navigate and search for collaborators.  Related link -click on manage collaborator.  See user can do following thing Move restricted to tracking  It will simply just move Whatever configuration we have done on custom scoped application restricted to tracking    Move tracking to restricted  It will simply just move Whatever configuration we have done on custom scoped application tracking to restricted   View License Definitions  It will redirect to sys_app_license_defn_list  Publish to Update Set  Publishes all the code from an app to a newly created updated set that can be used to transfer the  app between instance.  Grant app administration to all admins  Grand a role that are required for the admins to be able to grand any of the applications role  Enable Session Debug  Scan Application  Convert to Application Repository Mode    When your applications are placed in the Custom Applications table [sys_app], you can’t upgrade them directly through the Application Repository. This procedure helps you do a one-time conversion when you want to migrate deploying your applications using the Application Repository.  After you convert the application, it is no longer enabled for development on the instance where the conversion is performed. For a scoped custom application, all associated records in the Customer Updates table are deleted for this application.  After this see application  Resync Collaboration Permissions  Refresh delegated development permission for collaborators 

Import Set & Transform Map (Category & Subcategory) 

Import Set & Transform Map (Category & Subcategory) Problem Statement: – While importing a data from excel into ServiceNow if you have choice fields, like (category) & (subcategory) then it should get imported.      Steps:  First step is we need to load data in our case its incident data I have exported and download it.  Then navigate to Load Data. Under system import set you will see the Load Data Module.  Then, we need to create import set table which is nothing but our staging table which will store the data temporary.  You can select staging table if it has already created by click on ‘Existing Table’ or you can create new staging table by selecting the ‘Create Table’.  Also, you need to select the source of the import, which is nothing, but you excel file e.g. Incident1.xlsx.  Create Table-> Provide Label Name->Source of the import-> choose your excel file-> Click on Submit  Now you will see the status as complete. Next, we need create a transform map. Click on ‘Create Transform Map’.  Provide name, your target table. If you want to auto map the fields, select ‘Auto Map matching fields’ by using mapping assist you can manually map the fields. Click on save.  We will select the auto map matching fields related link. Our fields are maps successfully.  Now we need to set the coalesce field to avoid the duplicate record. Here we will provide the coalesce field to our number field.  Also, we need to create the choice action for our category file. Based on the requirement.  Choice Action: – This field specify what to do if the import set contains reference field or choice value.  Create: – Create a new choice or record in the reference table.  Ignore: – Ignore the new value from the source table  Reject: – The entire row(record) containing the new value and continue to the next row.    Click on transform related link to transform the data from excel to servicenow.  You will see the status and the message of your transform map.  Creation of new choices in the category table you need to select the choice action as create.  Next step we need to add the new choice in our excel sheet.As, you can see in the excel file we have added the new choice field called ‘Manufacture’   Now we need to select ‘Choice Action’ as ‘Create’ To create a new choice.  Click on transform related link to create ‘transform’. Your date will be loaded into service now and new choice will be added successfully.  Whenever we select category as ‘Manufacture’ then automatically subcategory should get populated.  For this navigate to ‘incident’ table. Right click on the subcategory and select ‘Show choice list’.  We need to add the dependant value for the subcategory as you know subcategory is dependent on the category.  After that we need to load data in our ‘sys_choice’ table’ Follow the previous steps to perform import set and transform map. Load the data and create transform map.  Click on auto map matching field to map the fields. Click on transform.  After transforming open the incident record select category as Manufacture you will see the ‘DNS, Operating System and VPN. 

Glide Aggregate

                                   Glide Aggregate It is a server-side ServiceNow API, used to perform aggregate operations like COUNT, SUM, AVG, MIN, and MAX on table records without retrieving full record data  Methods of Glide Aggregate -:  addAggregate(aggregate, fieldname)-> Adds an aggregate function like COUNT, SUM, AVG, MIN, MAX on a given field.  GroupBy-> Groups the records based on the supplied field.  Order By-> Sorts the result in ascending order.  OrderByDesc-> Sorts the result in descending order by the given field.  query()-> Executes the database query.  next ().-> Moves to the next aggregated record.  GetAggregate.-> Gives you the final calculated answer (like total count or total sum).   GetValue.-> Gives you the value stored in a field for that record.   addEncodedQuery(query String)- -> Adds a ready-made filter to get only the records you want.   setGroup(Boolean)-> Tells the system to group similar records together.   SetHavingCondition-> Filters the grouped results based on total/count/sum values.   SetLimit.-> Tells the system to return only a limited number of records.  Example -:    1). Using GlideAggregate in ServiceNow, how many incidents are grouped by category?  Output -:  2. To find number of incidents active true  Output -: 

UI Action

                                 UI Action  A UI Action is a feature used to provide buttons, links or context menu items on forms and lists. The actions enable users to update records, call workflows, run scripts, or navigate to another page.  Some Examples of UI Actions:  Submit   Approve / Reject   Close Incident   Assign to Me   Create Change Request  Example-:  Add a “Mark as VIP” button on the User form to set up a custom VIP flag.  Step 1: Navigate on Sys_User table and right click on Navigation Bar –> Configure–> UI Action  Step 2: Click on New then Add Name for New Action (Mark as VIP) –>Add table on Which we have to add UI Action (Sys_users) –> Action Name (mark_vip)  Step 3: Click on Checkbox where you have to add a Button on form or List. Step 4: Add Script for Button, add Condition and Write a Script. Step 5: Go on Users Form, open one User in Navigation bar there “Mark as VIP” Step 6: Click on “Mark as VIP” Then That user will be mark as VIP, Automatic VIP Checkbox will fill.  Context Menu in UI Action The Context Menu in a UI Action is the menu that appears when you right-click on a record in ServiceNow. Instead of showing a button on the screen, the action stays hidden until the user right-clicks.  Why use the Context Menu?  Keeps the screen clean  Hides less-used actions  Provides quick access when needed  Creating Context Menu in Form & List -:   Add Name & Click on Form & List Context Menu Check box. 

Email Notification using Flow Designer

Email Notification using Flow Design Notification: A Notification in ServiceNow is used to automatically send messages (Email, SMS, Push) to users when a specific event or condition occurs.  Create Catalog & In Catalog Create Catalog item, For Requesting anything. Example [Work from Home.]  Add Variables in Catalog Items & Save it.               Employee Name               Address               Manager. This is Where we can Request anything like (Work from Home, etc.)  Creating Flow Design for Requesting Work from Home Application to the Manager & getting Response from Manager.  In Flow create Add actions, Create Emails for Request & Approval  Search Get Catalog variable from Action from Flow design.  In this Send Email action has been taken, and by this Request WFH email will go to Manager.    Ask For Approval – Approval must take from group of Manager.  If WFH is Approved from Manager, then Email will send to Employee or Requester.  If WFH will Rejected, then Email will go to employee or Requestor of Rejected Request.  Open Catalog Item Which was Created & Add Request for Work from Home  After Requested, there will be Request Number will be Generate. Click on that. It will Request Form  In Request Form there will be RITM click on that there will show Approves, in this there will Name of Approval Person   Results-:   The manager will receive an Email Notification that the WFH request is there.  When Manager will Approve or Reject that Request then the Mail will get to Employee that Request is Approve or Reject 

Concept of Inheritance in Service-now

Concept of Inheritance in Service-now Assignment 1- Concept of Inheritance in tables Parent_table Child_table 1 Child_table 2 While creating Parent_table, check the box : Enable extension under control section in the create table window.              Create fields in Parent_table as: P_first_name P_last_name P_phone_no  Create Child_table 1 by extending Parent_table as shown in the screenshot below.              In Child_table 1, create fields as: C1_first_name C1_last_name C1_phone_no Similarly create table Child_table2 extending Parent_table.  While creating fields in both Child_table 1 and Child_Table 2, it is seen that fields present in Parent_table is present in the 2 child tables. So the fields created in parent table reflects across all it’s child tables.  In Child_table2,create fields as: C2_first_name C2_last_name C2_phone_no Now , the relationship is created in such a way that Parent_table is the parent of both Child_table 1 and Child_table 2. This can be verified by searching for the parent table in the navigation bar Then click on Show Schema Map. The Schema for Parent_table is shown below: Create new records in all 3 tables and observe the records that are reflected between parent/child table.  Step1: In the above2 screenshots, we can see that  records added in Parent table are not seen in the Child_table 1 .The same is true with Child_table 2 also. Step 2:  A new record in Child_table 1 is created in the above screenshot.  When the Parent_table is checked, it is seen that the record created in Child_Table 1 is visible. So the data/ records in child table is reflected in parent table as well.  Step 3:  A new Record is created in Child_table2  It is observed that the new record from Child_table 2 is visible in Parent_table also.   It is finally seen that the fields are reflected from parent to child table, but the data/records are not. Also the data/records created in child table reflect in parent table but not the fields alone In summary, Fields/customization flows downwards and data/records flow upwards in Parent-Child Relationship. Concept of Inheritance in tables  When inheritance is established between two tables, the customization flows from parent table to the child table but the records/data flows from the child table to the parent table. Example: If two tables A and B are created such that B is a child of table A, then the fields created in table A are reflected in table B but records created in table A are not reflected in B.On the other hand, the records created in table B are reflected in it’s parent Table (A) but not the fields. While creating a UI Policy for a particular table, the same UI policy can be applied to it’s child table as well. This can be done by checking the ‘inherit’ checkbox while creating the UI Policy for that table.

Inbound Email Action in Servicenow

Inbound Email Action in Servicenow INBOUND EMAIL ACTION SCRIPTING   Requirement: Creating incidents for every single email attachment through inbound action.    Components Used: Inbound Action on Incident Table ‘sys_email_attachment’ Table ‘sys_attachment’ Table    Script for Inbound Email Action: (function runAction(/*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {                 // Implement email action here               var emailSysId = sys_email.getUniqueValue(); // sys_id of email log record var qq=”email=”+emailSysId; //query to fire on sys_email_attachment table       var i=0;   gs.log(“Email sys_id is: ” + emailSysId, “EMAILSCRIPT”);                   var   gr = new GlideRecord(‘sys_email_attachment’);           gr.addEncodedQuery(qq);           gr.orderByDesc(‘sys_created_on’);           gr.query();           while(gr.next()){                                                          var gr1=new GlideRecord(“incident”);                                             gr1.short_description=”Attachment number”+i;  //Hardcoded short description                                             var t=gr1.insert();                                              i++;                                    var attachment = new GlideRecord(‘sys_attachment’);                              attachment.get(gr.attachment);                              attachment.table_name =”incident”;                              attachment.table_sys_id = t;                              attachment.update();          }   })(current, event, email, logger, classifier);

Workflow

Sub – Workflow Workflow is series of activities that follows execution path. An Activity is a collection of instructions that can include script, logging, approvals, record processing, timers, wait time, rollback activity etc. To create a workflow we need to go for workflow editor and we can drag and drop required activity in workflow. We can also drag and drop any other workflow in current workflow. We can create scratchpad variable to pass values from one activity to another. If we are using If activity then we can specify condition as follows- Following is the main workflow and we have added one sub workflow in main workflow. Sub Workflow- To send data from main workflow to sub workflow we need to create one input variable in sub workflow to hold value coming from main workflow as follows- We can specify input filed name, type, length etc as follows- Create scratchpad variable in main workflow Set value coming from main workflow to input variable Trainer Course To access value coming in input variable assign it to some other filed like short description To test this run the catalog item. Add Trainer name as Meghana. then automatically data present is scratchpad variable will be passed to sub workflow. After providing approval, check the workflow. short description should hold data coming from main workflow i.e. Service Now.   To send data back from sub workflow to main workflow we need to create scratchpad variable in sub workflow as follows – Then need to create return activity as follows and specify scratchpad variable as ${workflow.scratchpad.cost} Now go to main workflow and set map return value to as follows-   Then assign the value coming from sub workflow to description filed as follows, Main Workflow- Sub Workflow – Result- Incident Workflow Assignment Create Following Group’s 1.Email Group2.Phone Group3.Self Group4.Walk_in Group Create new state for Incident state field i.e. Waiting for Approval Incident Workflow         |         | Wait till the asigned to field should get value         |set state=Waiting for Approval         |         |Go for the approval according to Contact Type 1.Email ——Email Group2.Phone ——Group3.Self ——–Group4.Walk_in ——Group Any approval reject, it will go to run script activity where we should change the state=Canceled and then end the workflowAfter Approval         |         |         |Another approval should get trigger to Incident’s Caller’s ManagerIF the it reject , it will roll back to again the previous group approvalAfter approval it will go further         |         |         |Change the state=In Progress         |         |         |After this there should be 2 parallel process.1. if user canceled or closed the incident,then the workflow should end.2. if user changed the priority then put comments as “Priority changed” and go to Activity of Caller’s Manager Approval. but this priority changes can be done 2 times, if user is trying to do it for 3 times, then change the state=resolvedand end the workflow. Incident Form Field Task 1.Contact type field should have default value=Self Service2.User should not change the contact type field value once he submit the form3.User should not submit the form without categoy and subcategory field values Branch and Join        Branch flow Activity: The Branch activity is used to run the two activities parallel. The Branchactivity splits the workflow into multiple transition paths from a single activity. To add a transition path, select and drag the Branchactivity into the canvas. Then you can see the Branch activityproperties form displays, enter the branch name and click Submit to add the activity to the canvas, then click AddCondition. All transitions from this activity execute concurrently. This activity provides a single Always You can execute any number of transitions from this condition. Branching can affect the behavior of rollback activities.              Join flow Activity: The Join activity combines multiple execution paths into one transition path. To add Join to the canvas, Drag the join into the canvas and enter the name of join in the properties screenand click Submit. Use this activity for a workflow to wait for all activities in multiple paths to finish before it continuing. If multiple concurrentworkflow paths meet without a join activity, any subsequent activities execute two times. Connect incoming transitions from each activity you want to act as a predecessor to the Join activity. There will be two exit condition for the outgoing transitions: Complete and Incomplete. Complete: Joinexits along the Complete path when the system has determined that all predecessor activities havecompleted and transitioned to the Join. Incomplete: Joinexits along the Incomplete path when the system determines that at least one predecessor activitycompleted but transitioned along a path that bypassed the Join              Example: We have to set values for short description and description parallel when the wait for condition is true ->For that weuse Branch to run the two activity concurrently. We have to join two activity for approval user and approval group is approved then both condition satisfy it go toend -> For that we use Join to join that two activities.              Create Branch              Setting the values parallel for branch              Create approval user and group for join the activities              Create Join for two activities are approval user and approval group              Workflow for join and branch:              Output:              Branch output set the values for short description and description              Join output:              Once the user and group are approved the join go to end              Incomplete Join:              Usecase1:              If both approval user and approval group are approved then it show as complete. If approval user is approved and approval              group is rejected then it go as incomplete state.                Output for incomplete join:              Reject the approval for approval group and approved the approval user              Now it is in incomplete state then it go to end              If it is both are approved then it make as complete and go to end:              Usecase2:              If approval user is approved and approval group is rejected then it go incomplete then rollback condition