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.

How to dynamically set the properties of the contact card

K_ Morita
Kilo Guru

Hi

I would like to know how to dynamically set the following properties of the contact card component in UI Builder.

- Heading badges
- Sub-heading titles
- Sub-heading badges
- Contact fields

These properties look like JSON objects, so I'm not sure how to set up dynamic data binding.

Thanks

1 ACCEPTED SOLUTION

Brad Tilton
ServiceNow Employee
ServiceNow Employee

If it's JSON, you could bind a client state parameter in the correct format to the whole property, but I've found scripted properties work best for the JSON properties. Something like this:

find_real_file.png

From in the script block you'll have access to api.state and api.data.

View solution in original post

3 REPLIES 3

Brad Tilton
ServiceNow Employee
ServiceNow Employee

If it's JSON, you could bind a client state parameter in the correct format to the whole property, but I've found scripted properties work best for the JSON properties. Something like this:

find_real_file.png

From in the script block you'll have access to api.state and api.data.

Hi Brad,

I need to display more fields along with the OOB fields on contact card sub-header. Could you please suggest.

learnnv_0-1745427994861.png

 

K_ Morita
Kilo Guru

Hi Brad

Your comment looks helpful to me.

I'll give it a try. Thank you very much.