Close Mon Dec 10 17:03:05 GMT 2018

From CSV into Flow

Admins and Developers alike use Flow to codify business rules. These rules are a valuable asset not easily replicated in other environments.

If flows are like highways, we try to build more on-ramps before building more highways. Here's how to stream CSV rows directly into Flow.

Video example: CSV import to Flow Service

  • The  CSV file is captured in it's entirety
  • Faults caused by flow are stored for later review and retry
  • The import operation is decoupled from the actual processing
  • Imported events can be correlated after the fact using the Bulk API Job ID
flowservice-interviewflowservice-csv

Flow Service

public class FlowService extends Service
{
    public class Definition
    {
        String Tag = 'Services';
        String Icon = 'flow';
        String Label = 'Flow';
        Integer Chunks = 1;
        String Cardinality = 'One';
        String Description = 'Runs a flow as Automated Process user.';
        Map<String,String> StepConfig = new Map<String,String>{
            'flow' => 'String API Name of the flow'
        };
    }

    List<Map<String,Object>> execute(Map<String,Object> event)
    {
        String flowName = (String)event.get('flow');
        Flow.Interview.createInterview(flowName, event).start();
        return new List<Map<String,Object>>{event};
    }

    //...

}


Related