Changes

Jump to: navigation, search

SmartCheck Validation

639 bytes added, 18:40, 25 May 2017
no edit summary
=Overview=
 
SmartCheck Validation is a secure server side validation method. It enables custom field validation ensuring that applications and form inputs meets specified criteria and returns. It provides a better user experience than other validation methodologies and is preferred over Submit Logic. With SmartCheck, the user can see error messages in context and in one central place.
Before SmartCheck Validation, some error message would pop up individually, one after another, and some messages would appear in one box at the top, depending on how you setup your validation.
[[image:Smartcheck validationOLD.png]]
[[image:Smartcheck validation1.png]]
Clicking on the '''x''' within the in context error message, such as the description field above, enables you to temporarily hide the message. Clicking the error message at the top will bring the cursor to the field where the error is present (if there is a corresponding input).
Before you can use SmartCheck validation you must . . .
1. Configure SmartCheck Validation
=Configure SmartCheck Validation=
=Configure SmartCheck Validation=SmartCheck Validation can be configured for each object type in the system (i.e. individual [[Entity|UTA Level 1/2/3]], company, user, transaction) and then be attached to a Submit button.
1. Each entity will have a SmartCheck Validation link available in the corresponding Settings page. Click on this to begin the process of configuring the SmartCheck validation statements.
[[Image:SmartCheck1.png|700px]]
2. The Smartcheck Validation list view will display. There will be a '''New Validation''' button along the top. Click this.
[[Image:SmartCheckLV.png|800px]]
3. The SmartCheck validation screen will display, comprised of the following 3 tabs . . .  * Main
* Code Builder
* Source
4. Enter appropriate name and description text into the relevant fields on the Main tab and click Save.
[[Image:SmartCheck2.png|800px]]
5. Navigate to the Code Builder tab to add validation using 2 possible approaches.
* ''New validation:'' Use the drop-downs at the top of the screen to create new validation. Further details on the options available are provided in the SmartCheck Validation Structure section below.
[[Image:SmartCheck3.png|800px]]
 * ''Existing Submit Logic'': Use the drop-down at the bottom of the screen to select a submit button and any existing validation associated with this button.
[[Image:SmartCheck4.png|800px]]
6. Click on the Insert button under the relevant section. This will take you to the Source tab, and show the updated validation statement.
[[Image:SmartCheck5.png|800px]]
8. Use the Trial Run at the bottom of the Source tab to check whether there are errors when the validation statements run.
 
=Add SmartCheck Validation to Submit Button=
 
Once the validation statements are created you can start to add the logic to [[Submit & Save Buttons|Submit or Save buttons]].
2. The Submit & Save Buttons page is displayed, showing a list of configured buttons. Click on the Edit button for the one you wish to edit.
3. Select the SmartCheck Validation option from the corresponding drop-down
[[Image:SmartCheck6.png|800px]]
4. Click Save at the bottom of the page.
=Enable SmartCheck Validation=
=Enable SmartCheck Validation=
# In the top header, click the '''Configuration''' drop down.
# Select '''Global Settings'''.
=SmartCheck Update History=
=SmartCheck Update History=Changes to the SmartCheck logic can be tracked using the Update History feature, which is available against each configured SmartCheck validation.
[[Image:SmartCheckHistory.png]]
If user clicks on the Update History button then are presented with an overview of all changes made to that specific SmartCheck validation, including date and time and the person who made the change.
[[Image:SmartCheckHistory2.png|600px]]
Users can also compare versions by checking the box on the left of the list view and then clicking on the Compare button.
[[Image:SmartCheckHistory3.png|500px]]
=SmartCheck Validation Structure=
 
Each SmartCheck Validation statement shares the following structure:
* '''If''' Statement (condition to be tested)<br />* '''Result''' (assigned result based on the condition)<br />* '''Message''' (to be displayed when result is false)<br />
Recognize the If, Result, Message structure:
<pre>if(ssParseNum(form.getStr("cf_Store Value")) > 5)
</pre>
Check '''If''' the contents the of the form value (stored in the custom field named cf_Store_Value) is greater than 5,  
<pre>{result.isPassed=false;
</pre>
Assign the value of the '''Result''' to '''"false"''' and print the custom message below.
 <pre>result.addMsg('Some message here');
}
</pre>
<pre>if(form.getStr("sf_Application Name") == "")</pre>
 Here is how it looks when you call the Stored Value for the same standard field:
<pre>if("@Application Name@" == "")</pre>
Notice the stored value calls the field using the variable syntax we learned in the variable processor lesson.
Notice the stored value calls the field using the variable syntax we learned in the variable processor lesson.
<pre>result.addMsg('Your message goes here.'); }</pre>
 
Here is how it looks when you call a Field message on a custom field:
 
<pre>result.addMsg('cf_@field name.id@', 'Your message goes here.); }</pre>
 
Notice the field name is added before your message, so the system knows where to place the validation message, and the system knows where to bring your cursor should you click the message.
 
 
 
=Configuring Messages for Multilingual Systems=
Messages can also be displayed in different languages based on the user's language of choice within the portal. The langid variable for the language must be included within the syntax to tie the message to a particular language setting.
The message below would only be shown for the English language:
Here is how it looks when you call a <pre>result.addMsg('Your message goes here.', 1); }</pre> The langid could also be used for Field message on a custom fieldmessages:
<pre>result.addMsg('cf_@field name.id@', 'Your message goes here.', 1); }</pre>
'''Important:''' The langid variable cannot be selectively applied to the messages, it must be included in every SmartCheck message within the system.
Notice the field name is added before your message, so the system knows where to place the validation message, and the system knows where to bring your cursor should you click the message.
===Comparing a date custom field to the current date===
<pre>if ((ssConvertDate(form.getStr("cf_Individual Review Start Date"), "@dateformat@", "yyyy-mm-dd") > "@date(currentdate)@"))
{result.isPassed = false;
result.addMsg('cf_@Individual Review Start Date.id@', 'Please enter a date less than or equal to today for the date.');
===Comparing a date custom field to a date that is six months ago (date must be at least six months ago)===
<pre>if(ssConvertDate(form.getStr("cf_Date"),"@dateformat@", "yyyy-mm-dd") > "<!--@sscalculation(DATE_ADD('@date(currentdate)@', INTERVAL -6 MONTH))-->")
{result.isPassed=false;
result.addMsg('cf_@Date.id@','Date must be at least 6 months prior to today's date');
===Date custom field blank===
<pre>if ((ssConvertDate(form.getStr("cf_Project Start Date"), "@dateformat@", "yyyy-mm-dd") == "yyyy-mm-dd"))
{result.isPassed = false;
result.addMsg('cf_@Project Start Date.id@', 'Project Start Date is a required field.');
0
edits

Navigation menu