- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2017 10:17 PM
I Wants to print current record number inserted in table after click Submit button
I am new to Swericenow please help
here is code
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
Hello Welcome to New Test Page
<table>
<tr>
<td> Name </td>
<td> <input type="text" id="fname" name="fname"/> </td>
</tr>
</table>
<input type="submit" value="Save Record" onclick="return ins();"/>
<script>
function ins()
{
var gr = new GlideRecord('x_94496_econtact_a_network_voice');
gr.initialize();
gr.csc_short_name = document.getElementById("fname").value;
gr.insert();
alert ("Record inserted");
gs.print('Incident Number is ' + number '); // Number is column name where auto number value would be generated once record inserted into table.
}
</script>
</j:jelly>
Solved! Go to Solution.
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2017 05:42 AM
Use the below code.
var gr = new GlideRecord('x_94496_econtact_a_network_voice');
gr.initialize();
gr.csc_short_name = document.getElementById("fname").value;
var id= gr.insert();
var gr1= new GlideRecord('x_94496_econtact_a_network_voice');
gr1.get(id);
alert ("Record inserted" + gr1.number);
Thanks,
Jagarnath

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2017 12:52 AM
Hello Mahather,
Modified code as per your req.
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
Hello Welcome to New Test Page
<table>
<tr>
<td> Name </td>
<td> <input type="text" id="fname" name="fname"/> </td>
</tr>
</table>
<input type="submit" value="Save Record" onclick="return ins();"/>
<script>
function ins()
{
var gr = new GlideRecord('x_94496_econtact_a_network_voice');
gr.initialize();
gr.csc_short_name = document.getElementById("fname").value;
gr.insert();
var num = gr.number;
alert ("Record inserted" +num);
}
</script>
</j:jelly>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2017 12:32 AM
Thanks for your Info Gerogi
My request is very simple one..
If I click Save Record button.. Record would be inserted in table.. I just want to print record number which was created in table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2017 04:58 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2017 05:42 AM
Use the below code.
var gr = new GlideRecord('x_94496_econtact_a_network_voice');
gr.initialize();
gr.csc_short_name = document.getElementById("fname").value;
var id= gr.insert();
var gr1= new GlideRecord('x_94496_econtact_a_network_voice');
gr1.get(id);
alert ("Record inserted" + gr1.number);
Thanks,
Jagarnath
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2017 06:20 AM
Thank you Jagarnath
its work perfectly..
Can I get Info message like below as Record Saved Successfully
below code not working
function ins()
{
var gr = new GlideRecord('x_94496_econtact_a_network_voice');
gr.initialize();
gr.csc_short_name = document.getElementById("fname").value;
var id= gr.insert();
var gr1= new GlideRecord('x_94496_econtact_a_network_voice');
gr1.get(id);
gs.addInfoMessage('"Record inserted" + gr1.number');
}