Home > Forum > Tips&Tricks > REST Api update fields

REST Api update fields
0

Hello,
I am trying to update some form fields and columns in an item list after some actions.
On my path i have configured a FOR EACH on my item list which is creating/composing JSON payload for my REST. (rows)
However, I am encountering an InternalServerError (500) when attempting to save this data using REST service on path for my current instance.

PATCH: api/data/v5.0/db/#{DBID}#/elements/#{WFD_ID}#


{
"workflow": {
"id": "#{WF:123}#"
},
"formType": {
"guid": "969c349e-ffba-4da3-ab12-1b800fc82a0f"
},
"formFields": [
{
"guid": "5e195656-8397-4997-8e18-2b890b71d867",
"svalue": "#{WFD_ID}#"
}
],
"itemLists": [
{
"guid": "e182eced-f3b7-4451-a278-255f6700f5c6",
"rows": #{RAW:2621}#, // JSON PAYLOAD
"formLayout": {
"editability": "Editable"
}
}
]
}

Is it possible to update item list using REST for current instance using a path (button) i press? for example: we have a simple process: START -> FINISH and on this path i have configured my actions and in the end REST action.

My situation is that, based on this item list, I am performing certain actions for each row, and I want to update some columns back.

Do you have any idea? thanks.

MVP

Hi Maria,

I'm seriously confused right now, at least if I understand everything correct.

You have an item list with x rows
For each row you want to execute some actions and set another column.
The big question mark in my head is, why can't you use the "Change value of a single field" in the for each? This would allow you to set a column of the current row.


That the REST action does throw an error is correct. After all you are in a path transition/automation which checked out the current workflow instance and you are executing a REST action which also wants to check out the instance. This cannot work.

Best regards,
Daniel

Did you know that with WEBCON you can automate virtually any process? Even baking cookies 🍪
 
Speaking of cookies: we use the ones that are essential for our website to function properly, as well as additional ones that help us customize our content to your preferences. If you don’t mind cookies, click Accept. If you want to learn more, explore settings.
Settings