cancel
Showing results for 
Search instead for 
Did you mean: 

ERROR - Passed value is not an instance of ActivitiScriptNode!

irenailievska1
Champ in-the-making
Champ in-the-making
Hello,
I have a little bit of problem -  I need to automate a process by using document name (all required info will be in the document title).
Ex.  ID_PRICE_GROUP.pdf
So I get the info of the document like this:

    <startEvent id="startevent1" name="Start" activiti:formKey="swf:submitProcess">
      <extensionElements>
        <activiti:executionListener event="start" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[

               var docSubject = bpm_package.children[0].properties["cm:name"];
               var docSubjectArray = docSubject.split("_");
                                        // AT THIS POINT I HAVE AN ARRAY WITH ALL THE INFO I NEED LIKE WHAT GROUP TO BE SENT TO ETC.
               ]]></activiti:string>
          </activiti:field>
        </activiti:executionListener>
      </extensionElements>
    </startEvent>


The next step is to set all the info where I need it  - the group that needs to receive the document. So I get the group from the array like this:

        var gr = docSubjectArray[3];
   var g = groups.getGroup("GROUP_"+gr);
       
   //logger.log("\n\n\n GROUP NODE = " + g.groupNode);
         execution.setVariable('swf_group',g.groupNode);

   //maybe even like this logger.log("\n\n\n GROUP NODE REF = " + g.groupNodeRef);
        //var kk = search.findNode(g.groupNodeRef);
   //logger.log("\n\n\n KK = "+ kk);


But I get the error that Passed value is not an instance of ActivitiScriptNode, cannot set value.
In the content model I have association:


                 <aspect name="swf:group">
         <associations>
            <association name="swf:group">
               <source>
                  <mandatory>false</mandatory>
                  <many>false</many>
               </source>
               <target>
                  <class>cm:authorityContainer</class>
                  <mandatory>false</mandatory>
                  <many>false</many>
               </target>
            </association>
         </associations>
      </aspect>


Can somebody help me with this? I am stuck Smiley Sad.
Maybe I can transform it somehow, or get and set the group some other way?

Thank you in advance,
Irena
2 REPLIES 2

irenailievska1
Champ in-the-making
Champ in-the-making
SOLVED ! - I made small changes in the code - instead of sending the whole group (error: can not serialize value in variable) I am setting the
value of variable (ex. myGroup -> execution.setVariable('myGroup', g.getGroupNode().properties.authorityName )) with the Authority Name.
And changed the variable I use in the task
-> instead of
<code> activiti:candidateGroups="${swf_group.properties.authorityName}"
</code>
-> I use
<code>activiti:candidateGroups="${myGroup}".
</code>

jbarrez
Star Contributor
Star Contributor
Thanks for posting back your solution.