Show list of record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2023 09:25 AM - edited 09-15-2023 11:12 AM
Hi Community!
I am new to ServiceNow, I have a requirement to show list of record using custom widget.
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
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2023 10:01 PM
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);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2023 02:09 AM
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: