Hi Everyone !
I work with this alfresco version : All-In-One (AIO) project for SDK 4.0
I have created a new Doclib Action that create a new file ! (so with new nodeRef !)
My problem is : in alfreso portal, i always stay on the current nodeRef and i would like redirect to the new nodeRef :
http://localhost:8180/share/page/site/test/document-details?nodeRef=workspace://SpacesStore/NEW_NODEREF_GUID
Is it possible to redirect to the newNode in java ?
@Override protected void executeImpl(Action action, NodeRef actionedUponNodeRef) { if (serviceRegistry.getNodeService().exists(actionedUponNodeRef) == true) { NodeService nodeService = serviceRegistry.getNodeService(); try { NodeRef newNode = Tools.updateDocument( nodeService, serviceRegistry.getFileFolderService(), actionedUponNodeRef, propsNewDoc, propsOldDoc); //TODO redirection to newNode } catch (Exception e) { throw new WorkflowException(e.getMessage()); } } }
Thank you for your answer !
I don't think this can be achieved with only java, you have to make use of javascript function in combination or just use javascript function. it is sufficient to perfrom the operation.
Examples of creating node:
<config evaluator="string-compare" condition="DocumentLibrary"> <!-- Create custom type nodes --> <create-content>
<!-- METHOD 1: using ootb create-content function, it takes you to a new page and upon saving the node it lands on doclib --> <content id="whitepaper-doc" label="create.whitepaperdoc.menu.item.label" icon="whitepaper" type="pagelink"> <param name="page">create-content?destination={nodeRef}&itemId=demo:whitePaper&mimeType=text/plain</param> </content>
<!-- METHOD 2: using a custom function e.g. onNewObject , upon node creation you can grab the noderef and redirect --> <content id="support-doc" label="create.supportdoc.menu.item.label" icon="supporting-doc" type="javascript"> <param name="function">onNewObject</param> <param name="type">demo:supportingDoc</param> </content> </create-content> .... </config>
For custom function you have to extend the https://github.com/Alfresco/share/blob/develop/share/src/main/webapp/components/documentlibrary/tool... file. You can take reference from https://github.com/Alfresco/share/blob/develop/share/src/main/webapp/components/documentlibrary/tool... function and create a custom one for your custom nodes and 'onCreateSuccess' callback add redirect logic at the end when node creation is successful.
METHOD 1: using ootb create-content function by default takes you to newly created node if you would like to prefer. you can find more examples here: https://github.com/Alfresco/share/blob/develop/share/src/main/resources/alfresco/share-documentlibra...
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.