Notifications
Clear all

How to write/save a model there and then inside a workflowService, in the same transaction?

3 Posts
3 Users
0 Reactions
951 Views
0
Topic starter

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?

1 Answer
0

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.

GregMerrill 2013-06-11 08:06:00

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?

SONIA KHATRI Topic starter 2013-06-12 00:06:00

Yes my bad. This is working in a single transaction. The error was for some other reason. Thanks