Fórumok

Kaleo - scripted assignments using forks and transitions

thumbnail
Sam Collett, módosítva 9 év-val korábban

Kaleo - scripted assignments using forks and transitions

Junior Member Bejegyzések: 64 Csatlakozás dátuma: 2008.11.13. Legújabb bejegyzések
Is it possible to assign a role based on the transition name used in a fork? I have multiple transitions with the same target, which works
<fork>
	    <name>forked</name>
	    <transitions>
	       <transition>
	         <name>Site Role 1</name>
	         <target>review</target>
	       </transition>
	       <transition>
	         <name>Site Role 2</name>
	         <target>review</target>
	       </transition>
	       <transition>
	         <name>Site Role 3</name>
	         <target>review</target>
	       </transition>
	    </transitions>
	</fork>

However, I then want to assign to a site role depending on the name of the transition
<assignments>
	<scripted-assignment>
		<script>
			<![CDATA[
					import com.liferay.portal.kernel.util.GetterUtil;
					import com.liferay.portal.kernel.workflow.WorkflowConstants;
					import com.liferay.portal.model.Role;
					import com.liferay.portal.service.RoleLocalServiceUtil;
					long companyId = GetterUtil.getLong((String)workflowContext.get(WorkflowConstants.CONTEXT_COMPANY_ID));
					string transitionName = GetterUtil.getString((String)workflowContext.get(WorkflowConstants.CONTEXT_TRANSITION_NAME));
					
					roles = new ArrayList<Role>();
					
					Role role = RoleLocalServiceUtil.getRole(companyId, transitionName);
					roles.add(role);
					
					user = null;
				]]>
			</script>
		<script-language>groovy</script-language>
	</scripted-assignment>
</assignments>

This however results in an exception
ERROR [liferay/kaleo_graph_walker-3][ParallelDestination:72] Unable to process message {destinationName=liferay/kaleo_graph_walker, response=null, responseDestinationName=null, responseId=null, payload=com.liferay.portal.workflow.kaleo.runtime.graph.PathElement@7d9da1bf, values={defaultLocale=en_GB, principalPassword=********, groupId=0, permissionChecker=com.liferay.portal.kernel.util.TransientValue@77e64306, principalName=17492, siteDefaultLocale=en_GB, companyId=10157, themeDisplayLocale=en_GB}}
com.liferay.portal.kernel.messaging.MessageListenerException: com.liferay.portal.kernel.scripting.ScriptingException: No signature of method: Script1.string() is applicable for argument types: (java.lang.String) values: []
Possible solutions: toString(), toString(), print(java.lang.Object), print(java.io.PrintWriter), sprintf(java.lang.String, java.lang.Object), print(java.lang.Object)
Line 1: 
Line 2: 					
Line 3: 							import com.liferay.portal.kernel.util.GetterUtil;
Line 4: 							import com.liferay.portal.kernel.workflow.WorkflowConstants;
Line 5: 							import com.liferay.portal.model.Role;
Line 6: 							import com.liferay.portal.service.RoleLocalServiceUtil;
Line 7: 							long companyId = GetterUtil.getLong((String)workflowContext.get(WorkflowConstants.CONTEXT_COMPANY_ID));
Line 8: 							string transitionName = GetterUtil.getString((String)workflowContext.get(WorkflowConstants.CONTEXT_TRANSITION_NAME));
Line 9: 							
Line 10: 							roles = new ArrayList<role>();
Line 11: 							
Line 12: 							Role role = RoleLocalServiceUtil.getRole(companyId, transitionName);
Line 13: 							roles.add(role);
Line 14: 							
Line 15: 							user = null;
Line 16: 						
Line 17: 					</role>

I basically want to prevent the need to create many tasks which do the same thing, but assign to multiple site roles (half a dozen or more)
Shruti Pandey, módosítva 8 év-val korábban

RE: Kaleo - scripted assignments using forks and transitions

New Member Bejegyzések: 23 Csatlakozás dátuma: 2015.11.18. Legújabb bejegyzések
Hi Sam,

were you able to achieve this requirement?
I have similar kind of requirement .
Can you please guide me.

Thanks.