We are using a trigger to change the status of a newly created asset from ‘under construction’ to ‘pending approval’.
We do this to eliminate the need for the user to apply for approval. This then triggers a 1 step workflow that sends a ‘Workflow Approval Required’ email to the user or group specified in the workflow.
The trigger and workflow are running fine except that the urls for the ‘Workflow’ screen and ‘Preview’ screen on the email are wrong.
URL on email :
http://xxx.xxxxxxxxxxxxx.xxx.au/staff_resources/bulletin_board/create_message_admin/?backend_section=am&am_section=edit_asset&assetid=21130&asset_ei_screen=workflow
The correct URL:
http://xxx.xxxxxxxxxxxxx.xxx.au/staff_resources/bulletin_board/create_message_admin/?backend_section=am&am_section=edit_asset&assetid=21130&asset_ei_screen=workflow
We haven’t experienced this problem in other scenarios where the user is able to apply for approval.
Does anyone know why this could be happening ?
Running MSM 3.14.0
Anyone ??
[quote]We are using a trigger to change the status of a newly created asset from ‘under construction’ to ‘pending approval’.
We do this to eliminate the need for the user to apply for approval. This then triggers a 1 step workflow that sends a ‘Workflow Approval Required’ email to the user or group specified in the workflow.
The trigger and workflow are running fine except that the urls for the ‘Workflow’ screen and ‘Preview’ screen on the email are wrong.
URL on email :
http://xxx.xxxxxxxxxxxxx.xxx.au/staff_resources/bulletin_board/create_message_admin/?backend_section=am&am_section=edit_asset&assetid=21130&asset_ei_screen=workflow
The correct URL:
http://xxx.xxxxxxxxxxxxx.xxx.au/staff_resources/bulletin_board/create_message_admin/?backend_section=am&am_section=edit_asset&assetid=21130&asset_ei_screen=workflow
We haven’t experienced this problem in other scenarios where the user is able to apply for approval.
Does anyone know why this could be happening ?
Running MSM 3.14.0[/quote]
That "correct" URL is not correct. The first URL is what the workflow email should be sending, IIRC.
I Work with David and I have worked out what is happening (but not why) and it is definitely a Matrix bug.
If I turn off the trigger and manually apply for approval, the link in the email the approver gets is correct and takes them to the asset as it should.
(h t t p://.wa.gov.au/staff_resources/bulletin_board/for_sale/test/_edit?asset_ei_screen=workflow)
If I turn the trigger back on and submit the asset via an asset builder, the trigger set the Status to 'Pending Approval' the work flow is triggered as it should, but the link in the email is incorrect and takes the user to a 404.
h t t p://.wa.gov.au/staff_resources/bulletin_board/create_message_admin/?backend_section=am&am_section=edit_asset&assetid=21636&asset_ei_screen=workflow
Everything up the the '/bulletin_board/' is the same in both URL's but after that they are different.
The correct goes to: 'for_sale/test/_edit?asset_ei_screen=workflow'
The incorrect goes to: 'create_message_admin/?backend_section=am&am_section=edit_asset&assetid=21636&asset_ei_screen=workflow'
Why is this happening and how can it be stopped from happening?
thanks
Wes
Can you give us details about the Asset Builder (what it creates, where and in what status) and what the trigger does?
Hi Avi
Not a problem.
The asset builder creates a Data Record. Only logged in LDAP users can access the asset builder.
It creates Data Records in folders under a Standard Page 'Bulletin Board' using Dynamic Create Locations.
The Create Status is set at 'Do not change status' so they are created as 'Under Construction'.
The LDAP users do not have access to the edit screen for these Data Records so they cannot 'apply for approval'. This is intentional as we have the Trigger to do this.
The Trigger does this.
Conditions
On 'Asset Created'.
Tree Location: Asset is under 'Bulletin Board' (The standard page that the folders are under)\
Asset is of type: Data Record
Actions
Set Metadate Value: Ignore Permissions and we set a default value for a metadata field.
Set Status: Ignore Permissions and Set the Asset Status to 'Pending Approval'
This fires the workflow, but as we have pointd out, the link in the workflow email is incorrect and leads to a 404.
Thanks
Wes
We'll need to wait for Greg to chime in and see if this should be logged as a bug. :)
I assume the page's URL is not being worked out correctly because the status change is not firing on the asset itself. Using a trigger to start workflow is not something that we have tried. If it doesn't work, it probably requires some changes to the way internal messages calculate URLs, which would be marked as an enhancement and only added to the dev version.
I'm not sure if I'm actually helping much here, but a little bit of background as to how MySource Matrix determines which URL to place into "Workflow Approval Required" ones.
The way the logic works with that URL is if you are in the Simple Edit interface when you are making the change to Pending Approval, it will give you the _edit URL, otherwise it will give you an _admin one. Since it is happening on the front end (because you are creating it through an Asset Builder, I imagine), it will give you an _admin one because the trigger is not firing during Simple Edit. The preview email contains the current URL - this is because the code that determines this is written with changing it from Admin or Simple Edit in mind, rather than through a trigger. In this case, it will be the Asset Builder's URL.
Is the asset ID quoted in that first URL the asset ID of the message (21130)? In this case, it should still correctly point you to this asset when you use the URL (assuming all is well and good - see below), but as pointed above, it will put it into the Administration interface, not Simple Edit. If that's not the correct asset ID, then there may be a problem.
Note that the first URL probably is potential problem, I imagine there is supposed to be a "/" that is missing from the URL that you are quoting (…/create_message/_admin?.. instead of (…/create_message_admin?..). If your Asset Builder has a web path of "create_message", this is most likely the case. (Can you try adding the slash to the first URL (before "_admin", as above) and try the URL again, so we can rule this possibility in or out?) It's probably best to take it up with our Support team in this case, I imagine.
[quote]I'm not sure if I'm actually helping much here, but a little bit of background as to how MySource Matrix determines which URL to place into "Workflow Approval Required" ones.
The way the logic works with that URL is if you are in the Simple Edit interface when you are making the change to Pending Approval, it will give you the _edit URL, otherwise it will give you an _admin one. Since it is happening on the front end (because you are creating it through an Asset Builder, I imagine), it will give you an _admin one because the trigger is not firing during Simple Edit. The preview email contains the current URL - this is because the code that determines this is written with changing it from Admin or Simple Edit in mind, rather than through a trigger. In this case, it will be the Asset Builder's URL.
Is the asset ID quoted in that first URL the asset ID of the message? In this case, it will still correctly point you to this asset when you use the URL (assuming all is well and good - see below), but as pointed above, it will put it into the Administration interface, not Simple Edit.
Note that the first URL probably IS a potential bug, I imagine there is supposed to be a "/" that is missing from the URL that you are quoting (…/create_message/_admin?.. instead of (…/create_message_admin?..). If your Asset Builder has a web path of "create_message", this is most likely the case. (Can you try adding the slash to the first URL (before "_admin", as above) and try the URL again, so we can rule this possibility in or out?) We might have to look at it through Support, or otherwise we might need some details of how you have set up this part of your system, depending on how easy or difficult it is for us to reproduce.[/quote]
The URL with the 'create_message_admin' is the actual URL the Workflow email includes (Matrix creates this and I copied it from the browser window), but you are correct that if I change it to 'create_message/_admin' it goes to the workflow screen in the Admin interface. So I would say that it is a bug and yes, the asset id is the id of the created data record.
By the way, 'create_message' is the web path to the Asset Builder.
Can you try changing the webpaths of the Asset Builder (asset > web paths screen > paths)
from
create_message
to
create_message/
(add a trailing slash) and see if the link in the workflow email works.
You can try this workaround before we fix the problem in dev version.
[quote]Can you try changing the webpaths of the Asset Builder (asset > web paths screen > paths)
from
create_message
to
create_message/
(add a trailing slash) and see if the link in the workflow email works.
You can try this workaround before we fix the problem in dev version.[/quote]
Tried it. Matrix removes the slash.
Aha... I've been investigating this. We have a training environment and when our trainees apply for approval (in simple edit) the 'Workflow Approval Required' email that comes through contains links that open preview / workflow in simple edit = lovely.
On production the same email contains links that open preview / workflow in admin = not good.
We have a trigger on the action 'Asset updated' to clear the Matrix cache - so is this the cause?
Any way I could retain the trigger and get the email to contain preview/workflow links to simple edit?
This was reported as a bug and fixed in 3.14.8 and 3.16.4: http://bugs.matrix.squiz.net/view_bug.php?bug_id=2636
Great thanks!