Updating asset dates using JSAPI


(Jim Smith) #1

Matrix Version: 5.4.1.3

Has anyone updated the dates on the settings screens, that is, the last updated, last published, and asset created dates of an asset in matrix using the JSAPI before? I can’t seem to find an operation on https://matrix.squiz.net/manuals/web-services/chapters/javascript-api that updates them. I’ve found getGeneral will return the current values for dates so I’m hoping there’s an operation to change those values that’s just unlisted.


(John gill) #2

Not possible (with a fairly high degree of confidence).

It’s not a feature I’d expect to see, there will always be purposes where you want to be able to trust those dates aren’t fake. Your best bet would be to add Updated/Published/Created Metadata fields which default to the real values, then set an explicit value for those cases where you want to override the real date.


(Bart Banda) #3

What JohnGill said, it’s not. You could instead potentially fire those updates using a trigger action instead? But I’m interested to hearing why you would want to do that? What’s the problem you are trying to solve?


(Jim Smith) #4

Thanks for the responses. In this case we’re migrating a site in and wanted to match the published dates on files in Matrix.


(David Schoen) #5

I think it’s possible to create a metadata field that defaults to %asset_published% and then render that anywhere you want to display the published date.

This will allow JS API to set the date.

You can also set up a trigger to set the metadata field back to “default” on asset status change (to live) to ensure that future publishes of the asset update the metadata.