on ‎2011 Nov 14 10:42 AM
Hi,
I have created workflow for Project. I would like to add a user as a approver by using the following code.
user = IapiAccountLocator.lookup(session,"noppong_test");
addApprover(user.getAccountObjectReference(), new CollaboratorApprovalRuleType(0));When the document is moved to the phase the document is locked by workflow engine, but there is nothing happen. i also found the error in the log.
P.S. If you have an example to add the user as the approver. I'm appreciated if you provide me .
Daemon-027: EVENT_WORKFLOW_ENGINE (-2147483548, 0) event_workflow_engine daemon com.frictionless.api.common.exception.ApplicationException: This field is required and must have a value. AssociatedAttribute=WORK_ITEMS - SourceBo=-2144361477:1907:Contract Approval - ValidatingParent=-2144361477:1907:Contract Approval - com.frictionless.api.common.exception.ApplicationException: At least one of the items above is invalid. Mouse over the highlighted area for more details.| at com.frictionless.api.common.exception.ChainedExceptionFactory.createApplicationException(ChainedExceptionFactory.java:90)Thank you so much,
noppong
Request clarification before answering.
Hi,
Looks like you ran into some workflow engine error.. Look for any errors in the logs or in background task status. Check if you use the right version of the workflow editor.
Refer to my response in the threads. This may provide you additional pointers to debug this issue
http://forums.sdn.sap.com/thread.jspa?threadID=2028928
http://forums.sdn.sap.com/thread.jspa?threadID=2049322
Good luck
Baski
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Baski,
Thank you so much for your response. It is so useful for me.
The issue has been resolved by uising the XPDL template from SAP. I have some question about changing the phase. I have 3 phases as the following :
1. Draft
2. Approval -> Workflow is here . Prev phase is Draft and Next Phase is Approved.
3. Approved
I added script to change phase in post script on the block activity as following
import com.sap.odp.api.common.*;
if(getApprovalStatus() != DENIED) {
doc.getIBeanHomeIfc().upgradeToEdit(doc);
doc.getIBeanHomeIfc().changePhase(doc,"Approved");
}else{
doc.getIBeanHomeIfc().upgradeToEdit(doc);
doc.getIBeanHomeIfc().changePhase(doc,"Draft");
}When the approver approve the document i found the error in backgroud task status as following:
-
Stack Trace: Sourced file: inline evaluation of: ``import com.sap.odp.api.common.*; if(getApprovalStatus() != DENIED) { doc.get . . . '' : target exception : at Line: 5 : in file: inline evaluation of: ``import com.sap.odp.api.common.*; if(getApprovalStatus() != DENIED) { doc.get . . . '' : .changePhase ( doc , "Approved" )
Target exception: com.frictionless.api.common.exception.ApplicationException: You may not transition to the target phase Approved. It is neither a valid next nor previous phase.
at bsh.BSHPrimarySuffix.doSuffix(Unknown Source)
at bsh.BSHPrimaryExpression.eval(Unknown Source)
at bsh.BSHPrimaryExpression.eval(Unknown Source)
at bsh.BSHBlock.evalBlock(Unknown Source)
at bsh.BSHBlock.eval(Unknown Source)
at bsh.BSHBlock.eval(Unknown Source)
at bsh.BSHIfStatement.eval(Unknown Source)
at bsh.Interpreter.eval(Unknown Source)
at bsh.Interpreter.eval(Unknown Source)
at bsh.Interpreter.eval(Unknown Source)
at com.frictionless.comp.scripting.ScriptEnviro...-
It seem like the document is automatically changed the phase to 'Approved' and make the script error, and the document is locked on the Approved phase. I would like to ask you some more questions.
1. Why does the workflow change the phase automatically? On my understanding the phase should be handled in PostScript by the script
2. On my understanding the workflow engine will lock the document during the workflow. Why this workflow did not release the lock when the document was changed the phase to 'Approved'.
Thank you and appreciate your help
Noppong
Hi,
Please find the response inline:
1. Why does the workflow change the phase automatically? On my understanding the phase should be handled in PostScript by the script
[ Baski: I don't think the phase transition has happened automatically. We heard in some instances postScript of the workflow is called more than once and that could be the cause of this issue. one recomenedation here is to make the script execution idempotent. e.g. check if the current phase is not "executed" before doing the transition to executed. (if (current_phase != Executed){ doc.changePhase("Executed")}
]
2. On my understanding the workflow engine will lock the document during the workflow. Why this workflow did not release the lock when the document was changed the phase to 'Approved'.
[Baski: as the postScript execution resulted in an error, the workflow engine still holds the lock I guess]
Please check
Good luck!
Baski
Hi,
Thanks after using the template, still i am getting the error.
I have cleared the events error, log etc, but still getting the same error. Not sure if this is something to do with the workflow engine itself. Any inputs on this is greatly appreciated.
BTW.. the event is trigered successfully.
Thanks.
RR
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.