Bulk Deletion of Multiple Issues

Realize bulk deletion of multiple issues using deleting Process API.

Hi, there!

I usually receive various inquiries about the daily operation of Questetra BPM Suite from our users.
Among them, I have been asked about “how to delete specific multiple issues at once”.
Although you can delete them by pressing the “Delete” button in the process detail screen one by one, it could be exhausting depending on the number of processes.

Let’s start with “the reasons behind the request to ‘Want to delete specific multiple issues’ “,

1. To prevent issues used for testing to come up during searches
2. To eliminate past issues that haven’t been operated for a long time
3. To delete terminated issues in bulk

etc. Could be one of them.

As for 2 and 3, since such issues do not have a significant influence on the operation, and, at the same time, they are important for the record of performed issues, it is desirable to keep them as much as possible.

Anyway, I guess you have various reasons, but you should think carefully before deleting them.
(Once you delete them, it CANNOT be undone!!)

== Overview ==

We use the “Deleting Process API (/API/OR/ProcessInstance/delete)” for deleting issues.

<Deleting Process API> (/API/OR/ProcessInstance/delete)
POST parameters: processInstanceId *
Errors: InvalidProcessInstanceId (10014), ProcessInstanceDoesNotExist (20016)

Processes which a user can delete are limited to those the User started, no one else was involved, or has Process Administrator Authorization.

https://www.questetra.com/tour/reference/apis-workflow/#PIdelete

As shown in the API specification “POST parameters: processInstanceId”,

* The execution of Deleting API will be performed per each process ID

Thus we can perform a bulk deletion through the following process.

<Overview Figure>

== Details ==

There are various ways to undergo the process.
For example, the following methods

Method 1. Using an Excel macro, read a Process ID List row by row and execute the API
(alternatively, access and execute the Process Model that executes the API)
Method 2. Make a process ID list, and execute a Process Model that iterates the process

Method 1 will start a process that executes the API, which will result in generating the same number of unnecessary processes as the one it deletes. In the end, you’ll be back to square one.

Method 2 is a more practical way. (The number of unnecessary processes for deletion will be minimized.)

<Process Model Diagram>
deletion-process-model-diagram
The settings configured for the Process Model diagram are shown below.
<Starting Task: Enter Process ID list>
Start-task: enter-process-id-list
<Process Data Items>
process-data-item-list
<Deleting API Execution: Throwing Message Intermediate Event (http) : Network settings>
deletion API execution: Throwing Message Intermediate Event (http) : Network Settings
<Deleting API Execution: Throwing Message Intermediate Event (http) : Security / Custom header>
deletion API execution: Throwing Message Intermediate Event (http) : Security/Custom header
<Deleting API Execution: Throwing Message Intermediate Event (http) : Sending Parameter>
Deleting API Execution: Throwing Message Intermediate Event (http) : Sending Parameter

<Script Task : Acquire Process ID of the deletion target>

var text = data.get("0");  // Process ID group for deletion
var comp = data.get("5");  // Deleted Process ID group
if (comp == null){
	comp = "";
}
var id = text.slice(0,text.indexOf("\n",0)); // Process ID for deletion
text = text.slice(text.indexOf("\n",0)+1);   // Update the Process ID group for deletion
comp = comp + id + "\n";                     // Update the Deleted Process ID group
retVal.put('3',id);
retVal.put("0",text);
retVal.put("5",comp);

<Script Task : Completion determination set>

var count = data.get("7"); // the number of processed issues
count++;                   // Count up the number of processed issues
retVal.put("7",new java.math.BigDecimal(count))
var error = data.get("6"); // Get the content of API execution error
// Process API execution error set
if (error != "" && error != null){
	var errorList = data.get("9");  // Error history
	if (errorList == null){ errorList = "";}
	errorList += error + "\n";
	retVal.put("9",errorList);
	retVal.put("6","");
}
// if target Process ID list becomes empty, completion determination set
if (data.get("0") == null){
	retVal.put('2',"End");
}

You might be thinking “It’s more complex than I thought it would be”.

That’s right. That’s the downside!

<Process Execution Constraints>
In the case of single issue execution, the number of task icons that the processing goes through (all icons, including condition splits and automated processing tasks, not only human task) in the Process Model must be lower than 500.

In order to clear the above constraint, the process model has become a bit more complex.

<Process Model Diagram : Description>
process-model-diagram-description

By this implementation, even if more than 80 process IDs have been specified, the Process for deletion will be started automatically and be executed until all the Process IDs have been deleted.

(Including the initial one, if necessary, you can delete the issues of executed deletion process manually, or leave them as deletion history.)

== Things to Consider ==

How long does it take to process?

Deletion of 80 Process IDs → About 51 min (About 38 sec/ Process ID)
Approximately, the standard deletion process will take the time described above (using Free Edition).
For bulk processing, you may think it is time consuming.
However, since it does not require further operation or monitoring once you start its execution, the processing itself will not be a bother.

== After Thoughts ==

As for the structure of the Process Model, there may be a more simple method.

This model is for general use. If you want to use the model, contact us and we will send the process model file.

However, the most important point is to consider: “Is it truly okay to delete the model?”.
This fact is so important, I am bringing it up again:

Anyway, I guess you have various reasons, but you should think carefully before deleting them.
(Once you delete them, it CANNOT be undone!!)

To obtain a Process ID list, you can filter the issues to be deleted from the option “All Processes” and download them in CSV format. Then, load the CSV file in Excel and copy and paste the “Process ID”s as rows.
In such operations, you should “take a close look at the filtered list” and then process it.

Please keep this in mind when using this method for bulk deletion.
Please feel free to contact us should you have any concerns.

2016-06-21

About Masato Furukubo

Questetra, Inc. Sales Department
View all posts by Masato Furukubo

Recommendations
Prev article - 50. Questetra Tips Trouble-free! How to Perform an Options-XML Update?
Next article - 50. Questetra Tips Three HTML Tags That Will Help Your Work Move Right Ahead
Another article - Masato Furukubo Implement Customer Master using Options-XML (Part 2)

Archive

 RSS