I need to be able to override the modified date of an article. I followed the documentation and was able to set the published.from using the contentlib modify method.
I was able to modify the created date easily, with GitHub - runarmyklebust/createdFix but that don’t allow me to update the modified date.
Since XP 6.9.x, you can use the Node library to do this.
Include lib-node in your build.gradle
Require /lib/xp/node in your JavaScript controller
Use the connect() method inside the Node lib to connect to the content repo (with ID ‘cms-repo’)
With the RepoConnection object that is then created, use its modify() method to set a new value for modifiedTime. You do this using an editor function, as per the example in the Enonic XP JavaScript Library reference documentation
You can then use the push() method from the same RepoConnection to push your changes to the Master branch if desired
NB! Be very careful when changing content data through the repo API, as this bypasses all validation rules for the data (like going directly to SQL to manipulate data created by an application). However, the suggestion from @bhj should work fine. An alternative is to export the data, modify the export and import the data again.