// This module is included in the following assemblies:
// as_connecting-to-fhir.adoc

[id='adding-fhir-connection-transaction_{context}']
= Creating resources of different types on a FHIR server

In an integration, you can create two or more resources on a 
FHIR server and each resource can be of a different type. 
For example, you can add a new patient resource and a new provider
resource in one connection to a FHIR server. To do this, 
add a FHIR connection to the middle of a flow, or as a 
simple integration's finish connection. 

.Prerequisites
* You created a connection to the FHIR server that you want to
add resources to. 
* You are creating or editing a flow and {prodname} is prompting you
to add to the integration. Or, {prodname} is prompting you to choose a 
finish connection. 

.Procedure
. On the *Add to Integration* page, click the plus sign where you 
want to add the connection. Skip this step if {prodname} is
prompting you to choose the finish connection. 
. Click the FHIR connection that you want to use
to create and add new resources to a FHIR server. 
. On the *Choose an action* page, select *Transaction*. 
. In the *Included Resource Types* field, select the  
resource types that this connection creates. 
Use the *Ctrl* key to select multiple resource types. 
The connection creates one resource of each type that you select. 

. Click *Next* to add this connection to the flow. 
. To populate fields in the new resources, add 
a data mapper step before this connection: 

.. In the flow visualization, click the plus sign 
that is before the connection that you just added. 
.. Click *Data Mapper*. 
.. In the data mapper, map source fields to the target 
resource fields. The new resources contain only the 
target fields that you map to.
.. Click *Next* to add the data mapper step to the flow. 
  
.Result
The connection appears in the integration visualization 
where you added it. During execution, the connection 
adds all resources to the FHIR server or, if there is an error, 
the connection does not add any resources to the FHIR server. A successful 
action returns a transaction resource, which contains the resource ID
for each new resource. You can map these resource IDs to subsequent
steps in the flow.  
