Forums de discussion

How to assign Kaleo Workflow to User instead of Roles

thumbnail
Vishal Panchal, modifié il y a 11 années.

How to assign Kaleo Workflow to User instead of Roles

Expert Publications: 289 Date d'inscription: 20/05/12 Publications récentes
Hi All,

I created my custom workflow definition.xml file now I am able to upload it and assign to my custom portlet.
I am successfully able to assign approval tasks to specific ROLES.

Now , my problem is I wanted to assign approval task directly to particular users instead of roles.

For that I saw this link--http://www.liferay.com/documentation/liferay-portal/6.0/administration/-/ai/workflow-with-kal-2
And found <user/> tag is there in definition.xml file as below,
<assignments>
<user />
</assignments>

But don't have any idea about how to specify a value in <user /> tag.

Any help will be appreciated.


Thanks & Regards,
Vishal R. Panchal
thumbnail
Hitoshi Ozawa, modifié il y a 11 années.

RE: How to assign Kaleo Workflow to User instead of Roles

Liferay Legend Publications: 7942 Date d'inscription: 24/03/10 Publications récentes
According to the dtd,
<assignments>
<user>
<user-id>user id</user-id>
</user>
</assignments>

OR

<assignments>
<user>
<screen-name>screen name</screen-name>
</user>
</assignments>

OR

<assignments>
<user>
<email-address>email address</email-address>
</user>
</assignments>
thumbnail
Vishal Panchal, modifié il y a 11 années.

RE: How to assign Kaleo Workflow to User instead of Roles

Expert Publications: 289 Date d'inscription: 20/05/12 Publications récentes
Hi Hitoshi Ozawa,

Thanks a TON..!
It is working like charm.!


Thanks & Regards,
Vishal R. Panchal
rino alias, modifié il y a 11 années.

RE: How to assign Kaleo Workflow to User instead of Roles

New Member Publications: 3 Date d'inscription: 22/08/12 Publications récentes
Hi guys,

This post helped me a lot. Now i would like to know how we can assign workflow to a user group?

Thanks in advance
thumbnail
Vishal Panchal, modifié il y a 11 années.

RE: How to assign Kaleo Workflow to User instead of Roles

Expert Publications: 289 Date d'inscription: 20/05/12 Publications récentes
rino alias:
Hi guys,

This post helped me a lot. Now i would like to know how we can assign workflow to a user group?

Thanks in advance


Hi rino alias,

I think according to DTD it is not possible but yes one way is still there.

you may try following steps,

1) first you can create a usergroup
2) assign number of users to a user group
3) create one role and associate it with the usergroup
so what happened a role which u assigned to a user group is ultimately assigned to each of the members assigned to the same user group.
4) now you can assign the work flow to the role which you have created for usergroup by using code below.

<assignments>
<roles>
<role>
<role-type>regular</role-type>
<name>sample-usergroup-role</name>
</role>
</roles>
</assignments>

I never tried it but according to me it must work.emoticon!

Thanks & Regards,
Vishal R. Panchal
Tri Le, modifié il y a 10 années.

RE: How to assign Kaleo Workflow to User instead of Roles

New Member Envoyer: 1 Date d'inscription: 07/05/13 Publications récentes
Hi Vishal Panchal,

I have a issue. I wanna assign task to logging user. Therefore, I user a script by groovy
import com.liferay.portal.kernel.util.GetterUtil
import com.liferay.portal.kernel.workflow.WorkflowConstants
import com.liferay.portal.model.User
import com.liferay.portal.service.UserLocalServiceUtil

long userId = GetterUtil.getLong((String)workflowContext.get(WorkflowConstants.CONTEXT_USER_ID))
User user = UserLocalServiceUtil.getUser(userId)

But It shows this error:

import com.liferay.portal.kernel.util.GetterUtil
import com.liferay.portal.kernel.workflow.WorkflowConstants
import com.liferay.portal.model.User
import com.liferay.portal.service.UserLocalServiceUtil

04:16:31,866 ERROR [liferay/kaleo_graph_walker-2][ParallelDestination:117] Unable to process message {destinationName=liferay/kaleo_graph_walker, response=null, responseDestinationName=null, responseId=null, payload=com.liferay.portal.workflow.kaleo.runtime.graph.PathElement@1cfd0dd, values={principalPassword=null, principalName=13525, companyId=1}}
com.liferay.portal.kernel.messaging.MessageListenerException: com.liferay.portal.kernel.scripting.ScriptingException: No such property: roles for class: groovy.lang.Binding

Could you support me this problem.

Thanks and best regards
thumbnail
python shi, modifié il y a 10 années.

RE: How to assign Kaleo Workflow to User instead of Roles

New Member Publications: 11 Date d'inscription: 03/07/12 Publications récentes
Same problem:

<!--?xml version="1.0" encoding="UTF-8"?-->

<workflow-definition xmlns="urn:liferay.com:liferay-workflow_6.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="urn:liferay.com:liferay-workflow_6.1.0 http://www.liferay.com/dtd/liferay-workflow-definition_6_1_0.xsd">

	<name>Booking Document Approve</name>
	<description>Booking Document Workflow</description>
	<version>1</version>

	<state>
		<name>created</name>
		<metadata>
			{"xy":[78,53]}
		</metadata>
		<initial>true</initial>
		<transitions>
			<transition>
				<name>Validate Booking Document</name>
				<target>validate</target>
				<default>true</default>
			</transition>
		</transitions>
	</state>

	<condition>
		<name>validate</name>
		<script>
			<![CDATA[

				/*validate booking documents*/
				valid = true;
				
				if(valid) {
					returnValue = "VALID";
					return;
				}
				
				returnValue = "INVALID";
				return;
			]]>
		</script>
		<script-language>groovy</script-language>
		<transitions>
			<transition>
				<name>VALID</name>
				<target>determine-approval</target>
				<default>true</default>
			</transition>
			<transition>
				<name>INVALID</name>
				<target>update-validate</target>
				<default>false</default>
			</transition>
		</transitions>
	</condition>
	
	<task>
		<name>update-validate</name>
		<metadata>
			{"xy":[397,191]}
		</metadata>
		<actions>
			<notification>
				<name></name>
				<template>
					 

					System.out.println("email of validate update");
					
					
				</template>
				<template-language>freemarker</template-language>
				<notification-type>email</notification-type>
				<execution-type>onAssignment</execution-type>
			</notification>
		</actions>
		<assignments>
			<scripted-assignment>
				<script>
					<![CDATA[
	
					
					]]>
				</script>
				<script-language>groovy</script-language>
			</scripted-assignment>
		</assignments>
		<transitions>
			<transition>
				<name>update validate</name>
				<target>determine-approval</target>
			</transition>
		</transitions>
	</task>

	<condition>
		<name>determine-approval</name>
		<script>
			<![CDATA[ 
			  import com.liferay.portal.kernel.util.GetterUtil;
			  import com.liferay.portal.kernel.workflow.WorkflowConstants;
			  import com.liferay.portlet.documentlibrary.service.DLFolderLocalServiceUtil;
			  import com.liferay.portlet.documentlibrary.model.DLFolder;
			  import com.liferay.portlet.documentlibrary.model.DLFolderConstants;
			  import com.liferay.portal.service.UserLocalServiceUtil; 
			  import com.liferay.portal.model.Role;
			  import com.liferay.portlet.documentlibrary.service.DLFileVersionLocalServiceUtil;
			  import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil;
			  import com.liferay.portlet.documentlibrary.model.DLFileVersion;
			  import com.liferay.portlet.documentlibrary.model.DLFileEntry;
			  import com.liferay.portlet.documentlibrary.NoSuchFileVersionException;
			  import com.liferay.portal.service.ServiceContext;
			  import com.liferay.portal.kernel.util.Constants;
			  import com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil;
			  
			  try {
         		  long classPK =
          			GetterUtil.getLong((String)workflowContext.get(WorkflowConstants.CONTEXT_ENTRY_CLASS_PK));
			  System.out.println("Owner Approver Workflow: ***** Determine if Approval needed ****");


              /* Check classPK is the file version id  */
			  
			  DLFileVersion fileVersion = DLFileVersionLocalServiceUtil.getFileVersion(classPK);
			  String title = fileVersion.getTitle();
			  System.out.println("Owner Approver Workflow: DLFileVersion title ["+title+"]");
			  String version = fileVersion.getVersion();
			  System.out.println("Owner Approver Workflow: DLFileVersion version ["+version+"]");
			  System.out.println("Owner Approver Workflow: DLFileVersion status ["+fileVersion.getStatus()+"]");
			  System.out.println("Owner Approver Workflow: DLFileVersion approved ["+fileVersion.getApproved()+"]");
			  System.out.println("Owner Approver Workflow: DLFileVersion draft? ["+fileVersion.isDraft()+"]");
			  System.out.println("Owner Approver Workflow: changeLog? ["+fileVersion.getChangeLog()+"]");

			  ServiceContext serviceContext = (ServiceContext)workflowContext.get("serviceContext");
			  String cmd = serviceContext.getCommand();
			  System.out.println("Owner Approver Workflow: service context cmd ["+cmd+"]");
			  

			  
			  /* Determine workflow actions based on user's command */
			  if (cmd.equals(Constants.CHECKIN)) {
				System.out.println("Owner Approver Workflow:Checkin ["+version+"]");
			  	returnValue="PUBLISH";
				return;
			  } 
 			  if (cmd.equals(Constants.PUBLISH)| cmd.equals(Constants.ADD)) {
				System.out.println("Owner Approver Workflow:Publish ["+version+"]");
			  	returnValue="PUBLISH";
				return;
			  }
			  if (cmd.equals(Constants.UPDATE)) {
				System.out.println("Owner Approver Workflow:Update ["+version+"]");
			  	returnValue="UPDATE";
				return;
			  } 

			  /* AS save-and-checkin will triggers the workflow twice, thus need further checking
				to generate 'review task' only on checkin */
			  if (cmd.equals(Constants.UPDATE_AND_CHECKIN)) {
				System.out.println("Owner Approver Workflow:Update-and-checkin ["+version+"]");
			  	returnValue="UPDATE-PUBLISH";
				return;
			  } 
			  } catch (Exception e) {
				System.out.println("Owner Approver workflow: Exception caught in 'determine-approval'. Assigned task to 'Administrator'");
				e.printStackTrace();
				returnValue="ERROR";
				return;
			  }

			  System.out.println("Owner Approver Workflow:All other cmd ["+cmd+"] consider PUBLISH ["+version+"]");
			  returnValue="PUBLISH";
			  return;
			]]>
		</script>
		<script-language>groovy</script-language>
	    <transitions>
			<transition>
				<name>UPDATE</name>
				<target>draft-update</target>
				<default>false</default>
			</transition>
			<transition>
				<name>PUBLISH</name>
				<target>review</target>
				<default>false</default>
			</transition>
			<transition>
				<name>UPDATE-PUBLISH</name>
				<target>review-branch</target>
				<default>false</default>
			</transition>
			<transition>
				<name>ERROR</name>
				<target>error</target>
				<default>false</default>
			</transition>
	    </transitions>
	</condition>
	
	<condition>
	   <name>review-branch</name>
	   <script>
		<![CDATA[
			  import com.liferay.portal.kernel.util.GetterUtil;
			  import com.liferay.portal.kernel.workflow.WorkflowConstants;
			  import com.liferay.portlet.documentlibrary.service.DLFolderLocalServiceUtil;
			  import com.liferay.portlet.documentlibrary.model.DLFolder;
			  import com.liferay.portlet.documentlibrary.model.DLFolderConstants;
			  import com.liferay.portal.service.UserLocalServiceUtil; 
			  import com.liferay.portal.model.Role;
			  import com.liferay.portlet.documentlibrary.service.DLFileVersionLocalServiceUtil;
			  import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil;
			  import com.liferay.portlet.documentlibrary.model.DLFileVersion;
			  import com.liferay.portlet.documentlibrary.model.DLFileEntry;
			  import com.liferay.portlet.documentlibrary.NoSuchFileVersionException;
			  import com.liferay.portal.service.ServiceContext;
			  import com.liferay.portal.kernel.util.Constants;
			  import com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil;

			  try {
         		  long classPK =
          			GetterUtil.getLong((String)workflowContext.get(WorkflowConstants.CONTEXT_ENTRY_CLASS_PK));
			  System.out.println("Owner Approver Workflow: ***** Determine if review is needed at this stage ****");

              /* Only set review task when the version is not a drafted version, that is when checkin has been done */

			  DLFileVersion fileVersion = DLFileVersionLocalServiceUtil.getFileVersion(classPK);
			  System.out.println("Owner Approver Workflow: DLFileVersion title ["+fileVersion.getTitle()+"]");
			  String version = fileVersion.getVersion();
			  System.out.println("Owner Approver Workflow: DLFileVersion version ["+version+"]");
			  System.out.println("Owner Approver Workflow: DLFileVersion status ["+fileVersion.getStatus()+"]");
			  System.out.println("Owner Approver Workflow: DLFileVersion approved ["+fileVersion.getApproved()+"]");
			  System.out.println("Owner Approver Workflow: DLFileVersion draft? ["+fileVersion.isDraft()+"]");

			  if (fileVersion.isDraft()) {
				System.out.println("Owner Approver Workflow:update-and-Checkin ["+version+"], no review needed");
			  	returnValue="END";
				return;
			  } 

			  System.out.println("Owner Approver Workflow:update-and-Checkin ["+version+"], need review");
			  
			  returnValue="PUBLISH";
			  return;

			  } catch (Exception e) {
				System.out.println("Owner Approver workflow: Exception caught in 'review-branch'. Assigned task to 'Administrator'");
				e.printStackTrace();
				returnValue="ERROR";
				return;
			  }
		 ]]>
	   </script>
	   <script-language>groovy</script-language>
	   <transitions>
	   	<transition>
			<name>PUBLISH</name>
			<target>review</target>
			<default>false</default>
		</transition>
		<transition>
			<name>END</name>
			<target>End</target>
			<default>false</default>
		</transition>
		<transition>
			<name>ERROR</name>
			<target>error</target>
			<default>false</default>
		</transition>
	    </transitions>
    </condition>
        
	<task>
		<name>review</name>
		<description>booking document validate success, or updated assign task to TAO user</description>
		<metadata>
			{"xy":[225,45]}
		</metadata>
		<actions>
			<notification>
				<name>Review Booking Document Notification</name>
				<template>
					
				
				
					
					
				</template>
				<template-language>freemarker</template-language>
				<notification-type>email</notification-type>
				<execution-type>onAssignment</execution-type>
			</notification>
		</actions>
		<assignments>
			<scripted-assignment>
				<script>
					<![CDATA[
		
				
					
					]]>
				</script>
				<script-language>groovy</script-language>
			</scripted-assignment>
		</assignments>
		<transitions>
			<transition>
				<name>approve</name>
				<target>approved</target>
		    </transition>
		    <transition>
				<name>reject-revise</name>
				<target>update</target>
				<default>false</default>
		    </transition>
		</transitions>
	</task>
	
	<task>
		<name>update</name>
			<metadata>
			{"xy":[397,191]}
		</metadata>
		<actions>
			<notification>
				<name>Update Booking Document Notification Email</name>
				<template>
					
					
				
					 
				</template>
				<template-language>freemarker</template-language>
				<notification-type>email</notification-type>
				<execution-type>onAssignment</execution-type>
			</notification>
		</actions>
		<assignments>
			<scripted-assignment>
				<script>
					<![CDATA[
					     
					]]>
				</script>
				<script-language>groovy</script-language>
			</scripted-assignment>
		</assignments>
		<transitions>
			<transition>
				<name>resubmit</name>
				<target>review</target>
			</transition>
		</transitions>
	</task>
	
	<task>
		<name>delete</name>
		<actions>
			<action>
				<name>booking doc is deleted by reviewer</name>
				<script>
					<![CDATA[
					System.out.println("booking doc is deleted by reviewer");
					
					]]>
				</script>
				<script-language>groovy</script-language>
				<execution-type>onEntry</execution-type>
			</action>
			<notification>
				<name>Send email to Vendor, that booking is canceled</name>
				<template>
					
					
					
					
				</template>
				<template-language>freemarker</template-language>
				<notification-type>email</notification-type>
				<execution-type>onAssignment</execution-type>
			</notification>
		</actions>
		<assignments>
			<scripted-assignment>
				<script>
					<![CDATA[
						
					
					]]>
				</script>
				<script-language>groovy</script-language>
			</scripted-assignment>
		</assignments>
		<transitions>
			<transition>
				<name>Booking Canceled</name>
				<target>End</target>
				<default>true</default>
			</transition>
		</transitions>
	</task>

	<task>
		<name>error</name>
		<description>Workflow exception assign to dmsadmin/icil_sup to handle it</description>
		<actions>
			<notification>
				<name>Document Workflow Exception</name>
				<template>
					

				
						
					
				</template>
				<template-language>freemarker</template-language>
				<notification-type>email</notification-type>
				<execution-type>onAssignment</execution-type>
			</notification>
		</actions>
		<assignments>
			<roles>
				<role>
					<role-type>regular</role-type>
					<name>Administrator</name>
				</role>
			</roles>
		</assignments>
		<transitions>
			<transition>
				<name>approve</name>
				<target>approved</target>
		    </transition>
		    <transition>
				<name>reject-revise</name>
				<target>update</target>
				<default>false</default>
		    </transition>
		    <transition>
		    	<name>reject-delete</name>
		    	<target>delete</target>
		    	<default>false</default>
		    </transition>
		</transitions>
	</task>
	
	<state>
	   <name>draft-update</name>
	   <actions>
		<action>
		   <name>draft</name>
		   <script>
			<![CDATA[
				import com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil;
				import com.liferay.portal.kernel.workflow.WorkflowConstants;
				

 				WorkflowStatusManagerUtil.updateStatus(WorkflowConstants.toStatus(WorkflowConstants.LABEL_DRAFT), workflowContext);
				System.out.println("Owner Approver Workflow: ***** Draft Update: no review needed *****");
			]]>	
		   </script>
		   <script-language>groovy</script-language>
		   <execution-type>onEntry</execution-type>
		</action>
	    </actions>
	</state>
	
	<state>
		<name>approved</name>
		<metadata>
		  	{"xy":[422,56]}
		</metadata>
		<actions>
			<action>
				<name>update state to approve</name>
				<script>
					<![CDATA[
					    System.out.println("update state to approve");
					]]>
				</script>
				<script-language>groovy</script-language>
				<execution-type>onEntry</execution-type>
			</action>
			<action>
				<name>Call Create Booking Webservice</name>
				<script>
					<![CDATA[

					System.out.println("call webserivce of create booking");
					
					]]>
				</script>
				<script-language>groovy</script-language>
				<execution-type>onExit</execution-type>
			</action>
		</actions>
		<transitions>
			<transition>
				<name>Approval Done</name>
				<target>End</target>
				<default>true</default>
			</transition>
		</transitions>
	</state>
	
	<state>
		<name>End</name>
	   	<actions>
			<action>
			   <name>end</name>
			   <script>
				   <![CDATA[
						
						System.out.println("*******   Booking bookingNo has created  ***********");
				   ]]>	
			   </script>
			   <script-language>groovy</script-language>
			   <execution-type>onEntry</execution-type>
			</action>
	    </actions>
	</state>
</workflow-definition>





19:20:33,971 ERROR [ParallelDestination:109] Unable to process message {destinationName=liferay/kaleo_graph_walker, response=null, responseDestinationName=null, responseId=null, payload=com.liferay.portal.workflow.kaleo.runtime.graph.PathElement@78ce33f0, values={principalPassword=null, principalName=11425, companyId=10154}}
com.liferay.portal.kernel.messaging.MessageListenerException: com.liferay.portal.kernel.scripting.ScriptingException: No such property: roles for class: groovy.lang.Binding
Line 1:
Line 2:
Line 3:
Line 4:
Line 5:
Line 6:
Line 7:

at com.liferay.portal.kernel.messaging.BaseMessageListener.receive(BaseMessageListener.java:31)
at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessageListener.java:65)
at com.liferay.portal.kernel.messaging.ParallelDestination$1.run(ParallelDestination.java:106)
at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask._runTask(ThreadPoolExecutor.java:669)
at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask.run(ThreadPoolExecutor.java:580)
at java.lang.Thread.run(Thread.java:662)
Caused by: com.liferay.portal.kernel.scripting.ScriptingException: No such property: roles for class: groovy.lang.Binding
Line 1:
thumbnail
David H Nebinger, modifié il y a 9 années.

RE: How to assign Kaleo Workflow to User instead of Roles

Liferay Legend Publications: 14915 Date d'inscription: 02/09/06 Publications récentes
Vinoth kumar Palanisamy:
Initialise the property 'roles'.It should work.
Add this to the groovy script
roles = new ArrayList<Role>();


Seriously? That's your response? Tell me where exactly in his workflow xml are you going to put this code?
Daniel Oswaldo Lopez Tassara, modifié il y a 10 années.

RE: How to assign Kaleo Workflow to User instead of Roles

New Member Publications: 3 Date d'inscription: 21/05/13 Publications récentes
Vishal Panchal:
rino alias:
Hi guys,

This post helped me a lot. Now i would like to know how we can assign workflow to a user group?

Thanks in advance


Hi rino alias,

I think according to DTD it is not possible but yes one way is still there.

you may try following steps,

1) first you can create a usergroup
2) assign number of users to a user group
3) create one role and associate it with the usergroup
so what happened a role which u assigned to a user group is ultimately assigned to each of the members assigned to the same user group.
4) now you can assign the work flow to the role which you have created for usergroup by using code below.

<assignments>
<roles>
<role>
<role-type>regular</role-type>
<name>sample-usergroup-role</name>
</role>
</roles>
</assignments>

I never tried it but according to me it must work.emoticon!

Thanks & Regards,
Vishal R. Panchal



Hi Vishal Panchal.

I have the same problem that Rino has. Well, I followed your instructions, but doesn't works.

What I have seen, is that when I create a Role (whatever type it is... regular, site or organization), and assign that role to a user group... the users of that group doesn't show in the option "Assign to..." of the task in the workflow.

But, when the role is assigned directly to a specific user (member of the site where the workflow performs), the user is shown in the list of the option "Assign to..." of the task in the workflow.

Well, I don't know if is the normal behaviour of Kaleo Workflow... or there is a solution for this.

I really would appreciate your help.

Thank you in advance.
Balázs Csönge, modifié il y a 9 années.

RE: How to assign Kaleo Workflow to User instead of Roles

Regular Member Publications: 107 Date d'inscription: 10/11/14 Publications récentes
Hi

We using liferay with Activiti workflow engine instead of Kaleo, but the problem with user-group related role is same.
my problem and my solution

So it is not Kaleo specific behaviour. Maybe Kaleo engine is using same way to get user list, like Activiti:
List<user> roleUsers = UserLocalServiceUtil.getRoleUsers(roleId);</user>

But this returns only those users which are related to the role directly. After some days of suffering I found the way, how can I get the list of those users, who are related to a role only through a user group. Check my last post at that topic.

My code represents a test case, so if more user groups are related to a role, my code will not join the list of users. It only show the way, how can u get user lists.
In Kaleo you will get companyId different way than me (because of the difference between Activiti and Kaleo), but the rest will be the same, I think.
Anjaneya E, modifié il y a 7 années.

RE: How to assign Kaleo Workflow to User instead of Roles

New Member Publications: 2 Date d'inscription: 03/03/17 Publications récentes
Hi All ,

Am trying to assign Approvers in workflow dynamically using script assignment .

import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.workflow.WorkflowConstants
import com.liferay.portal.kernel.service.ServiceContext

import com.liferay.portal.kernel.model.User;
import com.liferay.portal.kernel.service.UserLocalServiceUtil;

long companyId = GetterUtil.getLong((String) workflowContext.get(WorkflowConstants.CONTEXT_COMPANY_ID));
ServiceContext serviceContext = (ServiceContext) workflowContext.get(WorkflowConstants.CONTEXT_SERVICE_CONTEXT);
long classPK = GetterUtil.getLong((String)workflowContext.get(WorkflowConstants.CONTEXT_ENTRY_CLASS_PK));



User approver=UserLocalServiceUtil.getUser(70101);
println("<<<<< user Information is >>>> "+ approver);
user.add(70101);
roles=null;


also i tried to put users in List

users=new ArrayList<User>();
users.add(approver)

but am getting below error .
com.liferay.portal.kernel.messaging.MessageListenerException: com.liferay.portal.kernel.scripting.ScriptingException: No such property: user for class: Script1_Line 1: _Line 2: import com.liferay.portal.kernel.util.GetterUtil;_Line 3: import com.liferay.portal.kernel.workflow.WorkflowConstants_Line 4: import com.liferay.portal.kernel.service.ServiceContext_Line 5: import com.liferay.document.library.kernel.service.DLFileVersionLocalServiceUtil;_Line 6: import com.liferay.document.library.kernel.service.DLFileEntryTypeLocalServiceUtil;_Line 7: import com.liferay.document.library.kernel.model.DLFileEntryType_Line 8: import com.liferay.dynamic.data.mapping.kernel.DDMStructure;_Line 9: import com.liferay.dynamic.data.mapping.kernel.DDMFormValues;_Line 10: import com.liferay.portal.kernel.model.User;_Line 11: import com.liferay.portal.kernel.service.UserLocalServiceUtil;_Line 12: _Line 13: long companyId = GetterUtil.getLong((String) workflowContext.get(WorkflowConstants.CONTEXT_COMPANY_ID));_Line 14: ServiceContext serviceContext = (ServiceContext) workflowContext.get(WorkflowConstants.CONTEXT_SERVICE_CONTEXT);_Line 15: long classPK = GetterUtil.getLong((String)workflowContext.get(WorkflowConstants.CONTEXT_ENTRY_CLASS_PK)); _Line 16: String str = (String)serviceContext.getAttribute("fileEntryId");_Line 17: _Line 18: _Line 19: User approver=UserLocalServiceUtil.getUser(70101); _Line 20: println("<<<<< user Information is >>>> "+ approver); _Line 21: user.add(70101);_Line 22: roles=null;_Line 23: _ [Sanitized]
at com.liferay.portal.kernel.messaging.BaseMessageListener.receive(BaseMessageListener.java:32)
at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessageListener.java:74)
at com.liferay.portal.kernel.messaging.ParallelDestination$1.run(ParallelDestination.java:52)
at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask._runTask(ThreadPoolExecutor.java:756)
at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask.run(ThreadPoolExecutor.java:667)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.liferay.portal.kernel.scripting.ScriptingException: No such property: user for class: Script1_Line 1: _Line 2: import com.liferay.portal.kernel.util.GetterUtil;_Line 3: import com.liferay.portal.kernel.workflow.WorkflowConstants_Line 4: import com.liferay.portal.kernel.service.ServiceContext_Line 5: import com.liferay.document.library.kernel.service.DLFileVersionLocalServiceUtil;_Line 6: import com.liferay.document.library.kernel.service.DLFileEntryTypeLocalServiceUtil;_Line 7: import com.liferay.document.library.kernel.model.DLFileEntryType_Line 8: import com.liferay.dynamic.data.mapping.kernel.DDMStructure;_Line 9: import com.liferay.dynamic.data.mapping.kernel.DDMFormValues;_Line 10: import com.liferay.portal.kernel.model.User;_Line 11: import com.liferay.portal.kernel.service.UserLocalServiceUtil;_Line 12: _Line 13: long companyId = GetterUtil.getLong((String) workflowContext.get(WorkflowConstants.CONTEXT_COMPANY_ID));_Line 14: ServiceContext serviceContext = (ServiceContext) workflowContext.get(WorkflowConstants.CONTEXT_SERVICE_CONTEXT);_Line 15: long classPK = GetterUtil.getLong((String)workflowContext.get(WorkflowConstants.CONTEXT_ENTRY_CLASS_PK)); _Line 16: String str = (String)serviceContext.getAttribute("fileEntryId");_Line 17: _Line 18: _Line 19: User approver=UserLocalServiceUtil.getUser(70101); _Line 20: println("<<<<< user Information is >>>> "+ approver); _Line 21: user.add(70101);_Line 22: roles=null;_Line 23: _ [Sanitized]
at com.liferay.portal.scripting.internal.ScriptingImpl.eval(ScriptingImpl.java:91)
at com.liferay.portal.workflow.kaleo.runtime.scripting.internal.assignment.ScriptingLanguagesTaskAssignmentSelector.calculateTaskAssignments(ScriptingLanguagesTaskAssignmentSelector.java:65)
at com.liferay.portal.workflow.kaleo.runtime.internal.assignment.MultiLanguageTaskAssignmentSelector.calculateTaskAssignments(MultiLanguageTaskAssignmentSelector.java:80)
at com.liferay.portal.workflow.kaleo.runtime.internal.node.TaskNodeExecutor.createTaskInstanceToken(TaskNodeExecutor.java:121)
at com.liferay.portal.workflow.kaleo.runtime.internal.node.TaskNodeExecutor.doEnter(TaskNodeExecutor.java:159)
at com.liferay.portal.workflow.kaleo.runtime.node.BaseNodeExecutor.enter(BaseNodeExecutor.java:51)
at com.liferay.portal.workflow.kaleo.runtime.internal.graph.DefaultGraphWalker.follow(DefaultGraphWalker.java:65)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:153)
at com.liferay.portal.spring.transaction.DefaultTransactionExecutor.execute(DefaultTransactionExecutor.java:85)
at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:58)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:127)
at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:173)
at com.sun.proxy.$Proxy413.follow(Unknown Source)
at com.liferay.portal.workflow.kaleo.runtime.internal.graph.messaging.PathElementMessageListener.doReceive(PathElementMessageListener.java:57)
at com.liferay.portal.kernel.messaging.BaseMessageListener.receive(BaseMessageListener.java:26)
... 5 more
Caused by: groovy.lang.MissingPropertyException: No such property: user for class: Script1
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53)
at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:307)
at Script1.run(Script1.groovy:21)
at com.liferay.portal.scripting.groovy.internal.GroovyExecutor.eval(GroovyExecutor.java:64)
at com.liferay.portal.scripting.internal.ScriptingImpl.eval(ScriptingImpl.java:87)
thumbnail
Dámaris Suárez Corrales, modifié il y a 6 années.

RE: How to assign Kaleo Workflow to User instead of Roles

New Member Publications: 14 Date d'inscription: 02/03/17 Publications récentes
Hi Anjaneya E, you must do a trick inside the source code of kaleo in order to be able to add "users" variable into scripted-assignments block. By default, kaleo only accepts "roles" and "user" (only one user, not a list of them). So it does not expect "users", but a single user, and it complains because you didn't specify "user" variable.

So just put user = approver and it should stop complaining (user = null should also work).
If you need to assign this task to more than one user (for example, all members of an organization) then you need to tweak kaleo-web source code but it is not that difficult. Let me know if you need that, and I send you mi code.

I hope it helps!
Pallavi Havale, modifié il y a 6 années.

RE: How to assign Kaleo Workflow to User instead of Roles

New Member Publications: 9 Date d'inscription: 28/08/15 Publications récentes
Hi Hitoshi ,
Can we assign Kaleo Workflow to User as well as group ???

1 I am currently working on workflow task ,which I configure with Document and media portlet,
My requirement is ,If User A Upload the document It should go to the User B. Which I assigned in definition file
<user>
<screen-name>User B</screen-name>
</user>
2 User B will get notification and User B can able to assign this task to User C Which is belonging to the same group
Then User C will get notification but User C not be able to assign to next person who is belonging to the same group.

Please Help Me,
Thank You In Advance.

Pallavi
thumbnail
Russell Bohl, modifié il y a 6 années.

RE: How to assign Kaleo Workflow to User instead of Roles

Expert Publications: 291 Date d'inscription: 13/02/13 Publications récentes
Pallavi Havale:
Hi Hitoshi ,
Can we assign Kaleo Workflow to User as well as group ???

1 I am currently working on workflow task ,which I configure with Document and media portlet,
My requirement is ,If User A Upload the document It should go to the User B. Which I assigned in definition file
<user>
<screen-name>User B</screen-name>
</user>
2 User B will get notification and User B can able to assign this task to User C Which is belonging to the same group
Then User C will get notification but User C not be able to assign to next person who is belonging to the same group.

Please Help Me,
Thank You In Advance.

Pallavi


Hi Pallavi,

As far as assigning users, what you're doing should work, using the screen name.

You can also use the user-id tag and pass the user id, or the email-address.

You can then assign the next task to a role. Assign the role to your group, and you should get what you're looking for.

Here's an example using an existing role:

    <assignments>
        <roles>
            <role>
                <role-type>organization</role-type>
                <name>Organization Administrator</name>
            </role>
        </roles>
    </assignments>
Gayathri M, modifié il y a 4 années.

RE: How to assign Kaleo Workflow to User instead of Roles

New Member Publications: 13 Date d'inscription: 22/12/16 Publications récentes
Hi,
Instead of selecting User or Role, How I will get an option to select the user from the notification? Can you please anyone help with this???


Thanks & Regards,Gayathri. M