cancel
Showing results for 
Search instead for 
Did you mean: 

Process Instance bulk Import

amruta_w
Star Collaborator
Star Collaborator

Hello All,

I have designed sample process with two task and form. I want to import bulk process instance for my sample process. 

Kindly anyone help me to achieve my scenario.

Thanks & Regards

Amruta Wandakar

6 REPLIES 6

jljwoznica
Star Collaborator
Star Collaborator

Can you clarify? You want to bulk import information to initiate the process?

Hi @jljwoznica ,

Thanks for reply.

I can start process-Instance through API call, But i have a CSV file with all the required field variables for creating a process-Instance , if i call API for each record it will be having performance issue, because data will be more, kindly suggest me with example or document if possible

Thanks & Regards

Amruta Wandakar

Are you using only APS or do you also have the content engine availalble. 
If you have content available, you can write a script that is run by a rule when the CSV file is added to the respository which parses the script by each line and launches the processes passing the variables.

I believe you could use the Script task call in APS to do if you do not have process.

Hi @jljwoznica 

Thanks for reply, I'm using APS and I have process designed. It's great if share any documentation or exmaple, that will help me lot.

Thanks & Regards

Amruta Wandakar

Ok - so no ability to take advantage of rules in Alfresco Content Services. 

I do not have an example, but this has been done using JSON and the Application Development Framework.

Does this sample script help at all? 

In this sample script where a “bfile” file variable was attached to a process. Using the RelatedContentService runtime, you can parse that csv attachment to perform any action (ie: kick off additional processes.)

import com.activiti.service.runtime.RelatedContentService;
import com.activiti.service.runtime.RelatedContentStreamProvider;
import com.activiti.domain.runtime.RelatedContent;
import java.io.InputStream;
import org.apache.commons.io.IOUtils;
import java.nio.charset.StandardCharsets;import java.util.logging.Level;
import java.util.logging.Logger;import java.util.*;
import java.text.*;String bName = "bfile"; List<RelatedContent> barcodescontentList = relatedContentService.getFieldContentForProcessInstance(execution.getProcessInstanceId(), bName, 1, 0).getContent();
RelatedContent barcodescontent = barcodescontentList.get(0);
InputStream bIs = relatedContentStreamProvider.getContentStream(barcodescontent);
String bContents = IOUtils.toString(bIs, StandardCharsets.UTF_8);bContents.eachLine {
/* Do some stuff for each line here */
}if (bContents.contains("search str")) {
/* Do some stuff for searching for content here */
}