Last active
December 9, 2022 02:39
-
-
Save 000benniu/37fcc1beba153d8d34791d14e0a489cc to your computer and use it in GitHub Desktop.
Kaleo Condition Check script Sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.liferay.portal.kernel.workflow.WorkflowConstants; | |
import com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil; | |
import com.liferay.portal.kernel.service.ServiceContext; | |
try { | |
System.out.println("=====================Start Script================================"); | |
System.out.println("=====================workflowContext================================"); | |
workflowContext.each{ k, v -> System.out.println "${k}:${v}" } | |
serviceContextInstance = (ServiceContext)workflowContext.get("serviceContext"); | |
serviceContextInstanceAttributes = serviceContextInstance.getAttributes(); | |
System.out.println("=====================attributes================================"); | |
serviceContextInstanceAttributes.each{ k, v -> System.out.println "${k}:${v}" } | |
attributesString = serviceContextInstanceAttributes.toString(); | |
needReview = attributesString.contains("重要"); | |
System.out.println("need review:" + needReview); | |
if(needReview) { | |
System.out.println("===================== 重要 ================================"); | |
// this return value is the path's Id. | |
returnValue = "7da5c97c-d1fb-423b-ab7b-da795cc343df" | |
}else{ | |
System.out.println("===================== 一般 ================================"); | |
// this return value is the path's Id. | |
returnValue = "7e21c957-0d40-4c90-a595-81f712aea055" | |
} | |
} catch(Exception e) { | |
System.out.println("=====================Error================================"); | |
System.out.println("Error:" + e); | |
} | |
System.out.println("=====================End Script================================"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment