Rules allow you to go far beyond the simple actions available in the other subcomponents and add more logic to your orchestrations. This is the secret to being able to carry out complex tasks. With rules, you create a pathway through your orchestration, making the appropriate decision at each fork in the path.
Building a Rule in Orchestrator Studio
Note: In the above example, the Search Type could only be a ‘C’ OR a ‘T’. It could never be both values at the same time, so we use a “Match Any” Match Type.
Working with Logic Inside a Rule
In our Add Address example, the rules component allows you to evaluate a statement and decide if it’s true. For example, you can use a simple rule to check a SearchType field and determine whether it is T or C.
If equal to either, it evaluates as true and takes the top “true” path and continues through the rest of the steps. If none are equal to C or T, it evaluates as “false” and takes the bottom path (which results in no further action in this particular example).
Rules can be embedded into a path one after another to create complex decision trees, sifting through to get the data needed for the specific scenario you have in mind. The path can also include form requests and other subcomponents to retrieve and transform additional data along the way.
Scripts to Create Complex Rules
You do have limitations using the basic functionality available in rules. You only have the option of Match Any or Match All. Sometimes, decisions aren’t that simple. For example, you might want to have a rule that checks for condition A & B or condition A & C. In those situations, you can use Groovy script to add this logical capability. With Groovy, you can write a script of actual code and put in any logic you want to evaluate the rule and whether it goes true or false. With custom scripting, you can test for virtually any scenario imaginable using any combination of values.
Next up, we’ll talk about Cross References--the single most underused Orchestrator component. Prepare to learn about a powerful way to make JDE and outside applications work together.