Workflow condition, loop through child table

For a custom workflow I would like to use the new conditions field (introduced in v11). We would like to allow a specific transition when all Items in a child table have a certain field set.

Some background:
DocType: RMA
RMA contains multiple Items (child table)
One workflow transition is only allowed when the field ‘Warranty’ is set to ‘Yes’ on all Items inside the child table. So the condition would be something like this:

for row in doc.items
item[row.idx].warranty = ‘Yes’
end for

This means the transition is not allowed when only a few Items are under warranty.

Is it possible to check multiple rows in a child table for a Workflow condition? If so, what would be the syntax?


1 Like

Hey can you find the solution for this?

did you find any solution ??

[row for row in doc['items'] if row.warranty]

if use this,
[row for row in doc.items if row.warranty]

there will be error message

TypeError: ‘builtin_function_or_method’ object is not iterable


it is throwing this error???

No, unfortunately I didn’t find any solution…

This is working for me.

This is my condition for checking if the session user is in the child table(doc.manager_list) in the form. If yes then the session user is allowed to approve the document:

[row for row in doc.manager_list if (row.user_id == frappe.session.user)]

1 Like

its said frappe not defiend

Hello Dear,

I am also facing a similar issue; I tried your method, but it did not work out for me. showing errors as follows:
WhatsApp Image 2023-01-14 at 16.58.02

if you are using doc.items to get items child table value, please change to doc[‘items’] or doc.get(‘items’), because items is a special reserved method.