Updating metadata value


(Joy) #1

Matrix Version: 5.3.4

I have a metadata schema with different select values for the ‘page-type’ metadata i.e. content-page, announcement, form-page etc.

I’m creating a paint layout for a news item which will use the announcement value for the ‘page-type’ metadata.

How do I change the value of the metadata to ‘announcement’ using keywords? So that when a user creates a news item, it will automatically change it. The default value is ‘content-page’.

I’ve tried a few different keywords but they don’t seem to work.

%asset_metadata_page-type^replace:{metadata_field_page-type:announcement}%


#2

Hi @joyjoyc just curious why do you need to check for metadata value of page-type in order to create a paint layout for news item?


(Joy) #3

I’m creating an asset builder for a news item which has some extra metadata fields and a different paint layout from our normal news items.

Normally, when creating a news item, the user would go into the metadata screen to change the page-type to ‘announcement’. I’m wanting to automate this so the user would not have to manually do this.

Am I going about this in the wrong way? Since I’m playing around with the paint layout I thought I could add a keyword in the paint layout to do this.


#4

I am not sure if you are aware that in the Paint layout you can specify the type of asset that the paint layout would apply. So you can create a paint layout specifically for news item.

Or maybe you have other requirements that prevents you from doing that. Otherwise go to the Details screen of your paint layout, and under Layout Settings section you can specify custom asset type.

Hope that helps.


(Joy) #5

Yes I have already done that in the Layout settings but that does not change the page-type in the Metadata.


#6

So I assume you use the page type value for something else?


(Joy) #7

Yep page-type is for something else


#8

I see. I suspected that’s the case.

I don’t know how to do this in asset builder but in Edit+ you can use Edit+ plugin to do this. Check the asset type the user is creating and then update the page-type metadata field.


(Bart Banda) #9

You could do it by exposing the metadata select field on the asset builder screen but hiding it with CSS or something, then using JS to automatically change it so that when the user hits the Create button, the value then gets set without them having to do anything?


(Joy) #10

So there is no keyword replacements I could use?


(Joy) #11

I ended up using a trigger to change the metadata value