Components - Attachments
This Advanced Topic will enable the end user to attach a screenshot or a document to a Support Ticket. This will put the list of attachments at the bottom of the detail page in a Document List.
NOTE: This tutorial is built upon the foundation of the Support Ticket application.
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 + Cto open the general Create Dialogue; select Entity. Nameyour Entity: Ticket Attachment- Set the
Display Icon. (Suggestion: Use “Paperclip”.) - Mark the
Create Display Attributecheckbox. Click in the text box. Type: 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 New AttributeEstablish the following: - Attachment - Document (move into the data-box and type “c”)
- User - User (type “u”)
- Date and Time - DateTime (type “t”)
- Click
Create Attributes - 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 New Reference - Set the
Reference Typeto: Composition. - Set
Targetto: Ticket Attachment. - Click
Create References. - 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. When the dialog box opens, clickOK - 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 the ellipsis
… - Click
Make Shared - Click
Ctrl + S
B. TicketAttachment Detail page
- In the center of the page, click
Add View - Click
Typeand chooseShared Viewfrom the drop-down menu - Verify that
View Entityis set to: TicketAttachment - Set
Shared Viewto: TicketAttachment view - Click
OK - Save changes:
Ctrl + S
5. Update Ticket Detail page
- Go to UI > Entity Pages and click Ticket Detail
- Go the Layout section, and click
Add Tab(near the bottom of the page) - Set
Labelto: Attachments - Set
Tab Icon, if necessary - Click
OK - In the tab area, select the
Attachmentstab and clickAdd View - Click
OK - In the sidebar, locate
Advanced Componentsand select: Document List - Click
Document List of TicketAttachment - Verify that
Item Entityis set to: TicketAttachment - Set
Document Attributeto: Attachment - Set
User Attributeto: User - Set
Created Attributeto: DateAndTime - Set
Parent Entity Referenceto: Ticket - Click
OK - Click
OK - Save:
Ctrl + S