I am trying to write an item through a workflow using -
workflowService.write(context.getCurrent().getModels(), context);
After which i am creating a vendor item and AVL for this item in the same workflow.
since it is a transaction, the write happens after the workflow is completed. Hence, if i try to write the AVL line with modelService.write() it cannot find the buyer item as it is not yet saved.
How can i write the item without using modelService.write?
Actually if you are trying to write items and AVL inside workflow your case should work as transaction starts on workflow start and commits on workflow end.
So within workflow transaction is the same and whatever model you write (regardless to way you did it) you can read this model.
So your issue is not about transaction.
Agree with Alexey, this should not be due to a transaction issue if you are using MDS.write() for the AVL. Did you check if the workflowService.write() resulted in any errors?
Yes my bad. This is working in a single transaction. The error was for some other reason. Thanks