Free cookie consent management tool by TermsFeed

Document Viewer Component

On This Page

Function

a!documentViewerField( label, labelPosition, instructions, helpTooltip, document, showWhen, height, altText, disabled, accessibilityText, marginAbove, marginBelow, initialPageDisplay, highlightedText )

Displays a document from document management on an interface.

Parameters

Name Keyword Types Description

Label

label

Text

Text to display as the field label.

Label Position

labelPosition

Text

Determines where the label appears. Valid values: "ABOVE" (default), "ADJACENT", "COLLAPSED", "JUSTIFIED".

Instructions

instructions

Text

Supplemental text about this field.

Help Tooltip

helpTooltip

Text

Displays a help icon with the specified text as a tooltip. The tooltip displays a maximum of 500 characters. The help icon does not show when the label position is "COLLAPSED".

Document

document

Any Type

The document to view. Provide a document using the document data type or an integer with a document ID. For external documents managed by a record type, provide the entire record.

Show When

showWhen

Boolean

Determines whether the component is displayed on the interface. When set to false, the component is hidden and is not evaluated. Default: true.

Height

height

Text

Determines the field height. Valid values: "SHORT", "MEDIUM" (default), "TALL".

Alternative Text

altText

Text

Equivalent alternate text provided to assistive technology. On Appian Mobile, this value is used for the downloadable link label.

Disabled

disabled

Boolean

Determines if the user is prevented from interacting with the document. Default: false.

Accessibility Text

accessibilityText

Text

Additional text to be announced by screen readers. Used only for accessibility; produces no visible change.

Margin Above

marginAbove

Text

Determines how much space is added above the layout. Valid values: "NONE" (default), "EVEN_LESS", "LESS", "STANDARD", "MORE", "EVEN_MORE".

Margin Below

marginBelow

Text

Determines how much space is added below the layout. Valid values: "NONE", "EVEN_LESS", "LESS", "STANDARD" (default), "MORE", "EVEN_MORE".

Initial Page Display

initialPageDisplay

Integer

Sets the initial page number to display when the document loads. A value of 1 opens the first page. If no value is provided, the first page displays.

Highlighted Text

highlightedText

Text

Highlights the first occurrence of a word or phrase in the document when it loads, regardless of case. If no match is found, no text is highlighted. Only applies to Chrome and Firefox browsers.

Usage considerations

When to use this component

This component displays documents:

Do not use this component to display:

Support for Microsoft Office documents

The document viewer component doesn't natively support Microsoft Office files. To display Microsoft Office files in this component and throughout your applications, you must install theMicrosoft Document Editor plug-in.

Using the document parameter

The way you reference a document in the document parameter depends on how the document is managed—using a record type or folder.

Record type-managed documents:

  • For documents stored in Appian, index into the Document field.

    For example, ri!caseDocument[recordType!Case Document.fields.document], where the rule input points to the Case Document record type.

  • For documents stored in external systems, reference the entire record using a rule input or local variable.

    For example, ri!orderDocument, where the rule input points to the Order Document record type.

Folder-managed documents:

  • Reference the document or document identifier using a constant, query, or other expression.

    For example, ri!documentId, which is a rule input type with a Document data type.

See more examples below.

If a document is invalid, has been deleted, or the user does not have permission to view it, the component will display Document not available.

Viewing documents on different devices

Document viewing behavior differs depending on the browser and document type. Some browsers may render documents inline, while other browsers or file types may only be downloaded. Browser plug-ins or extensions may also impact this behavior.

The document viewer component works within the constraints of the browser and its handling of different document types. For example, iOS browsers don't natively support viewing a PDF inline, so the component provides an option to view the file in a separate tab.

On Appian Mobile applications, the document viewer component appears as a document download link. The value provided in altText is used for the link label.

Security

For security purposes, documents are loaded using the static content URL.

The message Missing system configuration will be displayed if this domain is not configured on your Appian instance. See Post-Install Configurations for more details on this configuration.

When to use altText and accessibilityText

The value for the altText parameter should be a short description that is read by screen readers and displays if the document fails to load.

The value for the accessibilityText parameter should be used if you need to provide additional information for screen readers about the document.

Examples

To experiment with examples, copy and paste the expression into an interface object.

Record type references are specific to each environment. If you copy and paste an example with a record type or field reference into your interface, it will not evaluate. Use it as a reference only.

Displaying Appian-stored documents

This example uses a rule input (ri!caseDocument) to pass in a specific document from the Case Document record type.

This record type manages documents stored in Appian, so the document parameter must reference the document field from the record type.

1
2
3
4
5
6
7
8
{
  a!documentViewerField(
    label: ri!caseDocument[recordType!Case Document.relationships.documentProperties.fields.name],
    document: ri!caseDocument[recordType!Case Document.fields.documentId],
    height: "TALL",
    altText: ri!caseDocument[recordType!Case Document.relationships.documentProperties.fields.name]
  )
}

This expression displays the following:

Scroll or drag to pan · ⌘+/⌘− to zoom · Esc to closeimages/display-record-document.png

Displaying externally-stored documents

This example uses a rule input (ri!orderDocument) to pass in a specific document from the Order Document record type.

This record type manages documents stored in an external system, so the document parameter must reference the entire record.

1
2
3
4
5
6
7
8
{
  a!documentViewerField(
    label: "Order Document",
    /* References a record from the Order Document */
    document: ri!orderDocument,
    height: "TALL"
  )
}

Displaying a document using a constant

To test this example, replace cons!MY_PDF with a constant that points to a document in your environment.

Note that this uses the document() function to access the name of the document to display in the interface.

1
2
3
4
5
6
7
a!documentViewerField(
  label: document(
    documentId: cons!MY_PDF,
    property: "name"
  ),
  document: cons!MY_PDF
)

Connect to an AI chat response

When you use an AI chat component to answer questions about a document, you can enhance the user experience by connecting the chat's sources directly to a document viewer. This allows users to click a source citation in the chat response and instantly see the exact page and text the AI used for its answer, providing clear verification and context.

See Connect Document Viewer to an AI Chat Response recipe for more information.

Feature compatibility

The table below lists this component's compatibility with various features in Appian.
Feature Compatibility Note
Portals Compatible
Offline Interfaces Incompatible
Sync-Time Custom Record Fields Incompatible
Real-Time Custom Record Fields Incompatible

Custom record fields that evaluate in real time must be configured using one or more Custom Field functions.

Process Reports Incompatible

Cannot be used to configure a process report.

Process Events Incompatible

Cannot be used to configure a process event node, such as a start event or timer event.

Process Autoscaling Incompatible

Cannot be used in autoscaled processes.

Event Consumer Filter Conditions Compatible

Can be used in filter conditions.

Event Consumer Event Handlers Compatible

Can be used in event handler expressions.

The following recipes include usage of the Document Viewer Component.

Feedback