I've racked my brains about this all afternoon and the solution (if there is one) is not apparent…
I would like to be able to set the link value of an asset upon its creation. For example:
User uploads PDF asset
Trigger fires on Asset Created
Link value of "file" is added to the asset
Asset now displays in an asset listing that only shows assets with a link value of "files"
I realise I could do it with the 'Create Link' action, but that requires that you supply a parent or child asset (unless I'm missing something…). I just want the trigger to fire on the current asset and add the link value to the current asset. I can't move it to a new parent just to get this to work. The existing parent could be just about anywhere on the site, and needs to remain that way.
Please note the above example is an over-simplification of the actual scenario, which involves Link assets and checking the URL for a number of particular file extensions or a sub-domain, and then listing it in one of two asset listings based on this result. Being able to automatically add the link value to PDFs and Word docs would be an added bonus.
Ultimately I'm trying to keep it as simple for the users as possible - I don't want them to have to remember to add a link value manually.
Action: Create link - Type_1, under asset ID xxx link value - file, Check unlink asset
This will only work if the files are being created in the same place, If you are creating any where then you have no chance. But if it is in 4 or 5 locations then you'd need to create a trigger for each location
Action: Create link - Type_1, under asset ID xxx link value - file, Check unlink asset
This will only work if the files are being created in the same place, If you are creating any where then you have no chance. But if it is in 4 or 5 locations then you'd need to create a trigger for each location
[/quote]
Hi Dave,
Yes, thanks for that. I know how to make it happen with assets when I know the parent ID, but as mentioned in my original post, these files could be just about anywhere on the site. I guess this solution is not going to work then…
Yes, thanks for that. I know how to make it happen with assets when I know the parent ID, but as mentioned in my original post, these files could be just about anywhere on the site. I guess this solution is not going to work then…
Margaret
[/quote]
Just use a Standard Page and use a standard html form with the JS API. The createAsset() function can create an asset and set the link type and link value on create.
[quote]
Just use a Standard Page and use a standard html form with the JS API. The createAsset() function can create an asset and set the link type and link value on create.
[/quote]
Ooh thanks for the tip. I had contemplated asset builders and/or JS API… but currently all our users are adding pages via the admin interface. I think I'll have to discuss the options with my manager.
[quote]
Ooh thanks for the tip. I had contemplated asset builders and/or JS API… but currently all our users are adding pages via the admin interface. I think I'll have to discuss the options with my manager.
[/quote]
Another option would be to create a Folder that assets could be linked into. So when a PDF asset is created, have the trigger create a new link to the "Files" folder. Then you can have your asset listing looking at that folder to list all files that have been linked inside of that folder. I think this actually might list the assets faster than using a link value and seems to solve your problem.
[quote]
Another option would be to create a Folder that assets could be linked into. So when a PDF asset is created, have the trigger create a new link to the "Files" folder. Then you can have your asset listing looking at that folder to list all files that have been linked inside of that folder. I think this actually might list the assets faster than using a link value and seems to solve your problem.
[/quote]
Another great suggestion, thanks, but unfortunately it won't work for us. Maybe I should explain exactly what we're doing…
We have a paint layout applied to our entire intranet. It serves a few functions, but the one of relevance here is that it currently contains a nested asset listing that lists 'Link' assets under a 'More information' heading - its main purpose is to list external (or other internal) websites.
We're now adding another nested asset listing to the paint layout that lists Word, PDF, Excel and PowerPoint assets under a 'Related files' heading.
So far, quite simple, but here's the catch…
Staff members will also want to link to documents that are in Trim. They would need to use Link assets to do this as our Trim can't currently integrate with Matrix properly (I don't know the details behind this at all).
With the above setup, those links to files in Trim would automatically fall under the 'More information' heading, rather than the 'Related files' heading, which would be more appropriate. Feedback from staff has indicated that they would not really like Trim links falling under 'More information'.
The obvious solution here is link values… The 'More information' asset listing can show items that DON'T match the link value, and the 'Related files' asset listing can show items that DO match the link value.
My manager is concerned that staff would find this extra step confusing and forget to do it, so I thought I'd try to automate it.
Another possibility just occurred to me - to use Redirect assets for the TRIM links instead - but I think that would be just as confusing as adding a link value (if not more so).
I've tried working magic with further paint layouts, but I couldn't quite bend them to my will.
I hope this explanation makes sense - let me know if I can clarify anything.
[quote]
Another great suggestion, thanks, but unfortunately it won't work for us. Maybe I should explain exactly what we're doing…
[/quote]
After reading your additional details it still seems to my that my suggestion would still work. But maybe I am still not understanding why you think that solution won't work for you.
[quote]
After reading your additional details it still seems to my that my suggestion would still work. But maybe I am still not understanding why you think that solution won't work for you.
[/quote]
The asset listings nested in the paint layout are using a replacement root node for the current asset, so they only list any assets that happen to exist under a particular page.
I tested this idea:
PDF is created under standard page
Trigger creates link in additional location (a folder)
Trigger also adds link value of "files"
On the linking screen, the value "files" is present on the link to the folder, but not the link to the standard page
In this scenario, when viewing the standard page, the asset listing nested in the paint layout, with its root node of current asset, is not going to filter this PDF according to its link value as it still won't have one.
That's why I don't think this solution would work for us, but please let me know if I'm mistaken, and apologies if I haven't explained it clearly enough before.
[quote]
The asset listings nested in the paint layout are using a replacement root node for the current asset, so they only list any assets that happen to exist under a particular page.
I tested this idea:
PDF is created under standard page
Trigger creates link in additional location (a folder)
Trigger also adds link value of "files"
On the linking screen, the value "files" is present on the link to the folder, but not the link to the standard page
In this scenario, when viewing the standard page, the asset listing nested in the paint layout, with its root node of current asset, is not going to filter this PDF according to its link value as it still won't have one.
[/quote]
In my example you would not be using a link value at all or link value filtering. Rather the Folder is used to filter out only what you want. So, since you can have an asset listing with its root node pointed to that folder, anything that you link into that folder will show up in the asset listing. So, when you create a new PDF file, the trigger will also link it into the folder. Then since your asset listing will be using the folder as a root node, when the listing is viewed that new PDF file will be shown.
But, it sounds like these PDF files are different per page, so my example above might not work for your case, like you said. Are you saying that each Standard Page asset will show different PDF files, or will they be pulling from a full listing of them?
[quote]
But, it sounds like these PDF files are different per page, so my example above might not work for your case, like you said. Are you saying that each Standard Page asset will show different PDF files, or will they be pulling from a full listing of them?
[/quote]
Yes, that's exactly right. The PDF files are different for each page, and not pulling from a full listing.
I decided to give the ‘Execute Database Query’ trigger action a go - although I’ve now encountered an issue with that, which I might post about separately…