Hello,
I am trying to create a solution to get purchase orders from one database and post them into another database as a sales order. I am using a custom HTTP connector for the data source. The issue that I am running into is that I have an array within an array. It can also pull multiple purchase orders when it is run. Currently it is creating a different sales order for every line inside the purchase order. How do I can dynamically build the array for the line items inside the apply to each for the Purchase Orders?
Solved! Go to Solution.
Hi @Kyoder611 ,
You need to add Set variable action under HTTP action to clear the array variable.
Image reference:
Hope it helps.
Best Regards,
hi @Kyoder611 you can try by creating a varible array to catch the frist array that you need to send into your another Json.
See the example
Proud to be a Flownaut!
Hi @Kyoder611 ,
As @ChristianAbata suggested, you could append the items in the array to a variable and configure it to the Body, like:
Please take a try and feel free to let us know if you have any questions.
Best Regards,
Hi @v-bacao-msft ,
As you and @ChristianAbata I created a variable to append the arrays of the Apply to each 2. This does work correctly on the first record but on all the subsequent records it adds all of the details from the previous records.
Here is my GET
[
{
"ID": "V_TESTAPI",
"PO_NO": " 8481",
"APINVDETs": [
{
"O_QUAN_VIS": 20,
"INVEN": "TEST_1",
"DESCR": "Test Inventory Code"
},
{
"O_QUAN_VIS": 12,
"INVEN": "TEST_2",
"DESCR": "Test Inventory Code"
}
]
},
{
"ID": "V_TESTAPI",
"PO_NO": " 8488",
"APINVDETs": [
{
"O_QUAN_VIS": 11,
"INVEN": "TEST_2",
"DESCR": "Test Inventory Code"
},
{
"O_QUAN_VIS": 18,
"INVEN": "TEST_1",
"DESCR": "Test Inventory Code"
}
]
}
]
Here is the first POST of the Apply to Each:
{
"ID": "C_TESTAPI",
"PO_NO": "8481",
"ARINVDETs": [
{
"M_QUAN_VIS": 20,
"INVEN": "TEST_1",
"DESCR": "Test Inventory Code"
},
{
"M_QUAN_VIS": 12,
"INVEN": "TEST_2",
"DESCR": "Test Inventory Code"
}
]
}
Here is the second POST of the Apply to Each:
{
"ID": "C_TESTAPI",
"PO_NO": "8488",
"ARINVDETs": [
{
"M_QUAN_VIS": 20,
"INVEN": "TEST_1",
"DESCR": "Test Inventory Code"
},
{
"M_QUAN_VIS": 12,
"INVEN": "TEST_2",
"DESCR": "Test Inventory Code"
},
{
"M_QUAN_VIS": 11,
"INVEN": "TEST_2",
"DESCR": "Test Inventory Code"
},
{
"M_QUAN_VIS": 18,
"INVEN": "TEST_1",
"DESCR": "Test Inventory Code"
}
]
}
Hi @Kyoder611 ,
You need to add Set variable action under HTTP action to clear the array variable.
Image reference:
Hope it helps.
Best Regards,
User | Count |
---|---|
94 | |
39 | |
24 | |
22 | |
16 |
User | Count |
---|---|
128 | |
49 | |
48 | |
32 | |
24 |