For the complete documentation index, see llms.txt. This page is also available as Markdown.

Connect multiple data sources

Show visits and work orders on one Avonni Calendar by combining several record collections into one event collection with a flow action.

A dispatcher plans visits stored as Event records and repairs stored as WorkOrder records, and wants both on the same board. The Avonni Calendar reads one event collection, so the flow merges the two with the SObject Collection to Scheduler Events action, then hands the result to the calendar.

A Timeline week of three technicians where visits show in blue and work orders show in orange on the same rows
Visits and work orders on one calendar, each source in its own color.

Before you start

  • You have built the calendar of the Calendar 101, with a Variable data source and the technicians as resources.

  • You know how to create a resource and add an Action element in Flow Builder.

Steps

1

Get each set of records

Add one Get Records element per object, all storing All records:

  1. User: the technicians, as in the 101 tutorial.

  2. Event: the week's visits.

  3. Work Order: the week's work orders, filtered on StartDate.

2

Create the variable that will hold every event

  1. In the Toolbox, select New Resource.

  2. Set Resource Type to Variable and give it an API name, for example allTeamEvents.

  3. Set Data Type to Apex-Defined and select Allow multiple values (collection).

  4. In Apex Class, pick avcmpbuilder__SchedulerEvent.

3

Merge the collections with the flow action

  1. Add an Action element after the Get Records elements and search for SObject Collection to Scheduler Events.

  2. In the first Collection box, pick the Event collection. Under Data Mappings, set Title to Subject, Resource Name to Assigned To ID, From to Start Date Time and To to End Date Time.

  3. Click Add Collection and pick the Work Order collection. Set Title to Subject, Resource Name to Owner ID, From to Start Date and To to End Date.

  4. To give each kind its own color, open Advanced Options in each box and set Color, for example #0176d3 for visits and #fe9339 for work orders.

  5. Store the action's output in allTeamEvents. In Flow Builder, this is under the action's advanced options, Manually assign variables.

The SObject Collection to Scheduler Events action in Flow Builder with two collections, Get Visits and Get Work Orders, each with its own Data Mappings
One action, one Collection box per source, each with its own mappings.

The action takes up to ten collections. Resource Name must hold the same value as the resource Key Field (a User ID here), whatever the object.

4

Point the calendar at the combined collection

  1. Open the calendar in the Component Builder. In the Data Source section, select Variable.

  2. In Resources Collection, pick the User collection, and map Label as in the 101 tutorial.

  3. In Events Collection, pick allTeamEvents.

Data Mappings now lists only Resources: the title, resource, dates and color of each event were already set by the action.

5

Save and test

Save the flow and run it with Debug. Each technician's row shows both their visits and their work orders, each with its own title and times: visits in blue, work orders in orange. For colors that follow a field instead of the object, see Color-code calendar entries.

The action's inputs are listed on SObject Collection to Scheduler Events.

Last updated

Was this helpful?