I am trying to save the new record into database and then in the same code trying to access it through the code. Unfortunately the record was not being saved the time my access code runs. So I always get the old record.
Does anyone know how can I make the record firstly saved to database and then only my code should run.
I am using BPM Post Processing execute code customiztion.
Do you need to have that record there in the middle of the processing? Or can you save the data you want to access later in CallContextBPMData, then write it out at the end?
Yes I need it in the middle of processing. What I am doing is that on code db.Savechanges() I am calling a BPM that sends a print job and now I want to read this record of print job from screen montitor in systask table simultaneously.
The issue is that I am only getting the old record not the latest that just stored, I tried to stop BPM for 10 second but does not work.
likely becuase the default is read committed and the changes in your transaction have not been committed yet and really won’t be until the server call is wrapping up.
Can you do what you need in a Data Directive? YOu can do a standard data directive which deliberately fires off after the transaction is completed to allow complex tasks to occur without slowing he application for the user. If you could set a flag in a context dataset or on a row in the DB and then check that flag and do your activity from the standard data directive you can probably achieve what your after.
A data directive on a table will fire whenever a record is updated - so you check the flag there and perform your action - making sure to turn the flag you use off so it doesn’t happen again. teh best spot is probably a column in the BPM CallContext tableset you can access in the BPMs.