Issues with Custom Publish Trigger functions
Hi,
I am having an issue with the getLastPublishedBy() function with a Page asset in my publish trigger. I added a portion of my custom publish trigger. The issue is the result of "page.getLastPublishedBy();", which gives me the username of the user who last published it BEFORE the most recent publish (so not the one who just published it, but the one who published it previously).
I attached a screen shot of the page's audits, which I was testing. When 'ces55739' published at 'Apr 13, 2016 3:55 PM', the result of page.getLastPublishedBy() was equal to 'system'. When 'ces55739' published a 2nd time, at 'Apr 13, 2016 3:56 PM', the result of page.getLastPublishedBy() was equal to 'ces55739'.
I am wondering if I am using the method wrong in my publish trigger or if this is a bug.
Let me know if you need more information. Thanks!
public class EventAuthorEmailPublishTrigger implements PublishTrigger
{
private Map<String, String> parameters = new HashMap<String, String>();
private PublishTriggerInformation information;
/* (non-Javadoc)
* @see com.cms.publish.PublishTrigger#invoke()
*/
public void invoke() throws PublishTriggerException
{
// this is where the logic for the trigger lives.
// we switch on the entity type and this allows us to determine if a page or file is being published
try
{
Page page = (Page) readAsset(information.getEntityId(), EntityTypes.TYPE_PAGE);
page.getLastPublishedBy();
Discussions are closed to public comments.
If you need help with Cascade CMS please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by Ryan Griffith on 14 Apr, 2016 06:51 PM
Hi,
Currently, this is the intended behavior because the Publish Triggers are executed prior to the asset's last published information being updated in the database. This explains why you are seeing the previous user who published the asset.
I highly recommend posting a suggestion on our Idea Exchange if you would like to see this functionality considered for a future release of Cascade.
Please let me know if you have any questions.
Thanks!
2 Posted by ces55739 on 18 Apr, 2016 01:55 PM
Bummer. Thanks Ryan!
ces55739 closed this discussion on 18 Apr, 2016 01:55 PM.