26 Sep 2007
New Alfresco tutorial on implementing custom behaviors
I’ve written a follow-on article to “Alfresco Developer: Working with Custom Types”. This one is on implementing custom behavior. In the new article (with accompanying source code), I build on the SomeCo Whitepapers example by adding support to the content model for user-contributed ratings of whitepapers. The custom behavior is used to calculate the average rating for each piece of rated content.
My plan is to follow on shortly with an article that shows how to use Alfresco’s new REST-based Web Script framework to enable the front-end to rate (and get the rating of) content in the Alfresco repository.
So take a look and let me know what you think.
More about the Alfresco Developer Series.

[...] Jeff Potts from Optaros has published another excellent tutorial, this time on adding custom behaviors to Alfresco to support “rating/scoring” of content. [...]
Alfresco Fresh Talk… » Another Gem from Jeff Potts
September 28th, 2007 at 1:26 pmpermalink
Hi Jeff,
Thanks a lot for such great article.
I like to have useful samples of Alfresco usage and customization.
I would ask you how the performance of the rating sample would be improve, if the sc:rateable aspect stores the current sum and count of existing sc:ratings children ?
The computeAverage() method won’t have to rescan all the children and will update the rating more efficiently.
Hope to see your next article soon
Cordialement,
David
David Rideau
September 30th, 2007 at 8:06 pmpermalink
@David…Agreed. Storing the sum and count as well as the average as part of the aspect would be an improvement. Thanks for the feedback. Glad the article was valuable.
jpotts
September 30th, 2007 at 10:06 pmpermalink
Jeff, superb article, thank you for taking the time to put things in a way we could learn more about Alfresco and its features.
Regarding the webscripts tutorial, my question is when ?. Please deliver it as soon as you can.
Thank you !
Luis Sanchez
October 14th, 2007 at 12:31 pmpermalink
@Luis — I’m glad you have found it valuable. I’m hoping to post it by the end of this week. After that, I’m thinking of doing one on advanced workflow with JBPM but I’m open to suggestions.
jpotts
October 14th, 2007 at 8:00 pmpermalink
Got it. Advanced workflow was in my wishlist. Thank you.
Luis Sanchez
October 15th, 2007 at 11:42 ampermalink
Hi Jeff, When is your article on advanced workflow with JBPM coming!! I’m waiting for that!!!
Thanks,
Ven
Ven
October 25th, 2007 at 3:51 pmpermalink
[...] Implementing Custom Behaviors [...]
ecmarchitect.com » Get your Alfresco ‘flow onJeff Potts on ECM, portals, search, collaboration, and a bunch of personal stuff
November 28th, 2007 at 9:09 pmpermalink
Where could I find-out online tutorial related “Rating/Scoring” the documents or Most viewed or downloaded documents ???
Any link / Any Help ?
Ghanshyam
April 2nd, 2008 at 12:25 ampermalink
Hi Jeff,
Is it possible to achieve internationalization(i18n) to my web application through alfresco.If so kindly explain me in detail
Stephen
October 7th, 2008 at 4:24 ampermalink
[...] functionality to the built-in category browsing for my custom categories: I implemented a Behavior that creates respectively removes links in the linked to custom category folder. This allows to [...]
No Custom Constraints for Associations in Alfresco « processed.info
May 20th, 2010 at 9:16 ampermalink
[...] developing a behavior I continually reference Jeff Potts’s tutorial on implementing behaviors. His table of available policies is a great quick reference. Of course the definitive source is [...]
Alfresco: Default Quota Policy at Jared Ottley
September 15th, 2010 at 12:16 pmpermalink
[...] Alfresco behaviors can be very useful when you need to perform some system-level action as part of an operation on a node. For example, let’s say whenever an instance of my custom type is created, I want to generate a unique id value and record it in a custom attribute on the new node. I can register a behavior that handles the onCreateNode event, bind it to my custom type, and then I can provide a simple Java method to do the work of generating the id value and setting the property. If you’re new to behaviors, Jeff Potts provides an in-depth discussion and tutorial. [...]
Zia Consulting, Inc » Issue with Alfresco CMIS and Behaviors – Zia Consulting, Inc
March 31st, 2011 at 6:31 pmpermalink
[...] I`m trying to make my own custom behaviour in alfresco 3.4.4 This led me to a great example from the ECMArchitect – Jeff Potts. [...]
Custom Behaviour | alfresco123
November 14th, 2011 at 6:12 ampermalink
Hello Jeff and thanks for that wonderful tutorial!
I’m trying to implement the javascript one. Since you stated “In this example the scripts are going to reside as part of the web application rather than being uploaded
to the repository. Nothing requires that this be the case” I tried to remake it with the scripts in the repository.
I guess I have to modify the “location” property but I couldn’t find how. Do I have to write my own java class extending org.alfresco.service.cmr.repository.ScriptLocation ?
Lucas
May 10th, 2012 at 9:56 ampermalink