02-26-2019 09:28 AM
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 ?
02-26-2019 10:36 AM
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.
02-27-2019 10:16 AM
is it possible to create a behavior inside a webscript ?
02-27-2019 11:02 AM
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
02-28-2019 01:19 AM
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.
02-28-2019 04:20 AM
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.
02-28-2019 04:23 AM
Yes that's exactly what i want to do, I just want to display the message my way.
02-28-2019 04:48 AM
In that case in the following links you can find all the information you need to create a new dashlet:
Surf Dashlets | Alfresco Documentation
Aikau dashlets | Alfresco Documentation
The recomended way to create a new dashlet its using Aikau framework but how you want to adapt an existent dashlet maybe it will be easiest use Surf framework.
If instead of create a new dashlet you decide to modifing activity one you can consult this
Modifying Out-of-the-box Surf dashlets | Alfresco Documentation
Surf Extension Modules | Alfresco Documentation
Always is a good idea to study in Alfresco Source Code to use it like a guide in your developments, but in this case is much more recomendable.
02-28-2019 07:52 AM
For the real-time approach I remember that some time ago i saw a real time activity monitor but i didn't test it. You could take a look:
03-01-2019 04:22 AM
Thanks Roberto.
Explore our Alfresco products with the links below. Use labels to filter content by product module.