Using a trigger to set thumbnail


(Nick Papadatos) #1

Matrix Version: 5.4.3.2

There’s been much on this topic but couldn’t find a reasonable answer.
I have a trigger that I want to set an image as a thumbnail when I set the metadata value to Yes.

Event:
After asset metadata updated.

Conditions:

  1. set tree location > 2019 folder
  2. asset is of type > image
  3. metadata value > metadata selection field > regex match [Yy]es (use this image as the banner Yes/No)

Actions:
1.create link > link as a child of > points to folder 2019 > Using a NOTICE link

Now this is where I get stuck. if I point directly to the standard page asset it works but if I point it to the 2019 folder which is what I want it doesn’t. If I try to use the target asset parameter set value %asset_parent% I get all sorts of errors warnings.

  1. set thumbnail > set new thumbnail > set value > %globals_asset_parent%

I’m guessing I need to use the Get variable name but am not sure which keyword I should be using.

Regards
Nick


(Luke Wright) #2

Hi Nick,

It’s a little unclear as to what your asset structure is. Are the images you’re using directly underneath the “2019” folder, or are they underneath a standard page or something?

If they’re directly underneath the “2019” folder, when using the Create Link action you may be able to use “Current Asset > Keyword > asset_parent” in the parameter map. I’m not sure why directly selecting the “2019” folder and not doing anything else isn’t working for you though, as that seems to be working for me.

I’m not sure what you’re trying to do with the Set Thumbnail action, as that seems to be the reverse of what you’re intending - the parameter you’re setting there is of the thumbnail, not the asset you’re applying it to, so the logic is the other way around.


(Nick Papadatos) #3

They’re directly under the standard page.
folder structure is 2019 > Jan, Feb etc

Basically what I’m trying to do is similar to the replace dynamic root node. You point to the main folder in this case 2019. Once you update the metadata to the image make the new root the standard page which is the parent.

There’s a back story but it will take forever to explain that’s why I’m trying to do it via a trigger
Logic:
update the metadata to the image > use this image as the banner YES/NO
if YES then set this image as the thumbnail to its direct parent.

Hope this makes sense

regards
Nick


(Luke Wright) #4

OK, thanks for that.

It sounds like you want the Create Link trigger action, out of the two actions you have there - which looks mostly set up correctly. For the dynamic root node, I’d use “Current Asset > Keyword > asset_parent” - the trigger runs from the point of view of the image, so that should let you target the standard page.


(Nick Papadatos) #5

Thanks Luke, that didn’t work. I disabled the set thumbnail action then ran it with but still no cigar.

“the trigger runs from the point of view of the image, so that should let you target the standard page.” Exactly what I’m trying to do

This should be straight forward no?

Cheers
Nick


(Bart Banda) #6

Hey @NickyP,
Have you tried to just use the Set Thumbnail action but using the Trigger on other assets feature?

Something like this:


(Nick Papadatos) #7

Thanks Bart - worked on my VM with the latest version of Matrix but not on the version we’re on.

Ended up having to use the Set Session Var - storing the image asset ID (the asset that fires the event) in a session variable first. I believe this brings some clarity to the scope of keywords? (e.g. does the %asset_assetid% point to the asset firing the event or the asset that is being impacted?).

see attached

regards
Nick


(Bart Banda) #8

Hmm, interesting. What version of yours didn’t it work on? Maybe it’s a bug that has been fixed since that version?

In my example above, the scope of Asset ID in the dynamic parameters is still on the asset the trigger originally fires on, hence why that setup works.


(Nick Papadatos) #9

Matrix Version: 5.4.3.2


(Bart Banda) #10

Thanks, can’t remember any specific bug fixes since that version that would have caused it not to work, but glad you got it working in the end anyway.