Externally linking to matrix via assetid

Is there any way to link externally to matrix via asset id? If I use a url like /?a=1234, I get all sorts of errors and the design doesn't work correctly.


Not sure why you're getting errors, but it'll use whichever design is applied to the Site asset with that URL (because it doesn't know the full URL to the asset). There is a trigger action that will automatically add a Remap for each asset in the format http://www.siteurl.com/assetid -- if you use this trigger action to add this remap to all of your current and future assets, you would be able to link to http://www.siteurl.com/assetid and the system will bounce you to the full (proper) URL.

OK I've added a trigger
Event: asset accessed
Condition: URL match (Must be in URL: ?a=)
Action: Add remap

Is this correct? It's not working...

Sarah

No, it's not.

Should be:

Event: Asset Created
Condition: Asset of Type (Pick which asset types you want to be able to link to)
Condition: Tree Location (Pick where the assets will be)
Action: Add Remap URL

So, when an asset is created, it will create a Remap entry for that asset from http://www.siteurl.com/assetid to the full URL of the asset itself. You will see these remaps on the Web Paths screen for each asset.

Then, you'd access http://www.siteurl.com/assetid and the Remap Manager will redirect you to the proper URL.

You would need to use the Batching option on the Trigger Manager to run this trigger action for already created assets.

Edited to add that your trigger may have created a bunch of remaps for the assets you tried, so you may want to remove/check those on the webpaths screen of those assets.

[quote][snip]
Event: Asset Created

[snip][/quote]



Ahh gotcha… only problem is we want this for 1000 or so assets already created and in the system



We're going live with some new sites and want to redirect URLs from the old site to the new via asset IDs…

but URL/?a=ID doesn't resolve menu normal and asset linage design areas correctly



:frowning:


This is what trigger batching is for: On the Trigger Manager, select the Batching screen in the menu and then manually fire the Asset Created event for the site you're about to take live. Your trigger will then fire for your assets and your remaps will be added. :)

Nifty :slight_smile:


It's working thanks…


Huzzah!

Spoke too soon…


The trigger batching worked but then we got a couple of errors everytime a page or file was added to one of the sites so I disabled the trigger:









I'm now trying to re-enable the trigger and I get the following:



MySource Notice

File: [SYSTEM_ROOT]_3_16_3_ssv/core/assets/system/triggers/trigger/trigger_edit_fns.inc Line: 788

Message: Action 2 (trigger_action_add_url) not saved. The URL is not specified [CORE0130]

[quote]MySource Notice
File: [SYSTEM_ROOT]_3_16_3_ssv/core/assets/system/triggers/trigger/trigger_edit_fns.inc Line: 788

Message: Action 2 (trigger_action_add_url) not saved. The URL is not specified [CORE0130][/quote]



You don't want to use the Add URL action, you want to use the Add Remap trigger action.

Silly me I had both actions in there accidently - thanks :slight_smile:


No worries -- has removing that action resolved the issue for you?

Yep sure has

Huzzah again! :D

Avi, I was trying this on image assets as a test, which worked well. But it breaks if those images start out without public read permissions, because the remap is written with that current URL. But when you DO set those images to have public read, the URL changes and is hosted by apache, but that remap that the trigger created no longer works, since it was referencing the before public read URL.

Is this normal? I would think most people start out their site with no public read, and then switch. But if they generated this remap before this, then all file assets would be broken using the quick www.site.com/99999 URL. Maybe this trigger is not intended to be used on file assets...

It is normal, if you consider the action is just "Asset Created" -- try using the "Asset Lookups Updated" event as well, so that when a File's URL is changed, it adds a new remap.

Ah, good idea. I probably would not need to use this method. I just wanted to make sure it was not a bug. :)