[4.1] Workflow State Action "Http request to node API": document.id missing
Description:
- Low severity
- This issue occurs when a workflow is set to send a 'Http request to node API' right at creation of the document.
-
entry_log.workflow_instance.document.id
gives an empty value in headers or payload.
- The id is sent when the action is manually triggered (with a reset transition)
Steps to reproduce:
- Create a document type
- Create a workflow
- Associate workflow with document type
- create two states 'calling api' (initial) and 'api called'
- Create two state actions for 'calling api'
- a. action one, on entry, add a tag on the document
- b. action two, on entry, calls a http api with payload
{"document_id": "{{ entry_log.workflow_instance.document.id }}"}
(same if in headers)
- Create one state action for 'api called'
- a. action three, on exit, remove tag
- Create a transition from 'calling api' to 'api called', trigger event: add tag
- Create a transition (called reset) from 'api called' to 'calling api'
- Upload a document with document type
- API backend receives
{document_id: ''}
- Open the document, go to workflows, select transition for this workflow
- Manually trigger the reset transition
- API backend receives
{document_id: '1'}
Work around
- Add a new state 'adding tag', set as initial
- Add two actions to this state
- a. action four, on entry, add another tag 'x'
- b. action five, on exit, remove that tag 'x'
- Add a transition from 'adding tag' to 'calling api', trigger event: tag added
- Upload a document with document type
- API backend receives
{document_id: '1'}