Skip to content

Instantly share code, notes, and snippets.

@stevewithington
Last active December 18, 2017 10:54
Show Gist options
  • Save stevewithington/683bc2c18e7373e956a2 to your computer and use it in GitHub Desktop.
Save stevewithington/683bc2c18e7373e956a2 to your computer and use it in GitHub Desktop.
Mura CMS : How to reference information about a content item after it's been saved
<cfscript>
public any function onAfterContentSave($) {
// reference the new bean that was created
var newBean = arguments.$.event('contentBean');
// reference to the OLD bean
var oldBean = arguments.$.event('activeBean'); // can also use 'currentBean' to access the same bean
// you can now reference any of the attributes of the new bean ...
WriteDump(var=newBean.getAllValues(), abort=true);
// keep in mind that the content has already been saved, so you can't display any messaging anymore!
// however, you can do some additional manipulation of the content such as parse a PDF, save children, etc.
}
</cfscript>
@David-Polehonski
Copy link

Is the 'activeBean' null if the content has just been created?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment