How to add dynamic action buttons in a List based on record field values?

sabra_gr
Tera Contributor

I’m working on a UI Builder page where I need to display a list of records. One of the columns in the list should include dynamic action buttons, where the label and functionality of the buttons depend on the value of a specific field in each record.

My Requirements:

  • The list displays records fetched from a table.
  • In the "Actions" column:
    • The button label and functionality should change dynamically based on the value of a field in the record: 
    •  if State field is "Open" display a button labeled "Start"
    •  if State field is "In progress" display a button labeled "Resume"

My Questions:

  1. Is it possible to implement dynamic buttons in the List by adding a UI Action List field? If yes, how can I configure it in UI Builder?
  2. If a UI Action List field is not suitable, what other declarative options are available in UI Builder to achieve this functionality?

Thank you for your guidance and insights!

1 ACCEPTED SOLUTION

@sabra_gr ,

 

according to this old post, users are unable to add buttons to individual rows.

 

https://www.servicenow.com/community/developer-forum/creating-buttons-on-each-row-of-a-list/m-p/1476...

 

BUT

 

you can add custom button component above or below LIST component and make it dynamic upon users clicking on individual row. You can access payload of selected row and react on that payload dynamically. So even a button Label can be dynamic depending on row clicked to show actual action type that is going to happen.

View solution in original post

6 REPLIES 6

Hi @sabra_gr ,

 

is you UI action set to type List Link?

sabra_gr
Tera Contributor

@IronPotato 

 

yes, UI action set to type List Link.