The Add Screen should be created as follows:
Create a New page with a default template – the Add page should not be in the main menu.
Make sure that the URL of the page is set to the Add Link in the Search Results page or the Dashboard or the View Screen
To the Page add a new instance of the ActionForm module. Follow the directions in the ActionForm manual to configure the ActionForm. (See Video Below.)
Set only the minimum number of variables necessary to save the record. Avoid lengthy forms with 10+ fields.
Follow UI conventions in designing the form.
Ensure that all fields are named according to the table names.
All field label names must be dynamic - instead of hard-coding the label name of the field use a MyToken instance to retrieve the field label.
All labels for fields must be stored in the table omni_system_labels
Use the MyToken [OMNI:GetLabel(key='<KEYNAME>')] for the label for the field.
Thus if we want to display the label for Address we will use the token [OMNI:GetLabel(key='Address')] as the label name in the "Title" field in the ActionForm instance - see below:
Add Validation for each field, validators to use are:
Required field validators for required fields
Max Length validators according to the length of the field
Date validators
Email and URL validators
Other special validators – for specific business cases, for instance duplicate prospect names etc. For these cases custom validators will need to be created – see section on custom validators.
Create a Stored Procedure to save the record.
The arguments to the stored procedure will generally all be varchars – appropriate data type conversion must be done in the SP. ONLY fields that are being displayed as REQUIRED DROP-DOWNS can be ints / bit etc. If the DROP-DOWN is OPTIONAL then the field should be a varchar in the SP as it will be passed as an EMPTY String in the case that the user does not choose any value.
If the table contains an inserted_on and inserted_by field ensure that these fields are populated.
The SP must be in a TRY CATCH block and save the record in a transaction.
A success code must be returned in case the SP inserts the record successfully, in case of errors the exception must be returned as an error code.
The SP should NOT return a message to be displayed to the UI.
The list of actions must end with a Message and an OK button to redirect the user to the Landing page – either the Search Results Screen or the Dashboard.
See Video for setting up an Add Screen:
The Add Form can also be configured in a Popup - See Video on configuring an Action Form instance inside a Popup: