I have encountered the same issue before.
The main issue here is that the Java actions of the TcConnector retrieve the TcConnector.TCSession and/or TcConnector.Cookie from the database using the session of the current user. The CurrentSession that is used to retrieve the TCSession / Cookie, however, has not been committed to the database. The task queue creates a new session for the user.
The way to solve this is to commit $currentSession at the start of the microflow that is performed on the TaskQueue. This needs to be done in a separate transaction (using commitInSeparateDatabaseTransaction Java action from CommunityCommons).
Hi Mohammed,
We've integrated Teamcenter with Mendix in our application as well (built on version 9.18.3). To handle background operations, we created a dedicated Teamcenter user in Mendix, which is used to run microflows via Scheduled Events.
In the Community Commons module, there's a Java action called ExecuteMicroflowAsUser
. You can use this to run your required microflows under the context of the Teamcenter user, which helps avoid session-related issues. Please refer the attached Image.
Hope this helps!
I did it recently but I had difficulties too.
I upgraded this app from 10.12 to 10.18 and the behaviors changed.
In 10.12 I had to fork the community commons action, but in 10.18, my fork stopped working and the updated community commons worked…
something makes my case special (and experimental), I have two levels of scheduled tasks. First level is parsing a large bom, which generate the second level for batch processing of the parts. I did assign 2 different mendix users for each, and maybe it helped.