Skip to main content

(16) Components – Attachments

- Support Ticket Tutorial -

This Advanced Topic will enable the end user to attach a screenshot or a document to a Support Ticket. It is similar to how Ticket Notes were established. This will put the list of attachments at the bottom of the Detail Page in a Document List.

1. Create a Ticket Attachment Entity

This step will create a new entity named “Ticket Attachment”. The Composition reference type (1 -> N) will be used.

  • Create a Ticket entity. Type: Ctrl + Shift + C to open the general Create Dialogue; select Entity.
  • Name your Entity: Ticket Attachment
  • Set the Display Icon. (Suggestion: Use “Paperclip”.)
  • Change the Create Display Attribute to Title. This will create an attribute and set it as the display expression for entity records.
  • Click Next.
  • Inside the Create Pages box, keep the Create Page and Detail Page; un-select the List Page.
  • Click Finish
  • Save Changes: Ctrl + S

2. Add Attributes to the Ticket Attachment Entity

  • In the Data Definition > Attributes section, click Add Attribute
  • Set Attribute Name to: Attachment
  • Set Type to: Document (move into the databox and type “c”)
  • Click Save
  • Go to the Settings tab, click Inherited Aspects
  • Select TimeStamp
  • Save changes: Ctrl + S

3. Set References

  • In the Data > Entities subsection, double-click the Ticket entity
  • In the Data Definition > References section, click the Add Reference
  • Set Name to: Ticket Attachment.
  • Set the Type to: Composition.
  • Set Referenced to: Ticket Attachment.
  • Click Save.
  • Save Changes: Ctrl + S

4. Update User Interface

Go to UI > Entity Pages and double-click on the pages below to update them with the Ticket Attachment attribute.

A. TicketAttachment Create Page

  • Click Add View. Then, click Create Empty View for Ticket Attachment
  • In the layout editor add Data Fields. Click Title, Ticket and Attachment
  • Define the Attachment expression further. Click Attachment
  • In the Validations Section, click the Magic Wand. Select Require attached document
  • Click OK
  • Click OK

    Set the Layout so that it can be Shared on the Detail Page
  • In the Layout section, click More
  • Click Make Shared
  • Click Ctrl + S

B. TicketAttachment Detail Page

  • In the center of the page, click Add View
  • Then click Add Shared View for Entity Ticket Attachment
  • Save changes: Ctrl + S

5. Update Ticket Detail Page

  • Go to UI > Entity Pages and click Ticket Detail
  • Go the Layout section. Near the bottom of the page, click Add Tab
  • Set Label to: Attachments
  • Set Tab Icon, if necessary (Suggestion: Use “Paperclip”.)
  • Click OK
  • In the tab area, select the Attachments tab.
  • Click Add View. Then click Create Empty View for Ticket
  • In the side bar, locate Advanced Components and select: Document List
  • Click Configure Document List
  • Set Item Entity to: TicketAttachment
  • Set Document Attribute to: Attachment
  • Set User Attribute to: CreatedBy
  • Set Created Attribute to: CreatedDate
  • Set Parent Entity Reference to: Ticket
  • Click OK
  • Click OK
  • Save: Ctrl + S

6. Deploy and Run the App