Genpact Cora Knowledge Center

Support

Configure Preview Attachment

Starting with V10.0, Cora SeQuence has been renamed to Cora Orchestration.

V9.6 and later

Overview

The Preview Attachment control displays the file preview either in a pop-up window or in the set location in the case window. You can preview case attachments by adding the Preview Attachment control in your form or by adding the Preview Attachment client API to the form.

Currently, preview for the following file formats is supported:

  • PDF
  • JPEG
  • PNG
  • GIF
  • TXT
  • CSV
  • XLSX
  • DOCX
  • XLS
  • RTF

For other file formats, the system downloads the attachment file to your computer.

NOTE
The preview functionality does not support Right-to-Left (RTL) languages, for example, Hebrew and Arabic.

Enable preview attachments 

Set the following parameter in the Administration and Flowtime web.config file to enable or disable the attachment preview:

ParameterValue
PNMsoft.Sequence.Components.PreviewAttachments.PreviewEnabled 
  • True (default)
  • False

Set the maximum preview size

Set the following parameters in the appSettings section in the Administration and Flowtime web.config file, to add the maximum preview size for different types of attachments. 

ParameterSupported filesDefault maximum preview size
PNMsoft.Sequence.Components.PreviewAttachments.AttachmentMaxSizePDF, JPEG, PNG, GIF, TXT, and CSV4096 KB
PNMsoft.Sequence.Components.PreviewAttachments.PassThroughAttachmentMaxSizeXLSX, DOCX, XLS, and RTF1024 KB

For example:

<appSettings>
<add key="PNMsoft.Sequence.Components.PreviewAttachments.AttachmentMaxSize" value="4096" />
 <add key="PNMsoft.Sequence.Components.PreviewAttachments.PassThroughAttachmentMaxSize" value="1024" />
…
</appSettings>

Preview attachments in a pop-up window

By enabling preview in the web.config file, one-click on the filename displays the preview in a pop-up window.

Preview attachments in a form

You can add the preview functionality to a form in two ways: 

  • Add a code snippet to the form source 
  • Add the Preview Attachment control from Toolbox 

Add snippet to the form source 

  1. In a workflow, add or edit a form or a task activity.
  2. Add the following script to the source in the relevant location.
<div>
<sq:PreviewAttachmentView runat="server" ID="PreviewControl" Display="Static" Width="800" Height="500"></sq:PreviewAttachmentView>
</div>

By default, the Display property of the Preview Attachment control is set to Static so it preserves space for the preview according to the given width and height. You can set the Display property to Dynamic to display the preview dynamically. 

Add the Preview Attachment control from Toolbox 

  1. In a workflow, edit a form or a task activity.
  2. Select from the Toolbox, Standard > Preview Attachment control.

    Add the Preview Attachment control in the specific location in the form where you want to display the preview.
  3. Save the form.

Display a file in the Preview Attachment control

The Preview Attachment form control has its own client API to display a file preview in the form.

Set the following function parameters to display a file preview in the form:

FunctionParametersDescription
previewAttachment
  • fileId
  • fileName
  • workflowInstanceId
is called when a user clicks on an attachment to open a preview.

For example,
previewAttachment("85e6c44b-34df-4563-9f9f-c75037c68f12", "myfile.docx", 2147923637)

The client API has the following events:

EventsDescription
closePreviewis called when a user closes a preview.
onNavigatingis called before navigating to the previewed file.
onNavigatedis called after navigating to the preview file.