# History states disappear

**URL:** <https://forums.creativeclouddeveloper.com/t/history-states-disappear/8020>\
**Category:** Photoshop\
**Tags:** bug, uxp\
**Created:** [June 18, 2024, 1:43pm UTC](https://forums.creativeclouddeveloper.com/t/history-states-disappear/8020 "2024-06-18T13:43:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rbrowning](https://avatars.discourse-cdn.com/v4/letter/r/dfb087/32.png) [@rbrowning](https://forums.creativeclouddeveloper.com/u/rbrowning)\
**Post date:** [June 18, 2024, 1:43pm UTC](https://forums.creativeclouddeveloper.com/t/history-states-disappear/8020/1 "2024-06-18T13:43:22Z")

</div>

I use this line of code:

require(‘photoshop’).app.activeDocument.historyStates

Which is fine for iterating the history and doing what I need to. However, the user saves their work as a PSD, closes PS and later on reopens the PSD. History states is now empty (shown by the empty history pane) and when I export, I now have no history being passed.

I notice if the history logging has been switched on (in preferences) that I can view the history, which has been restored in the history (File\>File Info). Presumably this is from the metadata.

My first question is is there a way to access this history from UXP like the above line of code does?

Secondly, if not, how would I go about accessing the meta data? I could write a manual parser for the XML and extract the history myself.

@kerrishotts @Jarda

---

<div class="post-metadata">

**Author:** ![rbrowning](https://avatars.discourse-cdn.com/v4/letter/r/dfb087/32.png) [@rbrowning](https://forums.creativeclouddeveloper.com/u/rbrowning)\
**Post date:** [June 19, 2024, 9:34am UTC](https://forums.creativeclouddeveloper.com/t/history-states-disappear/8020/2 "2024-06-19T09:34:31Z")

</div>

Resolved it.

```auto
    const app = require("photoshop").app;
    const { XMPMeta, XMPConst } = require("uxp").xmp;
    const xml = getDocumentXMP();
    const xmp = new XMPMeta(xml);

    const history = xmp.getProperty(XMPConst.NS_PHOTOSHOP, "History");

```

Then iterate the history.value.
