Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Business Rules have several quirky behaviors that will be addressed in a future release. Please read and understand these points before writing your first business rule. 

...

This rule will produce the expected result. 

Note that the Visual Rule Builder will handle local variables for you. Let's look at another example. If you used the following rule code, you would see that at run-time number control displays NaN (not a number) because, as you saw above, the control update will happen after the rule executes, so the new value is not yet available inside the same rule.

Code Block
if(trigger.clicked){
  string.value = "33";
  number.value =  parseInt(string.value);
}	

Try the same concept using the Visual Rule Builder.

Image Added

Click Rule Code to see the code generated by the Visual Rule Builder. Notice that the VRB adds the local variable "ref_string_value", and uses that to set the control values similar to the rule code example above.

Image Added


Warning

Variables in rules must be unique. Having duplicate variables in the same rule will cause the rule to fail but you may not get an error message.

...

What causes an "Invalid signature detected. Data may have been tampered with" error?

This error message usually displays in multi-step workflows when there is a rule on a subsequent step that executes at form load and updates values inside a signed section in a previous step. Here are some examples and solutions:

Checkbox with Custom Options in a locked Signed Section

Imagine a two step workflow designed with Linked Steps where Step 1 contains a Checkbox control inside a section that the user is required to sign. The checkbox has only one option defined in the Workflow Designer. A Business rule is executed when Step 1 loads to dynamically populate the checkbox with additional options.

The image shows this scenario in use mode after the rule has executed. Notice there are three options for the checkbox now. The user selects all three options, signs then clicks continue.

The workflow is routed to Tasks Lists of users who fulfill the requirements for the next step. When Step 2 loads, the rule is executed again. This combination results in data tampered error.

Image Modified

Solution:

This situation can be avoided by always setting more than one option in the Workflow Designer for any checkbox that will be dynamically populated with a rule.

...

Why does the information for the logged in user change when I navigate forward/backwards in my workflow?

Designers can use a Business Rule  to initialize  fields in the first step of a workflow with information about the logged in user. If your workflow navigates to a different user/role for subsequent steps, and the user navigates back to step 1, the rule executes again when Step 1 loads, overwriting the information in step 1 with the information of the user performing the subsequent step. This is an important consideration whether your workflow is designed using individual or Linked Steps. 

You can improve your rule to account for this. For example, let's say you have a two step workflow. Step 1 executes this rule to fill in the First Name, Last Name, Email and the user id into fields named First Name, Last Name, Email and UserID respectively. Note this rule executes when Step 1 loads.

Code Block
if (form.load) {
    FirstName.value = _data.getParameter('subject.first.name'); 
    LastName.value = _data.getParameter('subject.last.name'); 
    Email.value = _data.getParameter('subject.email');
    UserId.value = _data.getParameter('subject.id');
  }  

When user Michael Stewart executes the first step of the workflow, here is what you see:

Michael clicks continue and the workflow progresses to Step 2 which is designed to be performed by a user with the Manager role, Jerry.

Jerry logs in, and access the task from his Task List. Jerry sees Michael Stewarts information from Step 1:

However, if Jerry navigates back to Step 1, the rule executes again when Step 1 loads and overwrites Michael's information with Jerry's:

To prevent initialized fields from being overwritten if users navigate to a previous step in a workflow, you must add a condition to your rule to only initialize the fields if they have not already been initialized when the step loads. Adding the second line to the rule used in this example ensures that initialized fields will not be overwritten.

...

The image shows what Jerry sees when he navigates back to Step 1 with the modified rule in place:

You can adapt the conditional statement in this example to fit your rule.

Why can't I set a T/F Control to "Required" or "Optional"?

T/F (True/False) controls are automatically required by nature, because they must be either checked (true) or blank (false.) When setting conditions for a T/F Control, you will not see "as Required" or "as Optional." If you need this function, consider using a checkbox control with a single option instead.