Virtual agent table bot response
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-05-2024 01:40 AM
var headers = [
'Access',
'Endpoint'
]; // Define column headers
var rows = []; // Array to hold row values
var roleObject = {};
var userRoles = new GlideRecord('Table name');
userRoles.addQuery('directory.servicenow_id', gs.getUserID());
userRoles.addQuery('stage', '=', 'granted'); // Ensure the 'stage' field is correct
userRoles.orderBy("iam_roles.application");
userRoles.query();
while (userRoles.next()) {
var roleID = userRoles.getDisplayValue('iam_roles');
roleObject[roleID] = userRoles.getDisplayValue('iam_roles.application');;
// Push each role and application as a row
rows.push([roleID, roleObject[roleID]]);
}
// Return the table structure
return {
columnHeaders: headers, // Column headers for the table
columnValues: rows // Row values for the table
};
Above code i have used in table bot response in virtual agent its giving me the output but my query is access and endpoint should come in the separate column,each roles should come on the access column and each endpoint should come in a endpoint column.Below i have pasted reference how i need

Above code i have used in table bot response in virtual agent its giving me the output but my query is access and endpoint should come in the separate column,each roles should come on the access column and each endpoint should come in a endpoint column.Below i have pasted reference how i need
0 REPLIES 0