Implementing a Record Splitting Process in CAMUNDA 8

Hello,
I am working on a process where an input record related to event funding needs to be split into two separate records based on certain criteria.
Example Input:
{
“Event”: “Food Festival”,
“EventFunder”: “Division1”,
“Amount”: 100
}
for an event titled “Food Festival,” the total funding amount needs to be divided between two sources: the original funder (“Division1”) and a “Fund Raising”. The split is defined as 40% of the total amount going to “Fund Raising” and the remaining 60% staying with the original funder.

  1. Calculate the amount to be shifted to fundraising.
    fundRaisingAmount = amount * 40% = 40
  2. The remaining amount
    remaining = amount-fundRaisingAmount = 60.
  3. Create a new row with funding field as fundRaising and amount.
    First row: funding = orginal(division1), amount = remaining(60).
    second row: funding = fundRaising, amount = fundraisingAmount(40).
    Output:
    // Row 1
    {
    “Event”: “Food Festival”,
    “EventFunder”: “Division1”,
    “Amount”: 60 // 60% of original amount
    }

// Row 2
{
“Event”: “Food Festival”,
“EventFunder”: “Fund_Raising”,
“Amount”: 40 // 40% of original amount
}
The challenge I’m facing is implementing this splitting mechanism within a BPMN flow in CAMUNDA 8. I’m not sure how to:

  1. Dynamically split a single record into multiple records based on event type and predefined percentage splits.


RowSplit.bpmn (5.3 KB)

After initial record is divided into two separate records by service task, specific business rules need to be applied exclusively to the second record, and then a set of additional rules should be applied to both records.
Could you provide suggestions or examples on how to design such a process flow in CAMUNDA 8?

Hi @Nani_2000 - are you manipulating the data as an input to a DMN table? Or are you trying to add these as rules to an existing DMN?

Before applying the rules, the single input record needs to be split into two records, as illustrated in the example. The output I previously mentioned is generated after the execution of the ‘Splitting Data’ service task. This service task, which will be implemented in the application code, will send back the two records into the process. Subsequently, the ‘Rule for Row 2’ business rule task should be applied to one of the rows resulting from the split. Finally, the ‘Rules’ business rule task should apply rules to both of the records.

I agree that the process flow after the ‘Splitting Data’ service task is incorrect. However, I intended to provide a brief overview of the issue.

Hi @Nani_2000 - I think I’m still a little confused. Is the service task splitting the data into the correct records? Or are you asking if it’s possible to split the records without a service task? Or are you asking how you take the two records from the service task and feed them in as separate inputs to the different business rule tasks?

Hi @nathan.loding - Thanks for getting back to me. I’m trying to figure out if I can split one record into two different records in CAMUNDA without a ‘service task’. I thought I needed to use it because I’m not sure if there’s another way. If there is another way to do it, could you tell me how?

Let’s say I manage to get two separate records, either by using a service task or something else in CAMUNDA, my next question is processing of these records. Specifically, I need to direct the second record to a dedicated business rule task. Upon completion of this task for the second record, I intend to process both records together in another business rule task.

So, my questions are:

  1. Can I split a record into two without using a service task in CAMUNDA? If yes, how?
  2. Once I have the two records, how can I make sure the second one goes through its own set of rules and then have both records go through another set of rules together?"

@Nani_2000 - Camunda uses the FEEL expression language to handle that sort of data manipulation. It is somewhat limited in what it can do (by design) but is still very powerful. There is a fantastic FEEL playground maintained by one of our engineers that is very helpful for both learning FEEL and trying things out.

Here is a link to the playground with an example of splitting a single record similar to how you described it in your first post (when you click the link, it should automatically load the example I wrote).

There are a few ways to design the process in BPMN so that you execute the right rules against the right data. Someone else may have a more elegant pattern, but this is what I quickly drew up. Note the use of variable mappings to control what data goes where.
Record Splitting.bpmn (7.3 KB)

Thank you @nathan.loding for helping me out. I really appreciate it. I’m going to try out what you suggested. If I have any more questions, I’ll reach out again.