Commit the transaction half way through the code and continue the execution from there.

オフライン

Hi Team,

We have a scenario where we want to commit the transaction half way through the code and continue the execution from there.


For example :

1. We are working on Background tasks implementation
2. Where we want to change the status [property] of the task from "new" to "in progress" at the beginning of the execution of task.
3. After that we execute some business logic.
4. Later we change the status of task from "in progress" to "done"/"failed" based on the result from 3rd step.

What we have observed is Aras considers step 2-4 as a single transaction and commits that at once. But we want to see the change in status of task from new -> in progress [step 2] -> done/failed. [This change of status is must.]

We found an reference from Aras Community, where we can use the "CCO.DB.InnDatabase.CommitTransaction();", to commit the transaction half way and continue from there.

Questions :
1. Are there any repercussions/issues by using the solution that we have found ?
2. Is there any other way to achieve this ?

Thanks !

  • For long running resource consuming tasks you could use the Conversion Server. There is a community project that shows how to run a task in the background.

    If your task is does not need a lot of server resources, you could use async/await or promise call from a Javascript Method. E.g. a button click starts the JS Method. It can then call the various server Methods asynchronously . I used this approach in one of my previous customization and it worked pretty well. You can also react on errors and result.

    I never used CommitTransaction() so far, so I cannot tell you if this would be a preferable approach.