Retrieve asset 'details'


#1

Matrix Version: 5.5

I would like to be able to capture the details of each asset, specifically details of which options have been selected for assets such as forms (form contents).

IE:
client side validation selected?
submission logging (which options selected)
multi-page (yes/no)
etc?

Thank you.


(Bart Banda) #2

Try using the %asset_data_attributes% keyword which gives you a JSON object with all of the asset’s attributes like these.


(Lewis) #3

H @pixelmedia,

I’ve looked at the JS API in Squiz to see if there is any operation in there that would pull this kind of detail back but I can’t see anything obvious. The most detailed operation is getGeneral function but, trying that against a Custom Form on our end, doesn’t yield that kind of detail - just things like published date, who created it and its asset ID for example.

I didn’t have any luck with %asset_data_attributes%


(John gill) #4

js_api.getAttributes or %asset_data_attributes% is the source for this info, but the catch is that the interesting attributes for a form are on the Form Contents asset, not the top level Custom Form asset.

Given the setup

image

the vast majority of the attributes are on #311, not #310.

> Object.keys(await js_api.getAttributes({asset_id:310})).length
4
> Object.keys(await js_api.getAttributes({asset_id:311})).length
107

(To complicate things, the more complex attributes are also PHP serialized, so you’ll need to include a JS library to unserialize them before you can use them.)