Skip to main content

Entity Relationships

Add Ticket Notes

Some Support Tickets are complex. This Advanced Topic will enable a user to write instructions or provide notes for how the issue should be resolved. This will be done with an Entity Relationship to the Ticket entity to enable us to better structure our data.

NOTE: This tutorial is built upon the foundation of the Support Ticket application.

For background, there are five main types of relationships:

RelationshipCardinalityC# typeMeaning
Direct nullable0..1Entity?Referenced entity can be assigned to the reference
Direct1EntityReferenced entity must always be assigned to the reference
Composition1 -> NICollection<Entity>One parent has many children
Aggregation0..1 -> NICollection<Entity>Children can have one parent or no parents
Many-to-ManyM -> NICollection<Entity>Many children can have many parents

1. Create a Ticket Notes entity

This step will create a new entity named “Ticket Notes”. The Composition reference type (1 -> N) will be used to allow a single Support Ticket to have multiple notes.

  • Create a new entity. Type: Ctrl + Shift + C to open the general Create Dialogue; select Entity.
  • Name your Entity: Ticket Notes
  • Set the Display Icon. (Suggestions: Use “Sticky Note”.)
  • Mark the Create Display Attribute checkbox. 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. This will generate two pages for the User Interface section (see below)
  • Click Finish
  • Save Changes: Ctrl + S

2. Add Attributes to the Ticket Notes entity

  • In the Data Definition > Attributes section, click Add New Attribute
  • Name it: Notes
  • Set Type to: Rich-text Markdown
  • Click Create Attributes

3. Set References

  • In the Data > Entities subsection, double-click the Ticket entity
  • In the Data Definition > References section, click Add New Reference
  • Set the Reference Type to: Composition.
  • Set Target to: Ticket Notes.
  • Click Create References.
  • Save Changes: Ctrl + S This automatically establishes the relationship between the entities. The Ticket entity is the parent and it can take several notes. The Ticket Notes entity is the child; there can be multiple children but all will be connected to the same parent.

4. Update User Interface

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

A. TicketNotes Create page

  • Click Add View. When the dialog box opens, click OK
  • In the layout editor add Data Fields. Click Title and Notes
  • Click Title
  • In the Validations section, click the Magic Wand and select: Not empty string
  • Click OK
  • Click on Notes
  • In the Validations section, click the Magic Wand and select: Not empty string
  • 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. TicketNotes Detail page

  • In the center of the page, click Add View
  • Click Type and choose Shared View from the drop-down menu
  • Verify that View Entity is set to: TicketNotes
  • Set Shared View to: TicketNotes view
  • Click OK
  • Save changes: Ctrl + S

5. Update Ticket Detail page

  • Go to UI > Entity Pages and double-click on Ticket detail
  • In the Layout section, click the Add Tab Magic Wand (scroll down, on the lower right)
  • Hover over Create Child List Tab and select TicketNotes
  • Click the DataGrid of TicketNotes box
  • Click Configure DataGrid
  • The Columns tab is the default setting
  • Click Add Column
  • Select Notes
  • Click Close
  • Click OK
  • Click OK
  • Save changes: Ctrl + S

6. Deploy and Run the App

  • Click Release
  • Type text for Release Message, if necessary
  • Click Release
  • Click Continue
  • In the sidebar, click Close

    On the App Overview,
  • Click Update App. It may take a few moments
  • Click Start (if necessary)
  • Click Settings for login credentials (if necessary)
  • Click Open Instance to access your app