Tuesday, May 26, 2015

How to mark fields as Mandatory on any form in Service Now ?


This blog explains about how to mark specific fields as mandatory on any form in service now ?

Scenario : I want to mark 'First Name' field as mandatory on a form, that means without entering the value for 'First Name' field and user tries to submit the form, should display required validation message

Steps to accomplish


- We can achieve this by writing UI Policies on a form.

- Launch the form where you want to to write the UI Policies

- Right click on form banner menu -> Personalize -> All -> Click on 'UI Policies' tab -> Click on New

- If it is 'Eureka' version, click on 'Default' link

- Choose the table name

- Click on 'New' on 'UI Policy Actions' section as highlighted below.

- Select the field name, and set 'true' to mandatory column.

- Save , launch the form, you will notice '*' symbol for mandatory fields.





How to invoke a client script by clicking on 'Submit' or onChange actions



This blog explains about how to invoke a Client script by clicking on 'Submit' button.

Scenario : For example, there are two date fields on the form, by clicking on 'Submit' button, validate date 1 must be before date 2. Perform this validation by clicking on 'Submit' button.

- Launch the form where you want to write the client script

- Right click on 'Form Header' -> Personalize -> All

- click on 'client Scripts' section

- Click on 'New'

- Below is how client script looks like




-  If you want to write invoke client script whenever any field value changes, for Eg : Whenever user enter a value for 'Date' field on a form.



















Wednesday, May 20, 2015

How to create a record into a custom table using business rule in service now?


This blog explains about how to create a business rule to create a record into custom table.

Scenario : Whenever new incident created, Newly created Incident Number and description should stored into a custom table called 'incident_backup' table


- Create a new table called 'incident_backup' with 'description' and 'number' fields.

- Launch 'Create New' Incident module

- Right click on 'Create New' incident form header -> Configure -> Business Rule

- Create a new business rule

- Give a valid name to the business rule

- When to run ? Choose 'Insert'

- Select 'Advance' check box

- Write a function as below

createIncidentBackupRecord();  // Invoking a function
// Function definition as follows below

function createIncidentBackupRecord(){
try{
// Create a glide record for the 'incident-backup' table
var gr = new GlideRecord("incident_backup");
gr.initialize();
// Set event start, event end, name

gr.short_description=current.short_description;
gr.number=current.number;

gr.insert();

}catch(Exception){
gs.log(" Create Incident Backup Record Exception Occured while creating Blackout Window"+Exception);

}
}

- Save the Business Rule

- Create a new incident record, as soon as new incident row get created, this will trigger above business rule, and this business rule will create a new record into 'incident_backup' table



How to Create a Module based on URL ?


This blog explains about how to create a Module using arguments or How to test only Catalog item ?

Scenario : Create a catalog item,  User don't need to 'Maintain items' Module every time to test the catalog item.

Steps

- Go to Maintain Items under Service Catalog

-  Search for the catalog item, for which you want to create a module, Press Ctl + Mouse click on the Name of the catalog item, That will launch the item in a new tab

- For example, below is how the URL looks like, once you open the catalog item in a new window

https://fmdev.service-now.com/sc_cat_item.do?sys_id=3ec4fde02bcc06001f1847f119da15cc&sysparm_view=item&sysparm_record_target=sc_cat_item&sysparm_record_row=1&sysparm_record_rows=175&sysparm_record_list=type%21%3Dbundle%5Esys_class_name%21%3Dsc_cat_item_guide%5Etype%21%3Dpackage%5Esys_class_name%21%3Dsc_cat_item_content%5Esc_catalogs%3DNULL%5EORsc_catalogsDOES+NOT+CONTAIN0b22fd2ad7021100b9a5c7400e610319%5EORDERBYDESCsys_updated_on

- Copy only the URL excluding https://xxxxx.service-now.com as shown above highlighted. URL should looks like below

sc_cat_item.do?sys_id=3ec4fde02bcc06001f1847f119da15cc&sysparm_view=item&sysparm_record_target=sc_cat_item&sysparm_record_row=1&sysparm_record_rows=175&sysparm_record_list=type%21%3Dbundle%5Esys_class_name%21%3Dsc_cat_item_guide%5Etype%21%3Dpackage%5Esys_class_name%21%3Dsc_cat_item_content%5Esc_catalogs%3DNULL%5EORsc_catalogsDOES+NOT+CONTAIN0b22fd2ad7021100b9a5c7400e610319%5EORDERBYDESCsys_updated_on


- Now Right click on the application where you want to create a new module

- Create New Module 

- Choose 'Link Type' as 'URL(from Arguments.)

- Provide a proper name to the Module

- Paste the above copied URL into 'Arguments' field.

- Refresh the URL and search for the Application, you will see a new module created in above step, If you click on you will see a catalog item, Enter the details and click on 'Try it'



Tuesday, May 19, 2015

How to activate service now plugins?


This blog explains about how to add plug-ins in Service Now

Plugins provide additional optional features that can be activated within a ServiceNow instance. The activation process varies by plugin.

- Search for 'Plugins' on left hand side
- Look for the already existing plugins available, choose the one which you want to active
- Click on 'Activate/Upgrade' Link
- This will take couple of minutes to update and activate.

Note : You should have right access in order to activate the plug-ins.

How to Request for your own Developer Service Now Instance ?




1.    https://developer.servicenow.com/app.do#!/home

2. Click on Sign up Now

3. Fill the details as displayed on screen, verify your email

4. Click on the link in your email, Sign on

5. Accept the agreement

6.Click on 'Manage'  -> "Instance ' Menu

7. Click on ' Request  Instance' Button

8. You will get the service now instance URL, Logn credentials, make not of them and start accessing/using with this info whenever you want.

Note : You have to keep using this URL to avoid termination of this instance.