The CreatorCon Call for Content is officially open! Get started here.

Nia McCash
Mega Sage
Mega Sage

If you’ve setup an EVAM data resource for the UI Builder or followed along with @Brad Tilton's blog, you’ll know that as part of the setup steps, you have to configure a View Template [sys_ux_composite_data_template] using some JSON  magic.

After some trial and error, I’ve managed to map the JSON from the sample provided at the bottom of the View Template configuration page to the data displayed in the Data Set component (using User [sys_user] table as an example) as follows…

 

Static Values

find_real_file.png

 

Mappings


find_real_file.png

find_real_file.png

 

Here’s the View Template [sys_ux_composite_data_template] JSON used: 

{
    "component": "now-card-evam-record",
	"staticValues": {
		"highlightedHeaderIcon": {
			"translatable": false,
			"key": "user-outline"
		},
		"highlightedHeaderBkgColor": {
			"translatable": false,
			"key": "critical"
		},
		"subtitleIcon": {
			"translatable": false,
			"key": "calendar-fill"
		},
		"imageType": {
			"translatable": false,
			"key": "image"
		},
		"subtitleImageType": {
			"translatable": false,
			"key": "avatar"
		},
		"detailLabelOne": {
			"translatable": true,
			"key": "Email address"
		},
		"detailLabelTwo": {
			"translatable": true,
			"key": "Works for"
		},
		"detailLabelThree": {
			"translatable": true,
			"key": "Business phone"
		}
	},
	"mappings": {
		"highlightedHeaderLabel": "title",
		"textHeaderLabel": "department",
		"titleLabel": "name",
		"imageURL": "avatar",
		"subtitle": "user_name",
		"subtitleAvatarName": "name",
		"subtitleAvatarURL": "avatar",
		"detailValueOne": "email",
		"detailValueTwo": "company",
		"detailValueThree": "phone"
	},
	"actionMappings": {
		"clickAction": "navigation"
	}
}


A few things to note

  1. detailLabelThree and detailValueThree do NOT appear when using Grid view with Card Height of Small

    find_real_file.png


    Small card:
    find_real_file.png

  2. Remove subtitleAvatarURL from the mappings to remove the duplicate image

    find_real_file.pngfind_real_file.png

  3. To get rid of it entirely, remove subtitleImageType from static values too

    find_real_file.pngfind_real_file.png

  4. Options for the key value for highlightedHeaderBkgColor see the options listed under the sidebar property of the now-card component:

    find_real_file.pngfind_real_file.png



I anticipate that ServiceNow will eventually make it easier to configure the View Template via a GUI, instead of via JSON - perhaps in some manner like the Mobile Card Builder.

But until then, I hope this has been a handy resource.

Comments
Community Alums
Not applicable

Hi 

How to make the titleLabel name to Bold

Andy Smith2
Tera Contributor

Hi Nia

 

This is a very helpful article - very helpful indeed.

 

I was about to try to draw out the physical card layout so that I could visually map the fields and labels provided in the now-evam-card-template JSON.

 

I've been looking in the Now Component library documentation for anything of this kind, and in the EVAM training material. Nothing of this nature found there. 

 

You will have saved a lot of people a lot of time and frustration - well done  !!

 

Regards

Andy

  

Nia McCash
Mega Sage
Mega Sage

Thanks Andy. I really appreciate that.

Bharath38
Giga Sage
Giga Sage

I'm trying to update the icon for Catalog genius result card but updating it to icon is not changing.

One article says we can and other says we cannot.

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1198812

 

https://support.servicenow.com/kb?id=kb_article_view&sys_kb_id=7d870ff21b2b9914b4b577bc1d4bcb85

kbridgeman007
Tera Contributor

FINALLY!  I've been searching high and low for this information.  It's been making me absolutely CRAZY!

 

Thank You. Thank You.  Thank You.

 

But, one question, is that the only card format?  There aren't like 5, 10, 25 of these with different layouts?  Or, preferably a way to map the fields into HTML?  I'm stunned this is so rigid.

PaulSylo
Tera Sage
Tera Sage

Hello Nia - I have this Question, I see the template in EVAM to find the data label and value, but i am unable to find this details,

 

PaulSylo_0-1708555252505.png

Where to find this ? i search even on Data broker, code is there not sure that is the right place to look into this.

Nia McCash
Mega Sage
Mega Sage

@kbridgeman007 You're right. There are different cards/components that you can use and the above is an example for the now-card-evam-record

 

@PaulSylo I'm not sure where that image comes from but have a look at https://[INSTANCE].service-now.com/nav_to.do?uri=sys_ux_composite_data_template.do?sys_id=bb06742cb7... as I think it should be similar setup to your image.

kbridgeman007
Tera Contributor

@Nia McCash - Where can I find an inventory and description of the different card types/layouts?

PaulSylo
Tera Sage
Tera Sage

Hello @Nia McCash  .. this card comes out of the box,. I need to remove or want to know how this Response SLA /Resolution SLA is populated./ one observation is Response SLA appears only for the ticket whichever is gets breached.

Jace Benson
Mega Sage

This is a great article, thank you Nia!

Nia McCash
Mega Sage
Mega Sage

@kbridgeman007 Honestly, I don't know where one would find an inventory but I would look at https://[INSTANCE].service-now.com/now/nav/ui/classic/params/target/sys_ux_composite_data_template_l... for examples.

mmeazza
Tera Contributor

Hi Nia,

Great article, it has been quite helpful! 

Do you know how to (if it's possible) dynamically change the color of highlightedHeaderBkgColor?

Ex. if the state is in progress, the background color should be blue, if the state is open it should be yellow, and so on.

Damian Martinez
Mega Sage

Hello @Nia McCash 

this post is very useful thanks, I have  a question, is there a limit of mapped fields you can add?

Becasue I am trying to add detailLabelFour what it is not showing under Work for label.
Thanks

Version history
Last update:
‎06-22-2021 07:06 AM
Updated by: