01-09-2020 02:00 AM
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
01-09-2020 09:16 AM
Can you clarify? You want to bulk import information to initiate the process?
01-10-2020 07:27 AM
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
01-10-2020 01:01 PM
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.
01-14-2020 05:04 AM
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
01-14-2020 08:58 AM
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.
01-15-2020 08:36 AM
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 */
}
Explore our Alfresco products with the links below. Use labels to filter content by product module.