Virtual agent table bot response

HARSHA GOWDA R
Tera Contributor

HARSHAGOWDAR_0-1730799262866.png

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 
HARSHAGOWDAR_1-1730799585532.png

 

 
0 REPLIES 0