ColumnsControl element
The ColumnsControl control displays the input field on the form for entering values directly into the ticket fields.
ColumnsControl generates the entire form input field with description. For basic functionality, you need to set the displayed fields (e.g. ShowColumns = "tHdTicket.mHdTicketNotice"), or required fields (e.g. RequiredColumns="tHdTicket.mHdTicketNotice"). Fields are displayed in the order specified from top to bottom.
Each ColumnControl element needs to be initialized. In the .cs file in the ConfigControls() function, use the following line for each ColumnsControl element used on the form:
((DynamicModel)Model).GetControl \<columnscontrol> <ColumnsControl>("ColumnsControl0");
Use the name of your element instead of ColumnsControl0
.
If you insert this control into the form between <div id="CustomFormContent" and </div>, the values will be automatically saved when the CreateTicket function is called. The control can be used multiple times on the same page. See below for possible additional settings and an example.
We recommend that you configure ColumnsControl using the attributes on the page ( .cshml). ColumnsControl can also be configured in code ( .cs).
To keep these fields from being added to the ticket text, you need to place it outside of <div id="CustomFormContent" and </div>, but then you need to manually save the filled values by calling the UpdateColumns(...) function for each ColumnsControl and each ticket created.
When the page is displayed, the ColumnsControl tries to get the SectionId automatically from the specified web address. If the web address contains the address parameter iHdSectionId=number, the "number" is used as the ID of the selected service unless set otherwise. (E.g. https://app.contoso.com/Custom/ALVAO/NewTicket\_Template/?iHdSectionId=11 contains service ID #11. This will automatically be set as SectionId.) This functionality can be disabled by setting SectionId="0" or by setting a specific service.
ColumnsControl performs a basic rights check:
If TicketId is set, the logged-in user needs to be able to view this ticket otherwise the user is redirected to an error page.
Parameter format
The following parameter formats are used in attribute and function descriptions:
- columns - a list of columns in the format " table1.column1, table1.column2, ...". In this way, one or more columns can be defined for the current ColumnsControl. Allowed columns:
table.column | Ticket field | Notes |
---|---|---|
tHdTicket.mHdTicketNotice | Notes | |
tHdTicket.sHdTicketGroup | Group | Allows values other than the predefined values. |
tHdTicket.sHdTicketDeviceCode | Device number | |
tHdTicket.FeedbackSolveSpeed | Solution Speed | |
tHdTicket.FeedbackProfessionality | Professionalism | |
tHdTicket.FeedbackExpertise | Excellence | |
tHdTicket.FeedbackComment | Comments and Notes | |
tHdTicket.RelatedAccountId | Related Organization | |
tHdTicketCust.* | custom fields | The individual columns in the tHdTicketCust table that represent custom fields. Instead of an asterisk, specify the name of the specific column. |
- sectionId - service id
- sectionNamethe full name of the service, including the path (e.g. "Helpdesk/Problems")
- mode - one of Edit (default) and View
- msg - string containing the text displayed for the unfilled required field
- ticketId - the ticket number to view/save
Attributes in cshtml
- ShowColumns - columns to be generated per form and stored in db. The columns are displayed in the specified order from top to bottom.
- RequiredColumns - columns that must be filled to enable saving. These columns must also be in the attribute. The order does not matter.
- SectionId - sets the ID and name of the service. This influences the values to select for the code list items (if values are defined for a specific service).
- SectionName - sets the ID and name of the service. This affects the values to select for the codebook items (if values are defined for a specific service).
- Mode mode - sets the display mode.
- TicketId - sets the ticket ID to edit/display/save.
- CssClass - css style class.
- IgnoreColumns columns - columns that will not be displayed.
- IncludeServiceColumns- flag whether to display columns according to the service process specified in the SectionId
- IncludeRequiredColumn - flag if required columns should be displayed according to the service process specified in SectionId.
Functions
It is not necessary to use these functions for the basic functionality of the ColumnsControl element.
- UpdateColumns() - stores the filled values in the db in the ticket whose id is set by the TicketId attribute.
- UpdateColumns(int ticketId) - stores the filled values in db to ticket number ticketId.
Example of use
Example of displaying the Group (tHdTicket.sHdTicketGroup) and Notes (tHdTicket.mHdTicketNotes) fields. The Group field is mandatory.
- .cshml + autosave (using the CreateTicket function call)
// ... Your form content ...
@Html.EditorFor(m=> m["ColumnsControl0"], "ColumnsControl", new { ShowColumns="tHdTicket.sHdTicketGroup,tHdTicket.mHdTicketNotice", RequiredColumns="tHdTicket.sHdTicketGroup" })
// ... Rest of the form ...
Another example usage can be found in the ~/Custom/Templates/NewTicket_Template.cshtml file and those derived from it.