# Making Sense of Logic Extensions in Orchestrator

Logic Extensions are another new feature in JDE EnterpriseOne Orchestrator from Oracle. This new component is intended to largely replace the dependence on developers to create custom scripts written in Groovy, JRuby, or Jython. If business analysts can learn the ins and outs of this component, they take on even more of the citizen developer role.

## What Logic Extensions Provide for JDE Orchestrator Users

Logic Extensions make it possible to perform string/date manipulation, simple math formulas, and complex calculations within orchestrations without using Groovy script, JRuby, or Jython.

Quick Examples:

- Calculate a date offset (months, days, years) based on an input date
- Concatenate string values or pad leading spaces or 0s
- Create custom mathematical formulas
- Read and update user reserved and future use fields in a JDE table
- Calculate COLA adjustment for a list of all active employees

This new functionality is available in a graphical user interface featuring plain language to make it accessible to non-coders. Users who are accustomed to creating calculations in Excel will likely find it familiar.

This is the explanation of this new component from Oracle: “Logic Extensions further expands the capabilities of the extensibility framework by enabling you to use the familiar syntax of the JD Edwards Event Rules language to create custom logic without the need for a development client and without the need to build and deploy a package. Just as form extensions enable you to modify forms and data extensions enable you to modify the data items you see on a form; logic extensions enable you to create business logic to perform operations such as string manipulation, arithmetic calculations, conditions, loops, and even table I/O.”

## There Is a Learning Curve with Using Logic Extensions

Based on our exploration of this new component so far, it may not be as simple as it first appears. You don’t have to know scripting languages, but you do need to be very good at architecting solutions. Knowing what kind of answer you are trying to get is the first step. Knowing how to set up the problem is the second, and that’s where things get tricky.

Why the complexity? JDE has an alias for every field on every screen (this is the “data dictionary”). This component relies on JDE’s data dictionary values to define every input and output for the Logic Extensions.

Let’s take a look at the four icons on the left side of the screen.

Data Structure: This defines the inputs and outputs for the logic extension. What makes this challenging is that you have to use a valid JDE data dictionary value. In JDE, every field on every screen has an alias. You have to pick from one of these available aliases. If you don’t know these, you will have to do some research to figure out which ones have the attributes you need.

Variables: These are like data structures but are for only inside the Logic Extension. The internal variables aren’t visible to the overall orchestration.

Logic: This is where you lay out the actual logic. You have 6 different options.

**Assignment.**Use this to assign a fixed or calculated value into a data structure or variable.**If/else or if/then.**Use this to evaluate a conditional statement.**While.**Use this to iterate over a data set in the logic flow.**Table IO.**Use this to read, add, update, or delete records directly to/from JDE tables (although you might want to think twice about doing this within a logic extension since you don’t get the validation or security that you would using a form extension that works at the application layer).**Errors.**Use this to return JDE or customer error messages.**Return.**Use this to stop execution and return output in the current state of the logic flow.

Test: This is for testing the logic extension.

## Building a Logic Extension for an Orchestration

In the example below, we are taking a date that’s formatted as MM/dd/yy and reformatting it to yyyy-MM-dd to meet the specifications for an exchange rate API.

How did we build it? First, we stored the month, day, and year separately because we have to handle each one separately in the logic flow.

Once you select the variable you want to store something in, you have a list of options pop up on the right that you can work with.

- Data Structure (input/output/access key)
- Variables (as defined earlier)
- Literal Value (to hard code a value)
- System Literals
- System Constants (Success, error, etc.
- System Variables
- Expressions (mathematical expressions for simple calculations)
- Math Functions (for more complex formulas)
- Text functions (such as concatenating or padding strings)
- Date Functions (to return specific dates for the day/month/year)

From these options, we select the functions needed to manipulate the inputs and outputs for month, day, and year.

It seems like you would be able to simply concatenate these all together. However, it’s not possible to do this directly because we need a two digit month and a two digit day to pass into the orchestration. So, we need an If/Else statement so that a month less than “10” gets a “0” added at the front of it. Same with the day. There is no date formula that does this for you, so you have to build out each step separately.

As a result, we end up with a complicated logic flow with many different components.

This is what the whole thing looks like.

In contrast, this is what it takes for Groovy script to accomplish exactly the same outcome.

## What Does This Mean for JDE Users?

Whether you learn how to do some coding or you learn to build what you need with logic extensions, it’s likely to take a little time to become familiar with this component.

Are you playing around with this and learning new things? We’d love to hear your use cases and how you built your Logic Extensions.

If you need help with this tool, be sure to reach out for training or consulting. We’re here to help you make the most of JDE Orchestrator every day.