Omender Singh
Tera Guru

Hello ServiceNow Ninjas,

Today we are demonstrating the creation of an Incident form using a UI page.

This involves the use of all three components of UI page - HTML body, Client Script & processing script.

The demonstration is very well explained in the video - Click Here

 

Mark Helpful, If helpful.

 

Script Sample :-

-----------------------------------------------------------------------------------------------------------------------------------------------------------------

 

HTML

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
	<g:ui_form id="f_id">
	<center><h2> Incident Request Form </h2>
	<table>
	<tr>
	<td>Requester : </td>
    <td><g:ui_reference name="User_id" table="sys_user" field="name" id="Name"  displayvalue="${gs.getUser().getDisplayName()}" value="${gs.getUser()}"/> </td>
	</tr>
		<tr></tr>	
	<tr>
	<td>Category : </td>
    <td> <select name="cat_id" id="c_id">
		<option value="0">None</option>
		<option value="inquiry">inquiry</option> 
		<option value="software">software</option>
		<option value="hardware">hardware</option>
		<option value="network">network</option> 
		<option value="database">database</option> 
		</select>
	</td>
	</tr>
		<tr><td>Short Description : </td><td><input type="text" name="sd_id"/></td></tr>
		<tr><td>Description : </td><td><textarea name="des_id" rows="4" cols="50"></textarea></td></tr>
		<tr><td><input type="submit" onClick="redirect()"/></td><td><input type="reset" name="reset" onClick="onReset()"/></td></tr>
	</table>
		
		</center>
		 </g:ui_form>
</j:jelly>

 

Client Script 

function onReset() {
	
document.getElementById("f_id").reset(); // clear the form
}

 

Processing Script

var inc = new GlideRecord('incident');
inc.initialize();
inc.caller_id = User_id;
inc.short_description = sd_id;
inc.description = des_id;
inc.category = cat_id;
var sys_id = inc.insert();
var URL = "https://dev125702.service-now.com/incident.do?sys_id=" + sys_id; // URL of newly created incident record
response.sendRedirect(URL); //sendRedirect() method redirects the response to another resource, inside or outside the server.
Comments
ThirumalR
Giga Explorer

I really appreciate your efforts on posting video and the text version. I am new to SNOW and tried your example,. it seems your reset is working because button is declared of type 'reset'. If you alert 'document.getElementById('f_id')' it returns null.

SNOW is generating a sys-id for form not what we enter in the HTML (see view source)

SHANKAR RAMAVAT
Tera Contributor

Hi,

Thanks for the video and helped me a lot, now I can create some Ui pages, I have a requirement. 

We have an Tiering Assessment questions in Third-party vendor risk management, we need to go to the portal and answer the questions and complete the IRQ.

We need the same questions on the form of the tiering assessment table form to answer the questions instead of going to portal. We can create the questions manually but there are hundreds of the questions.

So, we need to call them on the UI page for easy access.

How can we achieve this by UI page.

Thanks in advance.

Version history
Last update:
‎05-18-2022 04:12 AM
Updated by: