cancel
Showing results for 
Search instead for 
Did you mean: 

New Site nodeID parameter in Javascript action

rhannink
Champ on-the-rise
Champ on-the-rise
Hello,

Iam trying to implement Site Templates for Share. Because of problems with permissions and the deepcopy Iam trying to do this with a custom action whenever a node is created on in the Site node.

The Javascript is triggered by an action whenever a subfolder is created in the Sites folder of the repository, but now I need the nodeID of the new Site within this script.

How can I retreive the new Site name and the nodeID.

Default parameter space point towards the Sites node of the repository
Default parameter Site is null.

Any ideas?

Gr. Remco
1 REPLY 1

mikef
Champ in-the-making
Champ in-the-making
If I understand what you are trying to do correctly I think you need to:

1) Create an rule on the /Company Home/Sites folder that is tiggered when folders are created in that folder. This rule should tigger a script
2) In the script:
- The "document" root scoped object (see http://wiki.alfresco.com/wiki/3.4_JavaScript_API#Root_Scope_Objects) will be the folder that's just been created
- Check that the folder that is being created is of type: {http://www.alfresco.org/model/site/1.0}sites just to be sure e.g.
document.type == "{http://www.alfresco.org/model/site/1.0}sites"‍
- You can get the documents nodeRef using
document.nodeRef‍
or ID using
document.id‍
- Use the javascript APIs to copy or create your template content into the newly created folder

See also http://wiki.alfresco.com/wiki/JavaScript_API_Cookbook for more examples on how to use the APIs