Since a while, I have been facing an issue when I’m trying to publish some modified content in my Enonic App.
First I have my created and modified content successfully
Then, due to some business reasons that content has been updated again including a new status after a validation done by a job executed by Cronjob application from the Enonic store. The problem is after the modification is completed, the publish method failed, leaving the content with a Modified or Expired/Outdated status.
How can I validate the context that you are asking for? However in my test environment I have the anonymous and everyone user permission enabled,I don’t know if you are refering to it.
The thing is that before the publish that I’m asking for, exist another modify/publish method that after executed, it leaves the content in online status. The problem comes after that, the the job runs and do the modify/publish process and that is the one that is ‘failing’ because it leaves the content in modified status but it does update the content.
So the problem at the end is that despite of data update done by the modify process, the publish method does not leave the content with online status.
Short version is that the code is running in a context, the context includes a user among other things. When requesting a page for instance, the context is the logged in user, or the user visiting a webpage. Running as a background job and accessing the storage, context should be specified to run as a user with proper permissions i.e. “system:su” or a user you have created.
Here I have an update.
I have applied the change that you have sugested and it throws a new message.
2019-05-08 17:22:06,239 INFO com.siigo.aurora - (/lib/utilities.js) [AURORA SAYS] “[HOUSTON UPDATE JOB STATUS ERROR]: com.enonic.xp.repository.BranchNotFoundException: Branch with id [draft] not found”