Card template element attributes
Summarize
Summary of Card template element attributes
This reference guide explains the required attributes for different card template elements used in ServiceNow's Mobile Card Builder as of the Zurich release. Attributes define how elements like text, images, buttons, menus, and HTML content appear and behave in mobile card templates.
Show less
When using the Mobile Card Builder tool, these attributes are automatically created, but understanding them is essential for customizing card templates manually or troubleshooting.
Attributes for Card Template Elements
- Text type attributes:
- TextValue: Displays static text; use the Translatable value field for the text.
- FieldLabel: Shows the label of a table field; enter the field name (e.g., shortdescription).
- FieldValue: Displays the value of a field from a record; enter the field name.
- FieldFunction: Displays a count or grouped value of records.
- Image type attributes:
- ImageURL: Displays a static image from the attachment table; enter the SysID of the attachment.
- FieldValue: Displays an image from a record field (e.g., avatar).
- Button and MenuButton types:
- Button: Defines the function triggered on tap; enter the SysID of a function from the Functions table.
- TextValue: Displays static text with the field name.
- FieldValue: Displays a field value (e.g., avatar).
- Icon: Displays an icon; enter the SysID from the Icon table.
- Menu type attributes:
- TextValue: Displays static text; enter the field name.
- Icon: Displays an icon; use the SysID from the Icon table.
- HtmlText type attributes: Includes properties such as SearchExternalSource, HtmlReplaceMap, HtmlSanitizationAllowList, HtmlRemoveList, StringReplaceMap, and RenderType for advanced HTML content handling.
Property Attributes for Card Template Slots
These attributes define the visual style of card template elements, independent of specific element types:
- BackgroundColor: Sets the background color using hex codes or theme color names (e.g., Primary, #8a8a8a).
- BorderColor: Sets the border color similarly.
- TextColor: Defines the text color using hex codes or theme names.
Practical Use
Understanding and configuring these attributes allows ServiceNow customers to customize mobile card templates effectively, ensuring the right data displays with appropriate styling and interactive functionality. This knowledge is essential when building or modifying card templates manually or when troubleshooting attribute-related issues in mobile cards.
Use this reference to determine which attributes to use for your card template elements.
Each card template element has one or more required attributes that you must create. The sections below show the required attributes for each card template element type.
Attributes for the Text type
| Name | Description | Configuration |
|---|---|---|
| TextValue | Used to display static text. | Use the Translatable value field to enter the text to display. |
| FieldLabel | Used to display the label of a table field. | Use the Value field to enter the name of a field. For example, short_description. |
| FieldValue | Used to display the value of a field in a record. | Use the Value field to enter the name of a field. For example, short_description. |
| FieldFunction | Used to display either a count of records, or the value by which records are grouped. |
Attributes for the Image type
| Name | Description | Configuration |
|---|---|---|
| ImageURL | Used to display a static image from the attachment[sys_attachment] table on your instance. | Use the Value field to enter a SysID for a record in the attachment[sys_attachment] table. |
| FieldValue | Used to display an image from a field in a record. | Use the Value field to enter the name of a field. For example, avatar. |
Attributes for the Button and MenuButton types
| Name | Description | Configuration |
|---|---|---|
| Button | Used to select the function that runs when users tap a button. | Use the Value field to enter the SysID of a function from the Functions[sys_sg_button] table. For details on creating functions, see Mobile functions. |
| TextValue | Used to display static text. | Use the Value field to enter the name of a field. For example, short_description. |
| FieldValue | Used to display the value of a field in a record. | Use the Value field to enter the name of a field. For example, avatar. |
| Icon | Used to display an icon. | Use the Value field to enter the SysID of an icon record from the Icon[sys_sg_icon] table. |
Attributes for the Menu type
| Name | Description | Configuration |
|---|---|---|
| TextValue | Used to display static text. | Use the Value field to enter the name of a field. For example, short_description. |
| Icon | Used to display an icon. | Use the Value field to enter the SysID of an icon record from the Icon[sys_sg_icon] table. |
Attributes for the HtmlText type
| Name | Description | Configuration |
|---|---|---|
| SearchExternalSource | ||
| HtmlReplaceMap | ||
| HtmlSanitizationAllowList | ||
| HtmlRemoveList | ||
| StringReplaceMap | ||
| RenderType |
Property Attributes
Use property attributes to define additional properties for your card template slot. These properties are not associated with a specific attribute type.
| Name | Description | Configuration |
|---|---|---|
| BackgroundColor | Color of the background for the card template element. | Use the Value field to define the color. Colors must be in color hex code format, or the name of a color theme. For example Primary or #8a8a8a. |
| BorderColor | Color of the border for the card template element. | Use the Value field to define the color. Colors must be in color hex code format, or the name of a color theme. For example Primary or #8a8a8a. |
| TextColor | Color of the text or the card template element. | Use the Value field to define the color. Colors must be in color hex code format, or the name of a color theme. For example Primary or #8a8a8a. |