Hi, I'm building a workflow that first prompts the initiator for assignee and stores it in the payload node. The next step is Dynamic Participant step, and we have a ParticipantChooser (implements both ParticipantStepChooser and ParameterizedParticipantService) class that retrieves the value from payload node, and assigns the workflow accordingly. In this ParticipantChooser, it first attempts to resolve the payload itself. Here is sanitized code, note the comments:
public String getParticipant(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap metaDataMap)
throws WorkflowException {
WorkflowData workflowData = workItem.getWorkflowData();
if (workflowData.getPayloadType().equals(PayloadMap.TYPE_JCR_PATH)) {
String path = workflowData.getPayload().toString();
ResourceResolver resourceResolver = workflowSession.adaptTo(ResourceResolver.class);
// path is correct
Resource resource = resourceResolver.getResource(path);
// resource is null
if (resource != null && resource.isResourceType(NameConstants.NT_PAGE)) {
// this block never executes
}
}
return workItem.getWorkflow().getInitiator();
}
I've played around and it pretty much cannot resolve any node on the site. Instead it does the fallback code and assigns to WF initiator. In my case I'm just using admin user.
Later in the chain I have a custom workflow process that performs the relevant action for the workflow. This uses the exact same strategy to resolve the payload resource, and it works just fine.
Another strange thing is that this step chooser has been around at my company before I was even hired, and I haven't changed it. And yet the WF Process I just wrote from scratch and it works correctly. I'm guessing this is some sort of configuration problem in my local instance but I have very few ideas about what that might be.
Any help is appreciated.