Difference between revisions of "Submit Logic"

From SmartWiki
Jump to: navigation, search
(Condition Construction)
(Condition Construction)
Line 46: Line 46:
 
  '''CONVERT("@level2.Reviewer Comments.length@",SIGNED INTEGER) > 0'''
 
  '''CONVERT("@level2.Reviewer Comments.length@",SIGNED INTEGER) > 0'''
  
<pre style="white-space: pre-wrap;  white-space: -moz-pre-wrap;  white-space: -pre-wrap;  white-space: -o-pre-wrap;  word-wrap: break-word;">Note that the above is the '''best practice''' for testing for empty fields, as opposed to using "@level2.Reviewer Comments@"!=""</pre>
+
<pre style="white-space: pre-wrap;  white-space: -moz-pre-wrap;  white-space: -pre-wrap;  white-space: -o-pre-wrap;  word-wrap: break-word;">Note that the above is the best practice for testing for empty fields, as opposed to using "@level2.Reviewer Comments@"!=""</pre>
  
 
2. '''Criteria''': a '''minimum of three''' level 2 items (''of any type'') are required to submit the level 1 item.
 
2. '''Criteria''': a '''minimum of three''' level 2 items (''of any type'') are required to submit the level 1 item.

Revision as of 11:19, 14 November 2014

This feature uses MariaDB syntax
  • This feature works in conjunction with the Submit Buttons, and provides for the creation of any number of submission rules that control a submission process.
  • When a submission process is controlled by submission logic, then values at other levels can be validated.
  • Values are validated based on the sequence defined within the submission logic.
  • From Level 1 the submission rules can access any field at Level 1, account/contact fields, as well as aggregated fields at Level 2 and/or Level 3.
  • The Submit Logic feature is associated with a particular status and submit button. Associating the conditions with each status and button allows for different statuses to control sets of Submit Logic rules.

Accessing the Submit Logic Function

To access the Submit Logic feature:

Click the Settings tab within the UTA, then on the Statuses link in either the Level 1 settings section, or Level 2 settings section.

The Submit Button tab is displayed next to the Status Trigger tab. Click on this or scroll down to the Submit Button section.

SubmitButton1.png

Click on the hyperlink in the Label column for the Submit Button that you intend to add logic against.

In the resulting window scroll down to the Submit Logic section.

SubmitLogic.png

Click the New button to begin adding a New Condition.

Each Condition consists of the following fields:

  • Order - the order in which the condition can be executed. Each condition is executed in sequence based on the order. When all conditions have executed, any failed conditions will stop the submission process and all messages for failed conditions will be displayed in a consolidated fashion.
  • Name - a narrative name for the condition.
  • Description - narrative description of the condition.
  • Pass Condition - stores the expression that represents the condition. Entity does not change status when condition evaluates as false.
  • Failure Message - stores the message to be displayed if the condition is not met.

Condition Construction

Conditions consist of references to fields and aggregate functions and use the same syntax as the Template / Type Formula.

Conditions should be constructed so that they evaluate as TRUE when you want the record to be submitted.

The Message will display when the condition evaluates as FALSE, and the record will not be submitted.

The following examples illustrate various examples of the submit logic:

1. Criteria: The Reviewer Comments field at level 2 must not be left blank.

"@level2.Reviewer Comments.length@"*1 > 0 
  OR
CONVERT("@level2.Reviewer Comments.length@",SIGNED INTEGER) > 0
Note that the above is the best practice for testing for empty fields, as opposed to using "@level2.Reviewer Comments@"!=""

2. Criteria: a minimum of three level 2 items (of any type) are required to submit the level 1 item.

@level2.count(*)@>2

3. Criteria: a minimum of three level 2 items where the type is email are required to submit the level 1 item.

@level2.count(*):typename='email'@>2 

4. Criteria: a minimum of three level 2 items where the type is email and the status is closed (for both items).

@level2.count(*):typename='email' and statusname='closed'@>2

5. Criteria: the submission cut-off date and time has not passed

"@datetime(currentdate)@"<"@datetime(level1.Contract Start Date)@"
Note you will need to create a System Variable that stores the cut-off date and time in the following format: yyyy-mm-dd hh:mm:ss (24 hour clock)


Additional examples:

  • CONVERT("@level1.fieldname.length@",SIGNED INTEGER) > 0 - Ensures that fieldname is not empty.
  • @company.commission rate@ > 0.3 - the commission rate for the associated company must be greater than 0.3 (30%).
  • @branch.name@ = 'xyz' - the associated branch name must be 'xyz'.
  • @total salaries@ < 400000 - the total salaries field in the Level 1 Entity is less than 400,000.
  • @level2.sum(megawatts)@ > 5 - the sum of the megawatts field in all level 2 is greater than 5.
  • @level2.sum(#12345#)@ > 5 - same as previous example but using the custom field ID.
  • '@opportunity.peopleid@'!='0' - Ensure that a contact has been added to the Level 1 Person standard field.
  • '@contacts.count(*):rolename='Supervisor'@=1' - Ensure there is exactly 1 contact at Level 1 with the role of Supervisor.
  • '@companies.count(*):rolename='Funding Agency'@<3' - Ensures there are less than 3 Funding Agencies in the Companies section.
  • '@contact.supervisor.email@'!='@contact.referee.email@' - Ensure that the contact assigned at Level 1 with the role of Supervisor is not also assigned with the role Referee.
  • "@level1.Proposal.filename@"!="" - Ensures you have a Proposal uploaded in the single file upload on the Level 1.
  • "@level1.Plan Details.numofpages@"<=6 - Ensures the number of pages for a PDF file upload field is not more than six pages
  • "@level1.Multiple File Uploads.numoffiles@">0 - Ensures the number of files uploaded to a Multiple Files upload field is greater than 0
  • "@level1.type@"!="New Grant"||"@level1.xml.ExternalPeers.peer.peer.nodecount@">2 - Ensures that the level 1 type is 'New Grant' and number of nodes/items entered in the XML worksheet is greater than 2 items.
  • @level1.Amount Awarded.value@ <= 500000 - Ensures that the Amount Awarded field is under $500,000. The .value is necessary when the Amount Awarded field is stored in currency format.
  • INSTR("@level1.[#(?object=activity::criteria=typename='Referee Form' and statusname='Submitted' and eownerid=@me.userid@)~index~#]@","1")=0 - Ensures the current user can't submit more than 1 review
Note that semicolons cannot be included in submit logic criteria. If using list syntax, employ double colons ("::") to separate arguments.

Message Construction

  • Messages are created for each condition providing the user with specific details as to the condition requirement that was not met.
  • The messages display in a pop-up window upon a failed submit logic condition when the user's attempts to submit. If multiple submit logic conditions fail, the messages will be shown in a consolidated pop-up window.
  • Field names and aggregate functions can be used in the same manner as with the condition construction.
  • For example, using the first condition example shown above, a message can be added such as:
At least three appendices are required to submit this proposal but only @level2.count(*)@ were found, please check and then submit the proposal again.
  • This message will display if the @level2.count(*)@>2 evaluates to false
  • The message will appear as follows:
SubmitLogicMsg.png

See Also