Show list of record

Kumar887
Tera Contributor

Hi Community!
I am new to ServiceNow, I have a requirement to show list of record using custom widget. 

Kumar887_0-1694794398447.png

I want to edit directly from output of widget by double click on that field. But in here, it is redirecting me to form of that record 
like this

Kumar887_0-1694801484109.png

 


I am using this code
HTML:

<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Table List</h3>
</div>
<table class="table">
<thead>
<tr>
<th>Number</th>
<th>Short Description</th>
<th>State</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="table in data.tables" ng-dblclick="c.editTable(table.sys_id)">
<td>{{::table.number}}</td>
<td>{{::table.short_description}}</td>
<td>{{::table.state}}</td>
</tr>
</tbody>
</table>
</div>

 

 

I am stuck on other client and server scripts.
Thanks in Advance!

2 REPLIES 2

Kalyani Jangam1
Mega Sage
Mega Sage

Hi @Kumar887 

Please check below requirement, show incident record by using assigned user

HTML Tags

<div>
<h1>
Incident Record
</h1>
<div>
<table class="table table-hover" role="grid" border="0">
<tr>
<th width="100">Number</th>
<th width="150">Short Description</th>
<th width="150">State</th>
</tr>
<tr ng-repeat="inc in c.data.incList">
<td>
{{inc.number}}<br/><br/>
<td>
{{inc.description}}<br/><br/>
</td>
<td>
{{inc.state}}<br/><br/>
</td>
</tr>
</table>

************************************************************************************************

Server Script

(function() {
var user = gs.getUserID();
data.incList = [];
data.childIncList = [];
var incGr = new GlideRecord('incident');
incGr.addQuery('assigned_to', user);
incGr.query();
while(incGr.next()){
gs.addInfoMessage("In while loop");
var incObj = {};
incObj.number = incGr.getDisplayValue('number');
incObj.description = incGr.getDisplayValue("short_description");
incObj.state = incGr.getDisplayValue("state");
data.incList.push(incObj);

}
})();
 
Please check and Mark Helpful and Correct if it really help you.

Hi @Kalyani Jangam1, thanks for the reply but I want to show all list of incident and apply dblfunction so that if we double click on specific field, then it should be editable like this:

 

Kumar887_1-1694855358640.png