Forums de discussion

How to remove or delete the Workflow for specific entity record?

Montej Shah, modifié il y a 7 années.

How to remove or delete the Workflow for specific entity record?

Junior Member Publications: 48 Date d'inscription: 18/02/15 Publications récentes
Hi
My scenario is as below.

I have one entity "Assessment" created with service builder. i have apply the workflow on each record of assessment when added.

WorkflowHandlerRegistryUtil.startWorkflowInstance(assessment.getCompanyId(),
assessment.getGroupId(), assessment.getUserId(), Assessment.class.getName(),
assessment.getAssessmentId(), assessment, serviceContext);


This will notify the specific user and user will show the assessment details.

Now I want to remove (delete) the workflow task for specific record , so user can't see it in workflow task list.
How can achive this ? any help will be appreciated.
Montej Shah, modifié il y a 7 années.

RE: How to remove or delete the Workflow for specific entity record?

Junior Member Publications: 48 Date d'inscription: 18/02/15 Publications récentes
I have got the answer to withdraw or delete the workflow task.
I have used deleteWorkflowInstanceLinks method of WorkflowInstanceLinkLocalServiceUtil class. It will remove the workflow task which display in pending or completd from both section of workflow task for given entity(assessment) specific record.

For example :
we have assessment entity. When any new record generated for assessment we are apply workflow on it (Note : to apply custom workflow this link will be helpful "http://www.liferaysavvy.com/2015/08/implement-kaleo-workflow-for-custom.html"). Show this task show in pending list of workflow task of administrator role.
Now because of some requirement we need to reomve the user who submmitted assessment data.So we also need to clean up the workflow task details for the assessment created by that user.
To delete, we need the primary key for the assesment record
So i have used below code to delete the workflow task for assessment who's primary key is "1122"


WorkflowInstanceLinkLocalServiceUtil.deleteWorkflowInstanceLinks(
deleteAssessment.getCompanyId(), deleteAssessment.getGroupId(), Assessment.class.getName(),
deleteAssessment.getAssessmentId());

Here deleteAssessment.getAssessmentId() =primary key=1122

Show now task assign to administrator for assessment(which P.K=1122) in pending list will be removed.

Hope this will help any one who want to withdraw or remove or delete the workflow task for specific entity record.