LogiUpSkill

How to get ServiceNow Instance

How to get ServiceNow Instance Step 1 :  Go to ServiceNow Developer Site  Open:  https://developer.servicenow.com  Visit Developer Portal :  Step 2 : Sign Up   Click on Sign Up   If you already have an account, click Log In   Fill in the required details and submit the form.    After Sign Up you will receive a message as shown below     Step 3 : Email Verification   You will receive a verification email   Click on the verification link   Once verified, click Login / Sign In   Step 4 : Initial Setup After Login   During login, you will be asked a few setup questions:   Select “Yes – I need a developer-oriented IDE” to access developer tools.   Click Next  Choose the relevant options (you may also select Other)   Accept the terms by checking the checkbox   Click Finish Setup  

Schedule Job

Schedule Job A Scheduled Job is a script that runs automatically at a defined time or interval to perform a specific task in ServiceNow. Why Do We Need Scheduled Jobs? Scheduled Jobs are used when: No user action is required A task must run daily, weekly, monthly, or at a specific time Data needs to be processed in the background Key Components of a Scheduled Job When you create a Scheduled Job, you configure: – Name Meaningful name describing the job – Run When the job should run: Daily Weekly Monthly Once Periodically (every X minutes/hours) – Script The logic that will execute automatically Scheduled Job Example Scenario:Automatically close incidents that are in Resolved state for more than 7 days. var gr = new GlideRecord(‘incident’);gr.addQuery(‘state’, ‘6’); // Resolvedgr.addEncodedQuery(‘sys_updated_on<=javascript:gs.daysAgoStart(7)’);gr.query(); while (gr.next()) {gr.state = ‘7’; // Closedgr.update();} Steps to Create Scheduled Job : Step 1: Navigate to Scheduled Jobs System Definition → Scheduled Jobs → New Step 2: Fill Basic Details Name: Daily Open Incident Reminder Run: Daily Time: 07:00:00 Active: true Step 3: Script (Example Code) Step 4: Email Notification Create an Email Notification: Table: Incident Event name:daily.open.incident.alert To: IT Manager Subject: Daily Open Incidents Older Than 3 Days Body: Hello Team, Below are the incidents open for more than 3 days: ${parm1} Regards,ServiceNow    Output Every morning at 7:00 AM: Scheduled Job runs Checks for old open incidents Sends one consolidated email to the IT Manager

Gsftsubmit

gsftsubmit In ServiceNow, forms often contain buttons like Update, Resolve, or Close.Behind many of these buttons, ServiceNow uses a function called gsftSubmit. gsftSubmit is a client-side JavaScript function used to submit a form and trigger a UI Action’s server-side logic. Why gsftSubmit? In ServiceNow, UI Actions can contain : – Client-side code – Server-side code But the server-side code will NOT run automatically when a button is clicked. To move execution from client → server, the form must be submitted.This is exactly what gsftSubmit does. Syntax of gsftSubmit  gsftSubmit(null, g_form.getFormElement(), ‘action_name’); Explanation of each parameter : 1. First Parameter – sysId null -Usually kept as null 2. Second Parameter – formElement g_form.getFormElement() -Represents the current form 3.Third Parameter – action_name ‘action_name’ – Must exactly match the Action name of the UI Action.  Example : Create UI Action Table: Incident Name: Resolve Incident Action name: resolve_incident Client: True  

ACL

ACL in Service-now Access Control List (ACL)  What is ACL? ACL is a list which allows the users to have different access like create, write, read, delete and etc to particulartable of the fields of table. Users with specified roles can only access the given operations like create, write, delete, read, execute. Scripts are used on the bases of condition for true and false. Only those users can give access to another users who have security administrator privilege. These are some operations used in ACL Create: – This operation enables user to create a new record in the table. Write:- This operation enables user to edit the existing record in the table Read: – This operation enables user to read the records in the table but not to edit. Delete: -This operation enables user to remove the existing records from the table. Execute:- This operation enables user to run the scripts on record or UI policies.  Types of ACL Record ACL              In Record ACL we need to satisfy the Field ACL and Table ACL. In this if ACL is applied to parent table then the ACL will             be automatically applied on the child table. Field ACL              In Field ACL we apply ACL to particular Fields so that the only those fields will be visible to the user. To make all fields visible             we need to select (*). Table ACL              In Table ACL we apply ACL on table so that the whole table will be visible to the user. Only the table will be visible but not the             records. Records will be visible if field ACL is also applied. To make whole table visible we need to select (*).   How to Create an ACL?  Example : – Create an ACL where following Conditions should meet. If state=In Progress then only ITIL role users can edit the state field. If state=Resolved then only Admin role users can edit the state fields. If state=closed and “current user” and the “User Name” are same then only user can edit the state field. If state=new, anyone can edit the field. If state=closed, all the fields for all the user should see as read-only.  Procedure to create ACL   I have created the table called User ACL now I am going to apply the ACL to this table. The first thing which you need to do is elevate the system_admin role. Then go to Navigation Bar and click ACL and select Access Control Once you reach to the above show page you will find that each table will be having inbuilt ACLs. If you want to makechanges on any particular table you can edit in the existing ACL itself by adding a role and writing the script for thatparticular operation. I have created a new ACL for this condition and written a code also and the condition is if stateis closed then all fields should be read-only to the users. The condition is if state is closed and the current user and username are same then only user can edit. For this conditionI have applied ACL to the state field and written code and in condition field I have given if state is closed so that it willwork when state is in closed. The condition is if the state is new anyone can edit this so I have written a ACL for only state field and given conditionas the state is new. The Condition is if the state is resolved only admin can edit it so I have created an ACL for edit the state field only withthe condition state is resolved. The condition is if the state is in progress then only ITIL user should edit it. So I have created an ACL with edit to thestate field only and given role as ITIL and condition as State is in progress. Created one additional ACL for read and write for the whole table without any user.   Output If state=In Progress then only ITIL role users can edit the state field. If state=Resolved then only Admin role users can edit the state fields. If state=closed and “current user” and the “User Name” are same then only user can edit the state field. If state=new, anyone can edit the field. If state=closed, all the fields for all the user should see as read-only. ACL Assignment Create a Table with one Auto number field.Create 2 sting field i.e. first name and last nameCreate State field with following values      1.New     2.In Progress     3.Resolved     4.Closed Create one reference field if user as User Name Requirements:      1. if state=In Progress then only ITIL role user’s can edit the state field.      2. if state=Resolved then only Admin role user’s can edit the state fields.      3. if state=closed and “current user” and the “User Name” are same then only user can edit the state field.      4. if state=new, any one can edit the field.      5. if state=closed, all the fields for all the user should see as readonly. (except the req 3)