Groovy Script for JDE Orchestrator: Custom Request Generator
This generator writes a Groovy custom service request for JD Edwards EnterpriseOne Orchestrator that turns delimited text into an array of rows an orchestration can iterate over. It follows the standard custom request template with orchAttr logging, for Tools 9.2 Orchestrator Studio.
Fill in
Custom service request (Groovy)
import com.oracle.e1.common.OrchestrationAttributes;
import java.text.SimpleDateFormat;
// Purpose: Split uploaded CSV text into rows for an iteration over Sales Order Entry
// Inputs: csvText (text with a header line), delimiter (single character, default comma)
// Outputs: rows (array of rows keyed by header names), RowCount
HashMap<String, Object> main(OrchestrationAttributes orchAttr, HashMap inputMap)
{
HashMap<String, Object> returnMap = new HashMap<String, Object>();
String csvText = (String) inputMap.get("csvText");
String delimiter = (String) inputMap.get("delimiter");
if (delimiter == null || delimiter.isEmpty()) {
delimiter = ",";
}
List<HashMap<String, Object>> rows = new ArrayList<HashMap<String, Object>>();
if (csvText == null || csvText.trim().isEmpty()) {
orchAttr.writeWarn("CSV_SPLIT: no input text received");
returnMap.put("rows", rows);
returnMap.put("RowCount", "0");
return returnMap;
}
List<String> lines = csvText.readLines();
String[] headers = lines.get(0).split(java.util.regex.Pattern.quote(delimiter), -1);
for (int i = 1; i < lines.size(); i++) {
String line = lines.get(i);
if (line.trim().isEmpty()) {
continue;
}
String[] cells = line.split(java.util.regex.Pattern.quote(delimiter), -1);
HashMap<String, Object> row = new HashMap<String, Object>();
for (int c = 0; c < headers.length; c++) {
row.put(headers[c].trim(), c < cells.length ? cells[c].trim() : "");
}
rows.add(row);
}
orchAttr.writeDebug("CSV_SPLIT: parsed " + rows.size() + " rows");
returnMap.put("rows", rows);
returnMap.put("RowCount", String.valueOf(rows.size()));
return returnMap;
}Test input for Orchestrator Studio
csvText: Customer,Branch,Item,Quantity 4242,30,220,10 4243,30,240,5 delimiter: ,
Keep the main(OrchestrationAttributes orchAttr, HashMap inputMap) signature and the returnMap exactly as the Studio template defines them; only the body changes. Returning a list of maps as an array output depends on your Orchestrator Studio and Tools release, so test it in the Studio test panel before mapping it into an iteration. The parser does not handle quoted fields that contain the delimiter.
Have your Groovy scripts checked
Send us the orchestration export and we will review the scripts for signature, null handling and AIS load before you promote them.
Optional. The tool and every export work without this. No spam.
How to use it
In Orchestrator Studio create a Custom service request, choose Groovy, and define the inputs and outputs with the same names you enter here (case matters). Paste the generated body over the template, keeping the imports you need. Map the array output into the next orchestration step, for example a form request against Sales Order Entry that runs once per row, by selecting the iterate over option on that step. Use the Test button in the custom request with the sample input to confirm the output before wiring it in.
- Inputs and outputs are defined on the request, not inside the script
- RowCount is a plain string output you can use in a rule (for example stop if 0)
- Keep each script small and single purpose so it is easy to retest after a Tools update
The template behind it
Every Groovy custom request is a function main(OrchestrationAttributes orchAttr, HashMap inputMap) that returns a HashMap of outputs. Inputs arrive in inputMap by name as strings; outputs are whatever you put in returnMap. The orchAttr object gives access to orchestration context and logging: writeWarn writes a warning to the AIS Server log and writeDebug writes only when debug logging is on. Do not rename main or change its parameters, because the orchestration engine calls it by that signature. The same pattern is what people mean by an orchestrator logic extension: logic that a rule or form request cannot express, written as a small script.
Worked example: CSV file into sales orders
A customer sends a weekly CSV of releases. A connector or an upload step passes the file content as csvText. This script splits it on commas, uses the first line as headers and returns rows such as {Customer: 4242, Branch: 30, Item: 220, Quantity: 10}. The next step iterates over rows and calls a form request that enters each line, so one orchestration call creates many order lines. If the file has 300 lines, keep an eye on runtime and AIS thread use; large files are better staged and processed by a UBE.
Common mistakes
The most common failure is a name mismatch: the input in Studio is CSVText while the script reads csvText, so the script sees null. The second is relying on quoted CSV values; this simple parser splits on every delimiter, so either have the sender avoid embedded commas or use a tab delimiter. Third, leaving writeDebug calls inside loops writes one log line per row and floods the AIS log when debug is enabled. Finally, remember the script runs inside the AIS Server JVM: avoid file system writes and long loops.
Frequently Asked Questions
How do I read a CSV file in a JDE orchestration?
Get the file content into a string input, for example from a connector, a file transfer step or the caller's JSON, then use a Groovy custom request like this one to split it into an array output. A following step iterates over the array and runs a form or data request per row.
What is the Groovy function signature for a JDE custom request?
HashMap<String, Object> main(OrchestrationAttributes orchAttr, HashMap inputMap), importing com.oracle.e1.common.OrchestrationAttributes. You read inputs with inputMap.get, put outputs into a HashMap you return, and log with orchAttr.writeWarn or orchAttr.writeDebug. Changing the signature stops the request from running.
Can an orchestration take array inputs?
Yes, orchestrations can define array inputs and outputs and a step can iterate over them, but what is available depends on your Orchestrator Studio and Tools release. Returning an array from Groovy as shown here is a common way to build that array inside the orchestration when the caller sends flat text.
Where do orchAttr log messages go?
They go to the AIS Server log. writeWarn lines appear at warning level, while writeDebug lines appear only when the AIS Server log level includes debug. Use a fixed prefix, as this generator does, so you can grep for your script's lines among the rest of the server output.
If you want your team to ask JD Edwards for this kind of data in plain English, with Groovy and orchestrations as the governed back end on your own servers, we can build that.
Related Tools
JD Edwards Orchestrator and AIS REST Call Generator
Fill in your AIS host, orchestration name and inputs to get a working Python requests script and curl commands that call a JD Edwards EnterpriseOne 9.2 orchestration.
OracleJD Edwards Orchestrator Design Template
A fill-in design document for a JD Edwards Orchestrator orchestration: purpose, inputs, steps, rules, outputs, security and test cases.
OracleJDE Orchestrator API Concurrency Sizing Calculator
Convert peak calls per hour and average response time into concurrent requests, threads and JVM count, with a burst factor.
More Developer Tools tools
See all- JD Edwards UDC Lookup SQL Generator (F0004, F0005)
- JD Edwards F0911Z1 Journal Entry Batch Input SQL Generator
- JD Edwards Received Not Vouchered SQL Generator (F43121, F4311)
- JD Edwards C Business Function Skeleton Generator
- JD Edwards F3002 Multi-Level BOM Explosion SQL Generator
- SAP Sales Order ABAP SELECT Generator (VBAK, VBAP, VBFA)
- SAP Sales Order Create BAPI ABAP Generator (BAPI_SALESORDER_CREATEFROMDAT2)
- SAP ABAP Open Items SELECT Generator
- SAP ACDOCA SQL Query Generator
Keep exploring
Free tools
- JD Edwards Orchestrator and AIS REST Call GeneratorFill in your AIS host, orchestration name and inputs to get a working Python requests script and curl commands that call a JD Edwards EnterpriseOne 9.2 orchestration.
- JD Edwards Orchestrator Design TemplateA fill-in design document for a JD Edwards Orchestrator orchestration: purpose, inputs, steps, rules, outputs, security and test cases.
- JD Edwards C Business Function Skeleton GeneratorGenerate the .h and .c skeleton of a JD Edwards EnterpriseOne C business function that reads one table record by key, returns a value and sets an error correctly.
ERP fixes and how-tos
- How to set up JD Edwards Orchestrator (step by step)Set up a working JD Edwards Orchestrator end to end: enable the AIS server, build a form or service request, wire it into an orchestration, and call it over REST.
- How to Add a Private AI Layer to JD Edwards EnterpriseOne On-PremAdd a private AI layer to JD Edwards EnterpriseOne: AIS data service, Orchestrator, Security Workbench mapping, a local model and human approval.
- JD Edwards API Documentation: AIS REST, Orchestrator, BSSV and Connector OptionsJD Edwards integration options explained: AIS REST, Orchestrator, business services (BSSV), Z-files and third-party connectors such as Concur, with trade-offs.
Runs with your ERP
- Oracle Digital Assistant, OCI AI and JD Edwards OrchestratorHow JD Edwards Orchestrator calls OCI REST APIs for a chat assistant, document understanding and generative AI, with setup steps, pitfalls and on-prem options.
- Oracle CPQ and JD Edwards EnterpriseOne: quote to sales orderHow Oracle CPQ integrates with JD Edwards EnterpriseOne: customer data into quotes, sales orders created from quotes, and status back, with setup and pitfalls.
- Oracle CPQ configure-to-order with JD Edwards via SOA Suite and OrchestratorA Birlasoft implementation case: Oracle CPQ options feed the JD Edwards work order parts list via SOA Suite and Orchestrator, with setup steps and pitfalls.
AI on your ERP
- AI for JD Edwards EnterpriseOne, Built on Orchestrator and AISAdd AI to JD Edwards E1 9.2 using Orchestrator, AIS, and BSSV rather than screen-scraping. Ground a private LLM on F4211, F4111, and F0411 data.
- AI for JD Edwards EnterpriseOne Manufacturing, Without Leaving the F-Tables ExposedGrounded AI over JD Edwards EnterpriseOne Manufacturing: work orders, routings, and Orchestrator data, answered on-prem without sending F-table data to a public model.
Integrations
- How to add AI agents to JD Edwards EnterpriseOneHow to add AI agents to JD Edwards EnterpriseOne: Orchestrator and AIS as the tool layer, read-only first, human approval on writes, on-prem models.
- How to build an MCP server for JD Edwards EnterpriseOneBuild a Model Context Protocol server for JD Edwards EnterpriseOne: tools to expose, AIS and Orchestrator auth, transports, permission scoping and audit.