Card template element attributes

  • Release version: Xanadu
  • Updated August 1, 2024
  • 2 minutes to read
  • Summarize
    Summarized using AI
    This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.

    Summary of Card Template Element Attributes

    This reference outlines the necessary attributes for various card template elements in ServiceNow's Mobile Card Builder. These attributes allow you to effectively display text, images, buttons, and custom HTML within your mobile applications. The tool automatically generates these attributes, simplifying the setup process.

    Show full answer Show less

    Key Features

    • Text Type Attributes: Includes TextValue for static text display, FieldLabel for table field labels, FieldValue for field values, and FieldFunction for record counts or grouping.
    • Image Type Attributes: Features ImageURL for static images from the attachment table and FieldValue for displaying images from record fields.
    • Button and MenuButton Attributes: Contains Button for action selection, TextValue for static text, FieldValue for field values, and Icon for displaying icons.
    • Menu Type Attributes: Similar to Button attributes with TextValue for static text and Icon for icons.
    • HtmlText Type Attributes: Includes various configurations for rendering HTML elements, such as SearchExternalSource and HtmlSanitizationAllowList.
    • Property Attributes: These define additional properties for card template slots, including background, border, and text colors, using hex codes or theme names.

    Key Outcomes

    By utilizing these attributes, ServiceNow customers can customize card templates to enhance user experience in mobile applications. The effective use of these attributes ensures that information is presented clearly and interactively, ultimately improving engagement and functionality for end-users.

    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.

    Note:
    When using the Mobile Card Builder, the listed attributes do not need to be manually created, as the tool automatically creates the attributes in the background.

    Attributes for the Text type

    Table 1. 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

    Table 2. 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

    Table 3. 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

    Table 4. 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

    Table 5. 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.

    Table 6. Attributes for the Menu 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.