Part 11 — Validation

· Here we will be automating the vacation request form. In this way we can keep a check on whether the employee is asking for more than the approved number of leaves or not. Using the Validation Scrit, we can upfront inform the employee as how much more leave they can take as per leave policy.

· Go to the edit mode and workflow section

· Please note that you can change the section by clicking on the down arrow above in the script block as shown in the below image

· So validation script we are planning to add is for Vacation Request form. That’s where system should generate pop up notice to the employee if he / she is crossing her eligible number of holidays.

· Click on left under Forms column, Form Actions → Validate (We are chosing validate to validate the value before creating record and after submitting the form. It will create the record only once accepted by the basic rule i.e. eligibility on number of rules. So on Validate is the Form Actions we need to chose here.

· Here lets go to Free Flow Script Builder.

· We get option to do little bit of scripting.

· However, few of drag & drop options is pretty much available here.

· As mentioned earlier, the validation will happen on existing data of number of days takent off for which we need to fetch the existing data. So drag and drop “Fetch Records” under “Data Access” which is under “Deluge Tasks” as shown in the below image.

· Deluge is beautifuly designed to help the script writer with suggestions as show in the below image. When move the curser from one script to another it guides us on the kind of input we should be doing.

· Lets give a name under Variable (as shown in the above image).

· Variable = daysoff (Just giving a name for the total variable)

· Form = Employee Information Data1 (From where the data is fetched)

· Field = ID (It’s the name given to store the records which are in multiple digits which deluge gives to store the name to create unique identity)

· Ops = double equals (We are telling Deluge that the the ID number which is equal to the employee name in the Employee Information Data1)

· Expressions = Employee_Name (Name of the Deluge Name for Employee Name we have given)

· So the final code looks like below

· daysoff = Employee_Information_Data1 [ ID == input.Employee_Name ].Holidays_Take;

· The above means that we are creating a variable named daysoff which will store the number of holidays taken by the Employee whose information is stored under Employee Information Data1 form.

· Lets add a condition now to throw up the message when somebody is trying to take off which they are not eligible for.

· Drag “if” condition

· Then lets write a script to tell the Deluge as when to run the script.

· The condition is to check whether number of days employees are asking for is within the limit we will write the below code which I will explain again

· daysoff = Employee_Information_Data1 [ ID == input.Employee_Name ].Holidays_Take;

if ( (input.Number_of_Days + daysoff) > 20)


daysremaining = (20 — daysoff) ;

alert “You have crossed your permissible days off. You have only “ + daysremaining + “ remaining for this year” ;

cancel submit;


· In the above code what we are saying to Deluge is that if the number of days asked for leave is more than the allowed 20 days then send an alert saying (the text as mentioned within the double quotes) and also say that they are left with “daysremaining” for the rest of the year. Then cancel their request.

· We drag and dropped “if” condition.

· We typed input which means take this piece of information. So we typed input.Number_of_Days (This particular format of Number of Days is what we have as deluge id which has saved so. The same can be found on the left side under Forms Columns for ready reference as shown in the below image.

· Then within curly braces we created one more variable and named it as daysremaining and we stored in it the remaining of 20 days minus daysoff.

· Then we also wanted to send the alert to the user. So drag and drop the “alert” Deluge Task which is under the same heading column and as show in the below image.

· Then we typed the message we wanted to share within double quotes. If you observe we closed the double quote and added a plus sign then added daysremaining and then a plus sign then again double quotes followed with a space and the conclusion of our sentence. This means all the messages will go with the message stored in double quotes but the daysremaining variable varies with user. User 1 has 12 days remaining, User 2 has all 20 days remaining, etc. So we told Deluge to customize as per the user. Note the daysremaining calculation is already told to Deluge.

· Once the user gets this message we obvisously want their submission to be cancelled for which we just inserted “cancel submit” task of Deluge as show in the below image. Please note that this task we have incuded in if condition only. Any quotes has to be within the curly braces else Deluge throws error (this is same with most of the computer languages).

· Now go to the live mode of the app to test it.

· I tried to end for leave for a month i.e. 31 days and it throw the message that I am not eligible and I have only 16 days left to take off. Image shown below.

Those who missed earlier parts, find below fyr:-

Part 1:

Part 2:

Part 3:

Part 4:

Part 5:

Part 6:

Part 7:

Part 8:

Part 9:

Part 10: