on 06-11-2011 10:53 AM
Hi All,
I am trying to create workflow for Projects. I have created a single step xpdl file with following xpdl file. I have set my self as Process owner in setup. When I add my self as approver, I am not getting any email to approve my project.
Worflow is getting trigger which I can see in workflow definition reports. When I cancel my workflow I am getting notification that my workflow is cancelled. Do you what is missing? Why I am not getting workflow approval emails? Is there a way by which I can approve my document by some report or see workitems assigned to me? System locks the document for me eventhough I am approver of the document...
import com.frictionless.api.common.exceptions.*;
import com.frictionless.api.common.log.Logger;
import com.frictionless.api.common.platform.*;
import com.frictionless.api.common.types.*;
import com.frictionless.api.doc.collaboration.*;
import com.frictionless.api.doccommon.masterdata.*;
import com.frictionless.api.ibean;
import com.frictionless.api.util.*;
import com.frictionless.api.workflow.*;
import com.frictionless.api.projects.*;
import com.frictionless.api.common.log.*;
import com.frictionless.api.usermgmt.masterdata.*;
import com.frictionless.api.doc.collaboration.*;
// Step 1: Add level 1 approver from Project Type
// Create a logger for messaging
logMsg = Logger.createLogMessage(session);
// doc is a ProjectIBeanIfc
typeHome = IBeanHomeLocator.lookup(session, doc.getDocTypeReference());
typeBean = typeHome.find(doc.getDocTypeReference());
// Level 1 Approver
principal = "nshelar";
if (hasValue(principal))
{
// Add the user account as the approver
addApprover(principal);
// log details
logMsg.setLogMessage("Added user: " + principal.getDisplayName() + " as approver");
Logger.info(logMsg);
}
Thanks,
Nitesh Shelar
Also, apart from all the required configurations you should check that the localised resource ID that you provide during workflow definition should be correct and present in the system. I am referring to the LocalizedDescription and LocalizedInstructions attributes' values in the Extended Attributes window that you find in the XPDL editor.
This might be preventing the system from generating approval emails.
Thanks
Devesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
As per suggestion, I am now passing Account object reference as shown below. Still its not working for me.
addApprover(session.getAccount().getAccountObjectReference());
Is this correct way? I just want to trigger email to my account.
I have also created LocalizedInstructions and LocalizedDescription, but still no luck.
Any other suggestion?
Thanks,
Nitesh
Hi Devesh,
I have commented it and tried it again. But its still not working!
import com.frictionless.api.common.exceptions.*;
import com.frictionless.api.common.log.Logger;
import com.frictionless.api.common.platform.*;
import com.frictionless.api.common.types.*;
import com.frictionless.api.doc.collaboration.*;
import com.frictionless.api.doccommon.masterdata.*;
import com.frictionless.api.ibean;
import com.frictionless.api.util.*;
import com.frictionless.api.workflow.*;
import com.frictionless.api.projects.*;
import com.frictionless.api.common.log.*;
import com.frictionless.api.usermgmt.masterdata.*;
import com.frictionless.api.doc.collaboration.*;
// Step 1: Add level 1 approver from Project Type
// These hold the name of the extension fields we are concerned
// with.
level1ApproverExtName = "Level1App";
// Create a logger for messaging
logMsg = Logger.createLogMessage(session);
// doc is a ProjectIBeanIfc
typeHome = IBeanHomeLocator.lookup(session, doc.getDocTypeReference());
typeBean = typeHome.find(doc.getDocTypeReference());
// Level 1 Approver
//principal = typeBean.getExtensionField(level1ApproverExtName).get();
principal = "nshelar";
//if (hasValue(principal))
//{
// Add the user account as the approver
addApprover(session.getAccount().getAccountObjectReference());
// log details
logMsg.setLogMessage("Added user: " + principal + " as approver");
Logger.info(logMsg);
//}
Hi Nitesh,
I am at a loss of ideas on this now. Your code appears to be fine (Some parts of it can still be removed but I don't see them affecting the functionality in any way).
My first guess would be that something wrong in the setup but I can't comment on it.
My advice would be to put in some more logging and see till where is your code executing. Also, follow some of the posts above and see whether, at least, a workitem is being generated. If your workflow is working perfectly then a workitem should be generated asking for your approval/rejection. You can see that through the 'My Workflow Activities' channel on the workbench.
Put some parts of your log here and then maybe I shall be in a position to say some thing more.
I would requests other members to assist you.
Thanks
Devesh
Hi Devesh,
Here is the log File. My code is getting executed.
2011-06-15 11:13:00.041 INFO local4
Daemon-027: EVENT_WORKFLOW_ENGINE (-2147483548, 0)
event_workflow_engine daemon
Added user: nshelar as approver
But then I can lot of error exception messages on work items. Let me know if that gived u any idea
Line: -
2011-06-15 11:13:00.495 ERROR
local4 WorkflowEngineDaemon processHook
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=-2147483274:1907:newpkg_wp1 - ValidatingParent=-2147483274:1907:newpkg_wp1 -
com.frictionless.api.common.exception.ApplicationException:
At least one of the items above is invalid. Mouse over the highlighted area for more details
Line: -
com.frictionless.api.common.exception.ChainedExceptionFactory.createApplicationException(ChainedExceptionFactory.java:90)
| at com.frictionless.common.db.PersistentBo.createApplicationException(PersistentBo.java:3160)| at
com.frictionless.doc.collection.GeneralCollnBo.createApplicationException(GeneralCollnBo.java:324)| at
com.frictionless.doc.collection.GeneralCollnBo.createApplicationException(GeneralCollnBo.java:336)| at
com.frictionless.doc.collection.AssocCollnBo.validateCollection(AssocCollnBo.java:998)| at
com.frictionless.doc.ContainerBo.execValidate(ContainerBo.java:3777)| at com.frictionless.doc.ContainerBo.validate
(ContainerBo.java:1255)| at com.frictionless.doc.ContainerDocBo.validate(ContainerDocBo.java:1232)| at
com.frictionless.doc.AbsDocBo.validate(AbsDocBo.java:3129)| at com.frictionless.doc.MasterDataBo.validate
(MasterDataBo.java:202)| at
com.frictionless.workflow.engine.handlers.PhaseChangeInstantiationRequestHandler.processApprovalActivity
(PhaseChangeInstantiationRequestHandler.java:978)| at
com.frictionless.workflow.engine.handlers.PhaseChangeInstantiationRequestHandler.processActivity
(PhaseChangeInstantiationRequestHandler.java:296)| at
com.frictionless.workflow.engine.handlers.PhaseChangeInstantiationRequestHandler.processHook
(PhaseChangeInstantiationRequestHandler.java:245)| at
com.frictionless.workflow.engine.handlers.WorkflowEngineRequestHandler.process(WorkflowEngineRequestHandler.java:197)
| at com.frictionless.workflow.engine.WorkflowEngine.process(WorkflowEngine.java:403)| at
com.frictionless.workflow.engine.WorkflowEngine.processPhaseChangeInstantiationRequest(WorkflowEngine.java:134)| at
com.frictionless.workflow.engine.WorkflowEngineDaemon.processPhaseChangeInstantiationRequest
(WorkflowEngineDaemon.java:328)| at com.frictionless.workflow.engine.WorkflowEngineDaemon.processHook
(WorkflowEngineDaemon.java:148)| at com.frictionless.comp.daemon.AbsEventDaemon.process(AbsEventDaemon.java:151)|
at com.frictionless.comp.daemon.ResponsibleEventDaemon.runHook(ResponsibleEventDaemon.java:143)| at
com.frictionless.comp.daemon.ResponsibleDaemonBase.run(ResponsibleDaemonBase.java:301)| at java.lang.Thread.run
(Thread.java:534)|AssociatedAttribute=DISPLAY_NAME - SourceBo=-2147483548:1901:null - ValidatingParent=-
2147483274:1907:newpkg_wp1 -
com.frictionless.api.common.exception.ApplicationException: This field is required and must
have a value.| at com.frictionless.api.common.exception.ChainedExceptionFactory.createApplicationException
(ChainedExceptionFactory.java:90)| at com.frictionless.common.db.PersistentBo.createApplicationException
(PersistentBo.java:3160)| at com.frictionless.common.db.PersistentBo.validate(PersistentBo.java:1497)| at
Was unable to post complete log in single message.
Line: -
com.frictionless.doc.ContainerBo.validate(ContainerBo.java:1248)|
at com.frictionless.doc.ContainerDocBo.validate
(ContainerDocBo.java:1232)| at com.frictionless.doc.AbsDocBo.validate(AbsDocBo.java:3129)| at
com.frictionless.doc.MasterDataBo.validate(MasterDataBo.java:202)| at
com.frictionless.doc.collection.AssocCollnBo.validateCollection(AssocCollnBo.java:968)| at
com.frictionless.doc.ContainerBo.execValidate(ContainerBo.java:3777)|
at com.frictionless.doc.ContainerBo.validate
(ContainerBo.java:1255)|
at com.frictionless.doc.ContainerDocBo.validate(ContainerDocBo.java:1232)| at
com.frictionless.doc.AbsDocBo.validate(AbsDocBo.java:3129)|
at com.frictionless.doc.MasterDataBo.validate
(MasterDataBo.java:202)| at
com.frictionless.workflow.engine.handlers.PhaseChangeInstantiationRequestHandler.processApprovalActivity
(PhaseChangeInstantiationRequestHandler.java:978)| at
com.frictionless.workflow.engine.handlers.PhaseChangeInstantiationRequestHandler.processActivity
(PhaseChangeInstantiationRequestHandler.java:296)| at
com.frictionless.workflow.engine.handlers.PhaseChangeInstantiationRequestHandler.processHook
(PhaseChangeInstantiationRequestHandler.java:245)| at
com.frictionless.workflow.engine.handlers.WorkflowEngineRequestHandler.process(WorkflowEngineRequestHandler.java:197)
| at com.frictionless.workflow.engine.WorkflowEngine.process(WorkflowEngine.java:403)| at
com.frictionless.workflow.engine.WorkflowEngine.processPhaseChangeInstantiationRequest(WorkflowEngine.java:134)| at
com.frictionless.workflow.engine.WorkflowEngineDaemon.processPhaseChangeInstantiationRequest
(WorkflowEngineDaemon.java:328)| at com.frictionless.workflow.engine.WorkflowEngineDaemon.processHook
(WorkflowEngineDaemon.java:148)| at com.frictionless.comp.daemon.AbsEventDaemon.process(AbsEventDaemon.java:151)|
at com.frictionless.comp.daemon.ResponsibleEventDaemon.runHook(ResponsibleEventDaemon.java:143)| at
com.frictionless.comp.daemon.ResponsibleDaemonBase.run(ResponsibleDaemonBase.java:301)| at java.lang.Thread.run
(Thread.java:534) Unexpected error handling event
Hi Nitesh,
What I can infer from the logs above is that the PreScript for your workflow is working fine. There is probably some problem with the PostScript. Ideally, you can find it under the Extended Attributes of the 'End Of Approval' activity. But if you approval activity has a PostScript as well then you will have to look into it too.
The log says that you are trying to save a document and missing a Required field.
This will require a little more analysis. If you are not able to figure out the problem then post your code here on the forum. We will try to help.
Thanks
Devesh
Hi Devesh,
I thought Post script will get excuted when user take action on work item. Here is my post script.
I am trying to change phase of my project to draft version and setting it to be editable again if rejected. If approved then setting phase as approved.
import com.frictionless.api.common.exceptions.*;
import com.frictionless.api.common.log.Logger;
import com.frictionless.api.common.platform.*;
import com.frictionless.api.common.types.*;
import com.frictionless.api.doc.collaboration.*;
import com.frictionless.api.doccommon.masterdata.*;
import com.frictionless.api.ibean;
import com.frictionless.api.util.*;
import com.frictionless.api.workflow.*;
import com.frictionless.api.projects.*;
import com.frictionless.api.common.log.*;
import com.frictionless.api.usermgmt.masterdata.*;
import com.frictionless.api.doc.collaboration.*;
// The final step of the approval process moves
// the phase of the Project to Approved
// (if all approvals were made) or back to xxx
// (if there was a denial).
// Create a logger for messaging
logMsg = Logger.createLogMessage(session);
// If not approved, then change the phse backward
if (getApprovalStatus() != APPROVED)
{
home = doc.getIBeanHomeIfc();
home.upgradeToEdit(doc);
try
{
home.changePhase(doc, "Draft");
}
catch(e)
{
logMsg.setLogMessage(e.toString());
logMsg.setException(e);
Logger.error(logMsg);
}
}
// If approved, change the phase forward
if (getApprovalStatus() == APPROVED)
{
home = doc.getIBeanHomeIfc();
home.upgradeToEdit(doc);
try
{
home.changePhase(doc, "Approved");
}
catch(e)
{
logMsg.setLogMessage(e.toString());
logMsg.setException(e);
Logger.error(logMsg);
}
}
// log details
logMsg.setLogMessage("Completed Workflow");
Logger.info(logMsg);
Hi,
I am still getting following error, any ideas?
test
2011-07-05 04:54:14.543 ERROR local4 WorkflowEngineDaemon processHook 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=-2147482884:1907:newpkg_wp1 - ValidatingParent=-2147482884:1907:newpkg_wp1 - 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)|
at com.frictionless.common.db.PersistentBo.createApplicationException(PersistentBo.java:3160)|
at com.frictionless.doc.collection.GeneralCollnBo.createApplicationException(GeneralCollnBo.java:324)|
at com.frictionless.doc.collection.GeneralCollnBo.createApplicationException(GeneralCollnBo.java:336)|
at com.frictionless.doc.collection.AssocCollnBo.validateCollection(AssocCollnBo.java:998)|
at com.frictionless.doc.ContainerBo.execValidate(ContainerBo.java:3777)|
at com.frictionless.doc.ContainerBo.validate(ContainerBo.java:1255)|
at com.frictionless.doc.ContainerDocBo.validate(ContainerDocBo.java:1232)|
at com.frictionless.doc.AbsDocBo.validate(AbsDocBo.java:3129)|
at com.frictionless.doc.MasterDataBo.validate(MasterDataBo.java:202)|
at com.frictionless.workflow.engine.handlers.PhaseChangeInstantiationRequestHandler.processApprovalActivity
(PhaseChangeInstantiationRequestHandler.java:978)|
regards,
Nitesh
Hi Nitesh
In order to check workflow approval message, you can go to set up-> configurations-> mail configurations
Open the mail config (system default or custom whichever you are using for your context ) and look for mail type "Workflow Approval Request Message". Check Buy Side and Sell Side action for the same.
In order to check the status of mail message you can look in setup -> System Admin-> Admin Reports-> Queued Message/ Processed Message. See what is the status of this message after you trigger the work flow
Regards
Mudit Saini
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nitesh,
In addition to Mudit's reply, you can also add the 'My Workflow Activities' channel on to your workbench. It gives you a link to the 'My Current Approvals' report that show a list of all the documents that are waiting for your apporvak and you can approve/reject your documents straight from this link.
Thanks
Devesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.