Tuesday, 24 April 2018

JD Edwards Orchestration using iterate over for orchestration input

I must admit, I found this one a little frustrating, but good to get it out of the way.

This is solving the problem of the parent / child orchestration (parent child being defined within the input document).

I created a very simple orchestration:

image

Basically iterate over my array of ColourList (sorry USA, this is how well spell it down under), for each of the elements in the colour list, send me an email.

My array is currently true to the word, an array – but it’s not an array of structures yet.

image

A single dimension Array with Colour as the only element.

Therefore, my orchestration should take the input and send me an email with the title of the colour – nice and easy…  For every colour that I list.

But, the real question is – how do I form the input JSON for this function? 

I need to use JSON, as the orchestrator client (below) does not have the tooling to be able to load up arrays, you can see that it’s very one dimensional for the parameters of a function.

image

You need to tick the JSON Input box to get this screen:

image

A little cheat if you have not done it, is fill out the parameters and run the function, you get the JSON in the input box if you’re making a valid call:


image

You have the super basic 1D inputs, now you make this parent/child.  Copy that input and paste it into your favourite JSON editor – you are going to need it.

Below is a template multiple level (parent child input that works for my function)

This is going to save quite a bit of heart ache

{
   "inputs" : [ {
     "name" : "SingleInputString",
     "value" : "Hello"
   }],
   "detailInputs": [{
    "name": "ColourList",
    "repeatingInputs": [
      {
        "inputs": [
          {"name":"Colour","value":"Pink" }
        ]
      },
      {
        "inputs": [
          {"name":"Colour" ,"value": "Red" }
         ]
      }
   ] }
   ]
}

There is a lot of verbage here and a lot of terms that need to be in the JSON, otherwise it will not iterate, trust me.  I tried many combinations.

You need to ensure that you use the object “repeatingInputs” – casE sensitive.  You need to also include inputs array

To Get 4 emails, I post the following JSON

{
   "inputs" : [ {
     "name" : "SingleInputString",
     "value" : "Hello"
   } ],
   "detailInputs" : [ {
     "name" : "ColourList",
     "repeatingInputs" : [ {
       "inputs" : [ {
         "name" : "Colour",
         "value" : "Pink"
       } ]
     }, {
       "inputs" : [ {
         "name" : "Colour",
         "value" : "Red"
       } ]
     }, {
       "inputs" : [ {
         "name" : "Colour",
         "value" : "Blue"
       } ]
     }, {
       "inputs" : [ {
         "name" : "Colour",
         "value" : "Turquoise"
       } ]
     } ]
   } ]
}

Nice!  Here is my inbox.

image


I’ve been using an online JSON editor, because the orchestration client (bless it) does not help my crappy syntax.  This is great!

image

You know that you’ve made a mistake in JDE, if you hit for format button and it bombs – your JSON is bad

image

If it’s good, it’ll look nicely formatted, but this does not mean that the document is formed correctly.  You could not be using key value pairs, and it’ll still format, just nothing will work on the AIS server!

All you need to do is follow my basic template above and all will work.  Here is a copy of my orchestration too – just in case you want to test the document yourself.

Note that the service request is hard coded to send an email to me, so you might want to change that.

You can grab my code here: https://drive.google.com/file/d/10KBi7XNuqnSIYwzgb921lTqvDj0SKTYw/view?usp=sharing 

3 comments:

Manikandan said...

Hey . This was very helpfull.I was spending hours to sort this issue . Thanks dude

Kamal said...

Hi Shannon,
It looks interesting.
I am facing a similar issue.
I am trying to fetch details from a grid which has two lines of data using a form service request. Then calling an another service request (SO Creation) within a same orchestration.
I want to pass the two rows of grid values fetched in the first step to be passed as input to the next from request and need to create SO with two lines.
I am facing issue here, it doesn't work for me. Can you please help me here.
Thank you.
Kamal

Uncle Sam said...

Hi Shannon,

After a year later I found your post very helpful. Thank You so much for such a great work. I m just curios to see how can the same thing be achieved by an passing that json output of one orchestrator to another orchestrator. Somehow when I pass the json input from studio client directly into the orchestrator it is iterating over the data fine. But, when the same json output comes from the calling orchestrator it is not. I ensured the json is correct by calling message service and passing the json object as message body. Just wondering what I m missing.

Once again Thank you for this post.
Regard,
Sam

Extending JDE to generative AI