<?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 Is there a way to change nodeType of a document in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/is-there-a-way-to-change-nodetype-of-a-document/m-p/117167#M32433</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;is there any API service that i can call to change nodeType of a document.&lt;/P&gt;&lt;P&gt;Thanks for reading, hope someone has the answer!&lt;/P&gt;</description>
    <pubDate>Thu, 28 May 2020 15:41:20 GMT</pubDate>
    <dc:creator>mire323</dc:creator>
    <dc:date>2020-05-28T15:41:20Z</dc:date>
    <item>
      <title>Is there a way to change nodeType of a document</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/is-there-a-way-to-change-nodetype-of-a-document/m-p/117167#M32433</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;is there any API service that i can call to change nodeType of a document.&lt;/P&gt;&lt;P&gt;Thanks for reading, hope someone has the answer!&lt;/P&gt;</description>
      <pubDate>Thu, 28 May 2020 15:41:20 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/is-there-a-way-to-change-nodetype-of-a-document/m-p/117167#M32433</guid>
      <dc:creator>mire323</dc:creator>
      <dc:date>2020-05-28T15:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to change nodeType of a document</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/is-there-a-way-to-change-nodetype-of-a-document/m-p/117168#M32434</link>
      <description>&lt;P&gt;There is an action to change the type OOTB in share:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.alfresco.com/6.0/tasks/library-item-change-type.html" target="_blank" rel="noopener nofollow noreferrer"&gt;https://docs.alfresco.com/6.0/tasks/library-item-change-type.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;It calls a repository webscript:&amp;nbsp;Document List Component - type submit at "/slingshot/doclib/type/node/{store_type}/{store_id}/{id}" url.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;If you want to change the type via rest call, you can utilize above given webscript. This webscript can change the type from cm:content to custom content type you have created.&lt;/P&gt;
&lt;P&gt;e.g.:&lt;/P&gt;
&lt;PRE class="pre codeblock prettyprint prettyprinted"&gt;&lt;SPAN class="tag"&gt;&amp;lt;type&lt;/SPAN&gt; &lt;SPAN class="atn"&gt;name&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="atv"&gt;"cm:content"&lt;/SPAN&gt;&lt;SPAN class="tag"&gt;&amp;gt;&lt;/SPAN&gt;
	&lt;SPAN class="com"&gt;&amp;lt;!-- Custom sub-type added for whitepapers --&amp;gt;&lt;/SPAN&gt;
	&lt;SPAN class="tag"&gt;&amp;lt;subtype&lt;/SPAN&gt; &lt;SPAN class="atn"&gt;name&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="atv"&gt;"my:whitepaper"&lt;/SPAN&gt; &lt;SPAN class="tag"&gt;/&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class="tag"&gt;&amp;lt;/type&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;but if you want to change the type between two custom content types then it will not work. You can customize the above webscript to handle this case.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;e.g.:&lt;/P&gt;
&lt;PRE&gt;&amp;lt;type name="my:whitepapper"&amp;gt;
	&amp;lt;subtype name="my:relatedwhitepaper" /&amp;gt;
&amp;lt;/type&amp;gt;&lt;/PRE&gt;
&lt;P&gt;&lt;U&gt;Here is the webscript definition:&lt;/U&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;type.post.desc.xml&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;webscript&amp;gt;
    &amp;lt;shortname&amp;gt;type&amp;lt;/shortname&amp;gt;
    &amp;lt;description&amp;gt;Document List Component - type submit&amp;lt;/description&amp;gt;
    &amp;lt;url&amp;gt;/slingshot/doclib/type/node/{store_type}/{store_id}/{id}&amp;lt;/url&amp;gt;
    &amp;lt;format default="json"&amp;gt;argument&amp;lt;/format&amp;gt;
    &amp;lt;authentication&amp;gt;user&amp;lt;/authentication&amp;gt;
    &amp;lt;transaction&amp;gt;required&amp;lt;/transaction&amp;gt;
    &amp;lt;lifecycle&amp;gt;internal&amp;lt;/lifecycle&amp;gt;
&amp;lt;/webscript&amp;gt;&lt;/PRE&gt;
&lt;P&gt;In custom webscript, you can get the targetType and build the nodeRef based on "&lt;EM&gt;store_type, store_id and Id&lt;/EM&gt;" and use NodeService to set the type. All the required input will be available in json payload sent to the webscript on change Type action.&lt;/P&gt;
&lt;P&gt;You can find an example here:&amp;nbsp;&lt;A href="https://javaworld-abhinav.blogspot.com/2020/06/change-type-of-custom-content-types.html" target="_blank" rel="nofollow noopener noreferrer"&gt;https://javaworld-abhinav.blogspot.com/2020/06/change-type-of-custom-content-types.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 May 2020 16:54:41 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/is-there-a-way-to-change-nodetype-of-a-document/m-p/117168#M32434</guid>
      <dc:creator>abhinavmishra14</dc:creator>
      <dc:date>2020-05-28T16:54:41Z</dc:date>
    </item>
  </channel>
</rss>

