<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Doclib Action &amp; Redirection in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/doclib-action-redirection/m-p/144109#M38253</link>
    <description>&lt;P&gt;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.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Examples of creating node:&lt;/P&gt;

&lt;PRE&gt;&amp;lt;config evaluator="string-compare" condition="DocumentLibrary"&amp;gt;
		&amp;lt;!-- Create custom type nodes --&amp;gt;
		&amp;lt;create-content&amp;gt;&lt;BR /&gt;                        &amp;lt;!-- &lt;STRONG&gt;METHOD 1:&lt;/STRONG&gt; using ootb create-content function, it takes you to a new page and upon saving the node it lands on doclib --&amp;gt;
                        &amp;lt;content id="whitepaper-doc" label="create.whitepaperdoc.menu.item.label" icon="whitepaper" type="pagelink"&amp;gt;
                            &amp;lt;param name="page"&amp;gt;&lt;STRONG&gt;create-content&lt;/STRONG&gt;?destination={nodeRef}&amp;amp;amp;&lt;STRONG&gt;itemId=demo:whitePaper&lt;/STRONG&gt;&amp;amp;amp;mimeType=text/plain&amp;lt;/param&amp;gt;
                        &amp;lt;/content&amp;gt;&lt;BR /&gt;                        &amp;lt;!-- &lt;STRONG&gt;METHOD 2: &lt;/STRONG&gt;using a custom function e.g. onNewObject , upon node creation you can grab the noderef and redirect --&amp;gt;
                        &amp;lt;content id="support-doc" label="create.supportdoc.menu.item.label" icon="supporting-doc" type="javascript"&amp;gt;
                            &amp;lt;param name="function"&amp;gt;onNewObject&amp;lt;/param&amp;gt;
		            &amp;lt;param name="type"&amp;gt;demo:supportingDoc&amp;lt;/param&amp;gt;
                        &amp;lt;/content&amp;gt;
              &amp;lt;/create-content&amp;gt;

....
&amp;lt;/config&amp;gt;&lt;/PRE&gt;
&lt;P&gt;For custom function you have to extend the&amp;nbsp;&lt;A href="https://github.com/Alfresco/share/blob/develop/share/src/main/webapp/components/documentlibrary/toolbar.js" target="_blank" rel="noopener nofollow noreferrer"&gt;https://github.com/Alfresco/share/blob/develop/share/src/main/webapp/components/documentlibrary/toolbar.js&lt;/A&gt; file. You can take reference from&amp;nbsp;&lt;A href="https://github.com/Alfresco/share/blob/develop/share/src/main/webapp/components/documentlibrary/toolbar.js#L748" target="_blank" rel="noopener nofollow noreferrer"&gt;https://github.com/Alfresco/share/blob/develop/share/src/main/webapp/components/documentlibrary/toolbar.js#L748&lt;/A&gt; function and create a custom one for your custom nodes and 'onCreateSuccess' callback add redirect logic at the end when node creation is successful.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;METHOD 1:&lt;/STRONG&gt; 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:&amp;nbsp;&lt;A href="https://github.com/Alfresco/share/blob/develop/share/src/main/resources/alfresco/share-documentlibrary-config.xml#L760" target="_blank" rel="noopener nofollow noreferrer"&gt;https://github.com/Alfresco/share/blob/develop/share/src/main/resources/alfresco/share-documentlibrary-config.xml#L760&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 04 May 2021 17:46:37 GMT</pubDate>
    <dc:creator>abhinavmishra14</dc:creator>
    <dc:date>2021-05-04T17:46:37Z</dc:date>
    <item>
      <title>Doclib Action &amp; Redirection</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/doclib-action-redirection/m-p/144108#M38252</link>
      <description>&lt;P&gt;Hi Everyone !&lt;/P&gt;&lt;P&gt;I work with this alfresco version : All-In-One (AIO) project for SDK 4.0&lt;BR /&gt;I have created a new &lt;EM&gt;Doclib Action&lt;/EM&gt; that create a new file ! (so with new nodeRef !)&lt;BR /&gt;My problem is : in alfreso portal, i always stay on the current nodeRef and i would like redirect to the new nodeRef :&lt;BR /&gt;http://localhost:8180/share/page/site/test/document-details?nodeRef=workspace://SpacesStore/NEW_NODEREF_GUID&lt;/P&gt;&lt;P&gt;Is it possible to redirect to the newNode in java ?&lt;/P&gt;&lt;PRE&gt;@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());
		}
	}
}&lt;/PRE&gt;&lt;P&gt;Thank you for your answer !&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 16:27:49 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/doclib-action-redirection/m-p/144108#M38252</guid>
      <dc:creator>David76</dc:creator>
      <dc:date>2021-05-04T16:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: Doclib Action &amp; Redirection</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/doclib-action-redirection/m-p/144109#M38253</link>
      <description>&lt;P&gt;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.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Examples of creating node:&lt;/P&gt;

&lt;PRE&gt;&amp;lt;config evaluator="string-compare" condition="DocumentLibrary"&amp;gt;
		&amp;lt;!-- Create custom type nodes --&amp;gt;
		&amp;lt;create-content&amp;gt;&lt;BR /&gt;                        &amp;lt;!-- &lt;STRONG&gt;METHOD 1:&lt;/STRONG&gt; using ootb create-content function, it takes you to a new page and upon saving the node it lands on doclib --&amp;gt;
                        &amp;lt;content id="whitepaper-doc" label="create.whitepaperdoc.menu.item.label" icon="whitepaper" type="pagelink"&amp;gt;
                            &amp;lt;param name="page"&amp;gt;&lt;STRONG&gt;create-content&lt;/STRONG&gt;?destination={nodeRef}&amp;amp;amp;&lt;STRONG&gt;itemId=demo:whitePaper&lt;/STRONG&gt;&amp;amp;amp;mimeType=text/plain&amp;lt;/param&amp;gt;
                        &amp;lt;/content&amp;gt;&lt;BR /&gt;                        &amp;lt;!-- &lt;STRONG&gt;METHOD 2: &lt;/STRONG&gt;using a custom function e.g. onNewObject , upon node creation you can grab the noderef and redirect --&amp;gt;
                        &amp;lt;content id="support-doc" label="create.supportdoc.menu.item.label" icon="supporting-doc" type="javascript"&amp;gt;
                            &amp;lt;param name="function"&amp;gt;onNewObject&amp;lt;/param&amp;gt;
		            &amp;lt;param name="type"&amp;gt;demo:supportingDoc&amp;lt;/param&amp;gt;
                        &amp;lt;/content&amp;gt;
              &amp;lt;/create-content&amp;gt;

....
&amp;lt;/config&amp;gt;&lt;/PRE&gt;
&lt;P&gt;For custom function you have to extend the&amp;nbsp;&lt;A href="https://github.com/Alfresco/share/blob/develop/share/src/main/webapp/components/documentlibrary/toolbar.js" target="_blank" rel="noopener nofollow noreferrer"&gt;https://github.com/Alfresco/share/blob/develop/share/src/main/webapp/components/documentlibrary/toolbar.js&lt;/A&gt; file. You can take reference from&amp;nbsp;&lt;A href="https://github.com/Alfresco/share/blob/develop/share/src/main/webapp/components/documentlibrary/toolbar.js#L748" target="_blank" rel="noopener nofollow noreferrer"&gt;https://github.com/Alfresco/share/blob/develop/share/src/main/webapp/components/documentlibrary/toolbar.js#L748&lt;/A&gt; function and create a custom one for your custom nodes and 'onCreateSuccess' callback add redirect logic at the end when node creation is successful.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;METHOD 1:&lt;/STRONG&gt; 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:&amp;nbsp;&lt;A href="https://github.com/Alfresco/share/blob/develop/share/src/main/resources/alfresco/share-documentlibrary-config.xml#L760" target="_blank" rel="noopener nofollow noreferrer"&gt;https://github.com/Alfresco/share/blob/develop/share/src/main/resources/alfresco/share-documentlibrary-config.xml#L760&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 17:46:37 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/doclib-action-redirection/m-p/144109#M38253</guid>
      <dc:creator>abhinavmishra14</dc:creator>
      <dc:date>2021-05-04T17:46:37Z</dc:date>
    </item>
  </channel>
</rss>

