=Examples=
===Check an amount is greater than $100,000===
<pre>if(ssParseNum(form.getStr("cf_Amount Requested")) > 100000){ {result.isPassed=false; result.addMsg('"cf_@Amount Requested.id@'",'Amount Requested cannot exceed $100,000'); }</pre>
===Application Name field blank===
===Requested Amount less than X===
<pre>if(ssParseNum(form.getStr("cf_Requested Amount")) < 5000){ { result.isPassed=false; result.addMsg('"cf_@Requested Amount.id@'",'Field test message'); }</pre>
===Number value greater than 5===
===Dynamic XML field has no entries===
<pre>if("@xml.fieldname.sectionnodename.rownodename.nodecount@"==0){ { result.isPassed=false; result.addMsg('"xml_@fieldname.id@'",'At least one entry is required in the XML worksheet.'); }</pre>
===Comparing two custom date fields with separate custom time fields storing 24 hour time===
<pre>if(ssConvertDate(form.getStr("cf_Event Start Date"),"@dateformat@", "yyyy-mm-dd")+' '+form.getStr("cf_Event Start Time") >= ssConvertDate(form.getStr("cf_Event End Date"),"@dateformat@", "yyyy-mm-dd")+' '+form.getStr("cf_Event End Time")){ { result.isPassed=false; result.addMsg('"cf_@Event End Time.id@'",'End Date must take place after the Start Date'); }</pre>
===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.');}</pre>
===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'"); }</pre>
NOTE: When using @sscalculation, you <u>must</u> wrap the syntax in double quotes
===Ensuring an entered date is at least 3 business days away===
<pre>if(ssConvertDate(form.getStr("cf_Date EOI Revision Deadline"),'"@dateformat@'",'yyyy-mm-dd') < "<!--@sscalculation(SS_FUNC.addbusdays("'@date(currentdate)@"',3))-->"){ { result.isPassed=false; result.addMsg('"cf_@Date EOI Revision Deadline.id@'",'Date must be at least 3 business days away'); }</pre>
NOTE: When using @sscalculation, you <u>must</u> wrap the syntax in double quotes
===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.'); }</pre>
===Validation on a Select Many Checkbox Field===
<pre>if(form.getStr("cf_Request Type").indexOf("General Operating")==-1 ){ { result.isPassed=false; result.addMsg('General Operating was not selected'); }</pre>
To trigger when the value is selected, use '!=-1'. This would normally be used in combination with another field for validations.
===Select Many Checkbox field has at least 5 values selected===
<pre>if(((form.getStr("cf_Check Box Field").length() - form.getStr("cf_Check Box Field").replace(';','').length())<=4)){ { result.isPassed=false; result.addMsg('"cf_@Check Box Field.id@'",'At least 5 items must be selected.'); }</pre>
===At least one role is selected on a contact===
<pre>if('"@rolelist@' " == ""){ { result.isPassed=false; result.addMsg('At least one role must be selected.'); }</pre>
===Validation on an e-mail field===
===Application Limit Check via Specific Criteria===
Validating an application via a custom field on the form and pulling that into report criteria.
<pre>var maxstores="TEST@ReportProperty2(32735,exportdata,,'@displ_FY@::@typeid@')@";
var selectedstore=form.getStr("cf_txt_StoreNumber");
var y=maxstores.indexOf(selectedstore);