As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
I created a behaviour that display a message in the console once a file is created.I created a model following this tutorial Working With Custom Content Types in Alfresco | ECMArchitect | Alfresco Developer Tutorials . (descriptionand date attributes)
How can I save that message to that model. Than use webscripts to display in Json or html format ?
Hello,
To give you a more accurated answer It would be very usefull if you attached your custom model definition to the question.
Anyway from your behaviour implementation you have to use NodeService to specialize the type of the node created or add an aspect to it, depending how you have definited your model, and then set the property with your message.
NodeService | Alfresco Documentation
In this other link you can find the information you will need to develope a custom web script:
Web Script tutorials | Alfresco Documentation
Basicaly you need a web service that received the noderef of your content, load it and show the messagge property in the format you want.
is it possible to create a behavior inside a webscript ?
I don't understand exactly what are your requirements.
Behaviors are pieces of logic that will be executed in response to an event in the respository and a web script is a REST service, are totally diferent things.
If you want to execute a piece java code when you call a web script you must see th Java Backed web scripts
Java-backed web scripts | Alfresco Documentation
Creating a Folder Listing Java-backed web script | Alfresco Documentation
On the other hand if what you want is execute the same code in a behavior and when you call the web script without duplicating code your best option is create a respository action and invoke it from both sides:
Adding new actions to the Document Library | Alfresco Documentation
What I want to do is, when someone create a file, I want to display in the share a message "Username added a file with a filename" and save this event to a database in a table created by me.
Saving the event in your own database table is clearly a task that you could do in a behaviour.
When you say "display in share a message", do you mean show a realtime message to other users loged in share"?
Take into account that share already display this kind of information in the activity dashlets from the user and site dashboard. It's not real time but are to update everytime you reach the dashboard.