Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Display columns on List Component Using Script

ujjwala_678
Tera Contributor

Hi Everyone,

I am trying to display specific columns in a List component within my UI Builder dashboard using a script. I have selected seven columns, but only five are visible when rendered.

I am using dynamic data binding for both the table and query, and I update their values using the "Update Client State Parameter" event.

Could anyone suggest what might be causing this issue and how I can ensure all selected columns are displayed correctly?

Thanks in advance!

Below is my script:

/**
  * @Param {params} params
  * @Param {api} params.api
  * @Param {TransformApiHelpers} params.helpers
  */
function evaluateProperty({ api, helpers }) {
var table=params.table;
if(table=='incident'){
    return ['number', 'name', 'state', 'priority','description','category','caller_id']; 
}
}
1 ACCEPTED SOLUTION

Kevin83
ServiceNow Employee
ServiceNow Employee

I think the value returned here should not be an array rather a  comma separated string of columns 

i.e. 

return 'number,name,state,priority,description,category,caller_id';

 

View solution in original post

3 REPLIES 3

Kevin83
ServiceNow Employee
ServiceNow Employee

I think the value returned here should not be an array rather a  comma separated string of columns 

i.e. 

return 'number,name,state,priority,description,category,caller_id';

 

ujjwala_678
Tera Contributor

Hi Kevin,

Thanks for your help! I’ve made the changes, and everything is working as expected.

I had a quick question—do you think it’s possible to display list controls on a list component in UI Builder?

I’m trying to display a list of incidents where expanding a parent incident would also reveal its child incidents within the report. Do you think this is achievable?

Looking forward to your thoughts!

Kevin83
ServiceNow Employee
ServiceNow Employee

I assume you are using the List + List Controller?

If so you will notice when you view the list you'll see an edit button that opens up form

Screenshot 2025-02-03 at 12.48.19 PM.png

 I believe it is is possible to add your own actions there, that can open up your own UI. Is this something like what you are asking for?