Create a trigger to create an asset and add content


(Hopkinsd1) #1

Hello,

 

I am trying to create a trigger that will carry out the following actions.

 

1. A user creates a data record in a certain folder.

2. The trigger will then run and create a standard page under a certain site, with the page name being the name of the data record that was created.

3. The data record then needs to be nested into the contents of this newly created standard page.

 

So far I have managed to get the trigger to fire when a data record is created and it then creates the standard page in the correct location with the correct file name.  However I am unable get the trigger to nest the data record into the standard page.  Is this at all achievable? Looking at this page - http://manuals.matrix.squizsuite.net/triggers/chapters/trigger-actions it doesn't seem as if there is an action that will do the job.

 

Thanks

David


(Anthony) #2

Hi David,

As far as I know there's no direct way to do what you want. But I have a couple of ideas and I'm sure others will chip in here to say if they are sensible or not!

 

First idea - There are triggers that can make SOAP calls and call REST API's... Squiz has ways to create and update assets through its SOAP and JS API's... so maybe the trigger could call back into Squiz that way and have more control over the creation of the asset

 

Second idea - There is a trigger to set metadata on an asset. Rather than actually nest your data record, could you set some metadata on your standard page to reflect the associated data record, then in the paint layout of the standard page you grab the metadata and dynamically show the content from that data record?  

 

I guess my third question is why you even need the standard page... could you not associate a paint layout with the data record directly so it gets rendered however you want?


(Bart Banda) #3

I would also try what Anthony suggested in his second idea, this would be the easiest way to make it work. 


(Hopkinsd1) #4

Hi,

 

Thanks for the replies.

 

In the end I have decided to ditch the standard page and have just applied a paint layout to the data record.  I didn't realise you could visit a data record directly via the web browser.

 

Thanks

David