05-18-2020 03:22 PM
Hi fellow devs,
What is the easiest way to create a node in all sites?
I'm aware of how to create nodes:
https://api-explorer.alfresco.com/api-explorer/#!/nodes/createNode
And how to get all sites:
https://api-explorer.alfresco.com/api-explorer/#!/sites/listSites
But a bit lost in what is the best way to connect both in order to create a node for all sites...
Any advice you can give?
Thanks for you time
05-18-2020 07:34 PM
There is no ootb way to create a node in all available sites in repository at same time.
If the node is meant to be shared, you should created in "Shared Files".
If you still need to create the node in each and every available site, then implement a behavior which listens to node creation event, find the available sites before node creation and then loop through all sites and create the node.
Refer this post for more on implementing behaviors: https://ecmarchitect.com/alfresco-developer-series-tutorials/behaviors/tutorial/tutorial.html
Helpful in getting all sites or getting sites based on current user who is logged in via SiteService:
NodeCreation via node service:
05-19-2020 12:34 PM
Many thanks for the feedback abhinavmishra14 , currently trying to implement the advised solution.
After it will give my feedback how it was implemented.
In this case the folder is not supposed to be shared so I will focus on the other option.
And also thanks for reminding about the node creation event, it will be quite cool if this can be dynamic, in the sense that once the user creates a new node the folder is there.
Cheers, ARamos
Explore our Alfresco products with the links below. Use labels to filter content by product module.