Showing posts with label remove background task. Show all posts
Showing posts with label remove background task. Show all posts

Friday, September 3, 2021

Liferay Remove Background Task

 

Remove specific publication process from Staging:


· Fetch backgroundtaskId from database from backgroundtask table specific to publication process.

            Select * from backgroundtask where status =1;

· Run groovy Script provided by Liferay Support team which will remove the background task entry( Stuck In progress) from database .

             import com.liferay.portal.background.task.service.BackgroundTaskLocalServiceUtil;

             BackgroundTaskLocalServiceUtil.deleteBackgroundTask(<backgroundTaskId>);


Groovy Script:

import java.util.List;

import com.liferay.portal.background.task.model.BackgroundTask;

import com.liferay.portal.background.task.service.BackgroundTaskLocalServiceUtil;


List<BackgroundTask> btasks=BackgroundTaskLocalServiceUtil.getBackgroundTasks(328022L,1);

for(BackgroundTask btask : btasks){

if(btask != null) {

out.println(btask.getBackgroundTaskId());

out.println(btask.getName());

//BackgroundTaskLocalServiceUtil.deleteBackgroundTask(btask.getBackgroundTaskId());

}

}