- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2025 12:13 AM
Hi,
We wish to examine customer requierment on CSM:
Add a custom button in each record that will allow them to raise new case from an existing order.
the button just need to redirect for a new case creation page with some parameters from the order record.
I believe it can be achieved by customizng the list widget (ng-repeate for adding the button in the end of the list):
Any suggestions?
Thanks,
Tomer
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2025 03:13 AM - edited 03-27-2025 03:16 AM
Sure
Server:
(function() {
var tble = $sp.getParameter('table')
var gr = new GlideRecord(tble); // Change table as needed
gr.addActiveQuery();
gr.orderByDesc('sys_created_on');
gr.setLimit(10);
gr.query();
var records = [];
while (gr.next()) {
records.push({
sys_id: gr.getValue('sys_id'),
number: gr.getValue('number'),
short_description: gr.getValue('short_description'),
contact: gr.getDisplayValue('contact')
});
}
data.list = records;
})();
HTML
<table class="table table-striped">
<thead>
<tr>
<th>Number</th>
<th>Short Description</th>
<th>Contact</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="record in data.list">
<td>{{record.number}}</td>
<td>{{record.short_description}}</td>
<td>{{record.contact}}</td>
<td>
<button class="btn btn-primary" ng-click="performAction(record)">
Take Action
</button>
</td>
</tr>
</tbody>
</table>
Client (Add function)
$scope.performAction = function(record) {
alert('Action triggered for ' + record.sys_id);
// Example: Trigger a script action or redirect
window.location.href = 'csm?id=create_order_catalog_item_rp&sys_id=34418320778361105c24f664be5a99f4&order_number='+record.number;
};
Final result:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2025 10:06 AM
Thanks @tpeleg
Please mark your own response as correct so that it helps future members.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader