I don't see a way to change the bookmarks value, since these are read from the template DOM, which is always read only.
Even a binding won't change that, since this will only take effect on the form DOM, which is the virtual representation of the form created from the template and data DOMs when the form is initialized.
Here an example: A subform (sf1) with a dynamic binding to the value of an embedded textfield (field1).
<subform w="197.3mm" h="284.3mm" name="sf1">
<extras name="bookmark">
<text name="name">My default bookmark name</text>
<text name="color">0,0,0</text>
<text name="style">normal</text>
<text name="action">setFocus</text>
</extras>
<setProperty ref="!data.form1.sf1.field1" target="extras.#text.[name eq "name"]"/>
<field name="field1" y="6.35mm" x="9.525mm" w="62mm" h="9mm">
<ui>
<textEdit>
<border>
<edge stroke="lowered"/>
</border>
<margin/>
</textEdit>
</ui>
<font typeface="Arial"/>
<margin topInset="1mm" bottomInset="1mm" leftInset="1mm" rightInset="1mm"/>
<para vAlign="middle" widows="2" orphans="2"/>
<caption reserve="25mm">
<para vAlign="middle"/>
<value>
<text>Field 1</text>
</value>
</caption>
<value>
<text>My NEW bookmark name</text>
</value>
</field>
</subform>
The setProperty will change the value of the bookmark, but in the form DOM not the template DOM.
You can verify this from the JavaScript console by executing either
xfa.template.saveXML("pretty")
or
xfa.form.saveXML("pretty")
.
Only the latter is updated, but it's NOT the one to be used to create the bookmarks in the PDF viewer.