[SOLVED] API entity update status

Hello, I fell a little lost in trying to change the workflow status of an entity.
The workflow is the “default” fibery workflow with Open, In Progress, Done.

With the query below I changed the Name [enum/name] of the whole
workflow state and not the state of the entity.

db_sync_cmd = [
‘[{’,
‘“command”:“fibery.entity/update”,’,
‘“args”:{’,
‘“type”:“workflow/state_Projekt Planung/Task”,’,
‘“entity”:{’,
f’“fibery/id”:"{fib_task[“workflow/state”][“fibery/id”]}",’,
f’“enum/name”:“In Progress”’,
‘}’,
‘}’,
‘}]’,
]

fib_task[“workflow/state”][“fibery/id”] =
ID of the workflow status I got from the query I do initially to get entity information
{“workflow/state”: [“fibery/id”, “enum/name”]}

Instead of updating the workflow entity, you should be updating the workflow field for the entity whose status you wish to change.

Something like this:

await fibery.entity.updateBatch([
  {
    'type': 'Projekt Planung/Task',
    'entity': {
      'fibery/id': '20f9b920-9752-11e9-81b9-4363f716f666',
      'workflow/state': { 'fibery/id': 'd328b7b0-97fa-11e9-81b9-4363f716f666' }
    }
  }
]);

You’ll need to know the IDs of the entity and the In Progress state option

Thank you very much for the fast and helpful answer!!!

The ID for each state will be them same for all entities I assume?
So one ID for Done, one for In Progress…

So I just need to get them once

Yes, correct

Your the best!!! :slight_smile:
Thanks

1 Like