<?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: search.findNode error in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/search-findnode-error/m-p/65590#M22167</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, that is the annoying part of the workflow-related Script API. Any nodes set via the WorkflowService Java API (e.g. via Share forms) are already ActivitiScriptNode instances because the Java API parts already convert it as such. But when you are running a JavaScript listener, you are already "below" that API layer, and you need to convert any NodeRef you get (i.e. by creating a person) to an instance of that Java class yourself. You cannot do that with just JavaScript. The only way to solve this is to write yourself a small little Java-based extension of the Script API that does that conversion for you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 16 Mar 2018 08:47:07 GMT</pubDate>
    <dc:creator>afaust</dc:creator>
    <dc:date>2018-03-16T08:47:07Z</dc:date>
    <item>
      <title>search.findNode error</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/search-findnode-error/m-p/65587#M22164</link>
      <description>Hi,when i create a new person, a java function is&amp;nbsp;called, using the fields bellow&amp;nbsp; :Java function uses getPerson() method from PersonService Class:@Autowired private AuthorityService authorityService; @Override public NodeRef createPatient(String idPatient, String nomPatient, String prenomPatient, D</description>
      <pubDate>Tue, 13 Mar 2018 16:12:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/search-findnode-error/m-p/65587#M22164</guid>
      <dc:creator>anakin59490</dc:creator>
      <dc:date>2018-03-13T16:12:00Z</dc:date>
    </item>
    <item>
      <title>Re: search.findNode error</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/search-findnode-error/m-p/65588#M22165</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is no out of the box API to get instances of ActivitiScriptNode in default Alfresco. In one project for a customer I built myself a custom extension of the Script API to deal with this.&lt;/P&gt;&lt;P&gt;Unfortunately, the scripts run inside the workflow are run as "insecure scripts", so they do not have access to the full scope of the Java interoperability features. With these features it would be possible to manually create an instance of ActivitiScriptNode even without any special API.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2018 17:07:10 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/search-findnode-error/m-p/65588#M22165</guid>
      <dc:creator>afaust</dc:creator>
      <dc:date>2018-03-13T17:07:10Z</dc:date>
    </item>
    <item>
      <title>Re: search.findNode error</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/search-findnode-error/m-p/65589#M22166</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thank's for your reply.&lt;/P&gt;&lt;P&gt;Also i may be wrong, because :&lt;/P&gt;&lt;P&gt;- it doesn't work when i create new person&lt;/P&gt;&lt;P&gt;- but it works when i pick-up personn&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So i have added log in javascript called by task (complete) in order to follow workflow&amp;nbsp;step by step :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;if(task.getVariable('wfvd_newPatient') == true)&lt;BR /&gt; {&lt;BR /&gt; idPatient = task.getVariable("wfvd_idPatient");&lt;BR /&gt; nomPatient = task.getVariable("wfvd_nomPatient"); &lt;BR /&gt; PrenomPatient = task.getVariable("wfvd_prenomPatient");&lt;BR /&gt; dateNaissance = task.getVariable("wfvd_dateNaissance");&lt;BR /&gt;&lt;BR /&gt; var nodePat = createPatient(idPatient,PrenomPatient,nomPatient,dateNaissance);&lt;BR /&gt; execution.setVariable("wfvd_patients" ,nodePat);&lt;BR /&gt; logger.log("validation-documed.js mainValidationSecretaire - NEW nodePat =&amp;gt; " + nodePat);&lt;BR /&gt; logger.log("validation-documed.js mainValidationSecretaire - NEW idPatient =&amp;gt; " + idPatient);&lt;BR /&gt; logger.log("validation-documed.js mainValidationSecretaire - NEW nomPatient =&amp;gt; " + nomPatient);&lt;BR /&gt; logger.log("validation-documed.js mainValidationSecretaire - NEW PrenomPatient =&amp;gt; " + PrenomPatient);&lt;BR /&gt; logger.log("validation-documed.js mainValidationSecretaire - dateNaissance =&amp;gt; " + dateNaissance);&lt;BR /&gt;&lt;BR /&gt; //var node = search.findNode(nodePat)&lt;BR /&gt; //execution.setVariable("wfvd_patients",node);&lt;BR /&gt; logger.log("validation-documed.js mainValidationSecretaire -NEW wfvd_patients =&amp;gt; " +execution.getVariable("wfvd_patients"));&lt;BR /&gt; }&lt;BR /&gt; else&lt;BR /&gt; { &lt;BR /&gt; var patientSelectione = task.getVariable('wfvd_patients');&lt;BR /&gt; logger.log("validation-documed.js mainValidationSecretaire - patientSelectione =&amp;gt; " + patientSelectione);&lt;BR /&gt; idPatient = patientSelectione.properties["os:idPatient"];&lt;BR /&gt; logger.log("validation-documed.js mainValidationSecretaire - os:idPatient =&amp;gt; " +patientSelectione.properties["os:idPatient"]);&lt;BR /&gt; nomPatient = patientSelectione.properties["cm:lastName"]; &lt;BR /&gt; logger.log("validation-documed.js mainValidationSecretaire - cm:lastName =&amp;gt; " +patientSelectione.properties["cm:lastName"]);&lt;BR /&gt; PrenomPatient = patientSelectione.properties["cm:firstName"];&lt;BR /&gt; logger.log("validation-documed.js mainValidationSecretaire - cm:firstName =&amp;gt; " +patientSelectione.properties["cm:firstName"]);&lt;BR /&gt; dateNaissance = patientSelectione.properties["os:dateNaissance"];&lt;BR /&gt; logger.log("validation-documed.js mainValidationSecretaire - os:dateNaissance =&amp;gt; " +patientSelectione.properties["os:dateNaissance"]);&lt;BR /&gt; execution.setVariable("wfvd_patients" ,task.getVariable("wfvd_patients"));&lt;BR /&gt; }&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And this is result :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;picker&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;validation-documed.js mainValidationSecretaire - patientSelectione =&amp;gt; &lt;STRONG&gt;&lt;SPAN&gt;Node Type: {&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www.alfresco.org/model/content/1.0" rel="nofollow noopener noreferrer" target="_blank"&gt;http://www.alfresco.org/model/content/1.0&lt;/A&gt;&lt;SPAN&gt;}person, Node Aspects: [{&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www.alfresco.org/model/content/1.0" rel="nofollow noopener noreferrer" target="_blank"&gt;http://www.alfresco.org/model/content/1.0&lt;/A&gt;&lt;SPAN&gt;}ownable, {&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www.alfresco.org/model/system/1.0" rel="nofollow noopener noreferrer" target="_blank"&gt;http://www.alfresco.org/model/system/1.0&lt;/A&gt;&lt;SPAN&gt;}cascadeUpdate, {&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www.opensolution.com/model/content/1.0" rel="nofollow noopener noreferrer" target="_blank"&gt;http://www.opensolution.com/model/content/1.0&lt;/A&gt;&lt;SPAN&gt;}patient, {&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www.alfresco.org/model/system/1.0" rel="nofollow noopener noreferrer" target="_blank"&gt;http://www.alfresco.org/model/system/1.0&lt;/A&gt;&lt;SPAN&gt;}referenceable, {&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www.alfresco.org/model/system/1.0" rel="nofollow noopener noreferrer" target="_blank"&gt;http://www.alfresco.org/model/system/1.0&lt;/A&gt;&lt;SPAN&gt;}localized]&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;BR /&gt;validation-documed.js mainValidationSecretaire - os:idPatient =&amp;gt; 123789&lt;BR /&gt;validation-documed.js mainValidationSecretaire - cm:lastName =&amp;gt; toto&lt;BR /&gt;validation-documed.js mainValidationSecretaire - cm:firstName =&amp;gt; titi&lt;BR /&gt;validation-documed.js mainValidationSecretaire - os:dateNaissance =&amp;gt; Fri Jan 01 00:00:00 CET 1965&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;New person :&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;validation-documed.js mainValidationSecretaire - NEW nodePat =&amp;gt; &lt;STRONG&gt;workspace://SpacesStore/9a63089e-94de-4473-a200-a59cc5f59c8b&lt;/STRONG&gt;&lt;BR /&gt;validation-documed.js mainValidationSecretaire - NEW idPatient =&amp;gt; 454545&lt;BR /&gt;validation-documed.js mainValidationSecretaire - NEW nomPatient =&amp;gt; nom2&lt;BR /&gt;validation-documed.js mainValidationSecretaire - NEW PrenomPatient =&amp;gt; prenom2&lt;BR /&gt;validation-documed.js mainValidationSecretaire - dateNaissance =&amp;gt; Tue Jul 16 00:00:00 CET 1957&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To resume : when person already exists &lt;STRONG&gt;(&lt;/STRONG&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&lt;STRONG&gt;execution.setVariable("wfvd_patients" ,task.getVariable("wfvd_patients")):smileywink:&lt;/STRONG&gt;&amp;nbsp;it works and when person doesn't exist (&lt;SPAN&gt;&lt;STRONG&gt;execution.setVariable("wfvd_patients" ,nodePat);&lt;/STRONG&gt;) it doesn't work&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&lt;SPAN&gt;How can i solve ? is it really Node that i need ?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Mar 2018 11:13:51 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/search-findnode-error/m-p/65589#M22166</guid>
      <dc:creator>anakin59490</dc:creator>
      <dc:date>2018-03-14T11:13:51Z</dc:date>
    </item>
    <item>
      <title>Re: search.findNode error</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/search-findnode-error/m-p/65590#M22167</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, that is the annoying part of the workflow-related Script API. Any nodes set via the WorkflowService Java API (e.g. via Share forms) are already ActivitiScriptNode instances because the Java API parts already convert it as such. But when you are running a JavaScript listener, you are already "below" that API layer, and you need to convert any NodeRef you get (i.e. by creating a person) to an instance of that Java class yourself. You cannot do that with just JavaScript. The only way to solve this is to write yourself a small little Java-based extension of the Script API that does that conversion for you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Mar 2018 08:47:07 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/search-findnode-error/m-p/65590#M22167</guid>
      <dc:creator>afaust</dc:creator>
      <dc:date>2018-03-16T08:47:07Z</dc:date>
    </item>
  </channel>
</rss>

