By Paul Hoch
April 9th, 2014
If we take a look back at the documentation for the previous version (184.108.40.206 – wfp_admin.pdf) we will see that there is an appendix that lists some of the predefined content that ships with the Workforce module. Included in this section is “Predefined Business Rules” which has the basic code related to the built in rules. An example is the “Add TBH Salary” rule. The admin guide gives us the following information:
Add TBH Salary
Adds salaried employees to the selected department.
SET CREATENONMISSINGBLK ON;
VAR numTBH = [NumTBH];
VAR validTBH = 0;
FIX(@CHILDREN(“New Employees”), [Scenario], [Version], [Department], [Year],
validTBH = 0;
IF (numTBH > 0 AND @MAXS(SKIPMISSING, @CHILDREN(“Employee Properties”)) == #MISSING )
“Start Month” = [StartMonth]->”Cal TP-Index”;
“Health Plan” = [HealthPlan];
numTBH = numTBH – 1;
validTBH = 1;
IF (validTBH == 1)
“Grade” = [Grade];
IF ([MarketAdjustment] != 0)
“Market Adjustment”= [MarketAdjustment];
“FTE” = [FTE];
“Position” = [Position];
“Tax Region” = [TaxRegion];
“Employee Type” = [EmployeeType];
“Salary Basis” = 1;
“Pay Type” = [PayTypeExempt];
CALC DIM (“Account”);
“Salary Rate” = “Target Rate” + “Market Adjustment”;
CALC DIM (“Account”);
If we needed to make changes to this rule, to account for our specific environment, it was relatively easy: We could update this one script and we were done. Perhaps we want to add in the ability to include a dental plan. In looking at the above code block, we can see there is a built in “Health Plan” item so logically that is where we would want to add in our Dental Plan member. After adding the appropriate member to the Planning Accounts dimension, modifying our Add New Hires web form and Business Rule, we would now have the ability to include a Dental Plan selection on the Add New Hires process for salaried employees.
Now, let’s step forward to the current 220.127.116.11 version of Workforce. The first thing we might notice when opening the WFP_Admin.pdf is that in the Appendix is that there is no longer a section for Predefined Business Rules!
How do we add our Dental Plan in now?
Let’s look at the same rule in version 18.104.22.168
The Add TBH Salary rule opens up to this screen:
Next, if we look at the Script tab we’ll see the following:
Note: There are approximately 90 lines of code – I just snipped out the top.
It would seem as though we could simply update that code block at the top to include our Dental Plan. However, it’s not quite so simple. This code is not editable. It’s purely for reference. If we want to edit the code we need to edit the Template itself.
Right clicking on the template in the rules area and selecting open on “ADD TBH_T” shows us this:
This contains a graphical representation of the code that is going to be produced by the rule.
The first block determines if this application is multi-currency and then sets some initial values based upon that result.
Next is the “Common Variables Block,” which contains the following code:
Then the code checks to see if there is a Project Dimension in the application and sets further properties.
The next section is where we get to some of the real code:
In this section, it first checks to see if the salary basis entered for the new hire is “Hourly”. Assuming that is a “Y” then it sets more “common variables” here:
Selecting the “Common” block:
Gets us to a point where we can make some changes!
I have highlighted the “Health Plan” part of the code here:
If we compare all of the code in this section to the code in the 22.214.171.124 version we will see that it is fairly similar to what we saw in the old version. There are a few additional checks and some minor code changes but it is at least familiar to what we saw in the old version.
Again, assuming we have added in our “Dental Plan” member to the outline, updated our web form, and redeployed this rule, we might expect that it would work. It might work in some situations but certainly not all.
We have more work to do!
Before we can go further and consider this rule complete, we now need to look at the other part of the Y/N question. At this point, we have only dealt with the condition/check based on this new hire we are adding being an hourly employee.
This “Y/N” question is asking, “Are we talking about adding an Hourly new hire or an Annual new hire?” You may recall that we started by opening up the “Add TBH Salary” rule. Why does it even include a reference to an hourly employee?
More on that in a bit. Let’s finish our updates first.
When we look at the block for “Annual” salary basis we’ll see that there is another variable reference.
Which has this:
Following this Variable section is yet another code block, which is what actually does the work. This code block (the “Common” block) is different than the other code block that is labeled “Common” due to the fact that this code is only for those new hires where we have selected “Annual” salary, not “Hourly” in the Y/N question block.
In this code block we also have a “Health Plan” formula. So, we need to make sure we add in our “Dental Plan” calculation here too.
As an aside: If you are having problems validating this rule (with or without changes) make sure that you put an alias on your Salary Grades in the format of “Grade -1”. It is the word Grade, a SPACE, a dash and then the number. If this doesn’t exist none of the rule will work. This is documented in the WFP Admin guide but it’s easy to miss.
Ok, so now we have updated the rule in both places. Save, Validate, and deploy. We should now have the ability to include a Dental Plan selection within our new hire process.
Back to the question about why there are checks for Hourly vs. Annual salary inputs. If we expand the nodes in Calc Manager, and then expand both the Add TBH Hourly and Add TBH Salary rules we can see that they both make use of the same Calc Manager Template – Add TBH_T.
It is certainly worth noting that by amending the code in our rule we have in fact changed another rule. There could be unforeseen problems that would arise from changing a template that impacts more than one rule so keep that in mind when making edits to the Templates. It would certainly be a good idea to make a copy of both the Rule and the Template for backup purposes before you begin making any updates!