cancel
Showing results for 
Search instead for 
Did you mean: 

Get Filename of a Document from the Workflow Package

testuser
Champ in-the-making
Champ in-the-making
Hi!

I try to get the filename of a Document from the Workflow Package with the following code. But the workflow doesnt start and the error message i get is "failed to start Workflow. Returning 500 status code". I think its not a small problem, do you have any Ideas?

Thanks for your help!



ActivitiScriptNode scriptNode = (ActivitiScriptNode)executionEntity.getVariable(WorkflowNotificationUtils.PROP_PACKAGE);
NodeRef packageNode = scriptNode.getNodeRef();
NodeRef nodeRef = getServiceRegistry().getNodeService().getChildAssocs(packageNode).get(0).getChildRef();

String fileName = (String) getServiceRegistry().getNodeService().getProperty(nodeRef, ContentModel.PROP_NAME);

2 REPLIES 2

mitpatoliya
Star Collaborator
Star Collaborator
Do you want to start workflow or want to get document name of workflow which is already under progress?
The code which you have posted is part of custom listener class of activity?

testuser
Champ in-the-making
Champ in-the-making
Thanks for your answer! I build the Workflow from the Advanced Workflow Tutorial and added the Code to the External Review Notification Class (the Workflow starts and the Mail is send to the user). I can't start the workflow and that seems to be the problem.

I also tried to get the Workflow Package with


WorkflowTask workflowTask = getServiceRegistry().getWorkflowService().getTaskById(task.getId());
NodeRef packageNode = workflowTask.getPath().getInstance().getWorkflowPackage();   


Here the Exception is: org.alfresco.service.cmr.workflow.WorkflowException: 03090035 Invalid Global Id

Do i have to create a package?