Managing Contact Information with the Flow Designer

Last Updated: 07/15/2016 Introduced in Verision: 2.0

The Contact Info Entity is a folder entity which collects addresses, phone numbers, email addresses and other contact details into a single entity. These contact details can be updated and deleted in a flow by using the ID of the Contact Info Owner with the appropriate steps, such as those under the Phone Service or Email Address Service.

Example

In our example flow, we will use a form to display a Customer’s existing emails and define a new preferred email address for a customer, making sure to update every other email address to non-preferred status. This example assumes that the form Add Email Address Form has already been designed.

runningForm

 

We will first navigate to the actions folder of our Customer folder extension type at: System > Common Data Elements > Folder Behavior Actions > UserType.CustomerFolderBehavior. To create our action, we will click the Create Flow button.

createFlow

 

In the resulting New Flow pop-up, we will call our action “Add New Primary Email Address” and click OK to open it in the Flow Designer.

nameFlow

 

First, we will want to retrieve the ID of the Contact Info Owner (or Contact Info Entity). We will find the Get Contact Info Owner Id For Folder component in the Flow Designer start-up window, under the category Integrations > All Integrations > Internal Services > ContactInfoService.

 

 flowStarts

In the Mapping Editor, we map FolderId to folderId. We will also rename the output to “ContactInfoOwnerId”.

mappingForGetInfo

 

Next, we will retrieve all of the existing emails belonging to the Contact Info Owner. We will find the Get All Email For Owner component in the Toolbox tab, under the category Integration > Internal Services > EmailAddressService.

dragGetAllEmailForOwner

 

In the Mapping Editor, we will map ContactInfoOwnerId to ownerId, and rename its output to “All Emails”.

mappingForGetAllEmail

 

Next we will place the form in which the user will see the Customer’s existing emails, and define the new preferred email address. We will find the Add Email Address Form component in the Toolbox tab, under the category Forms [Interaction] > [Root Folder] > Designer Entities.

dragForm

 

In the Mapping Editor, we will map AllEmails.All Address to EmailAddresses. We will leave the other fields’ mapping types set to “Ignore”.

mappingToTheForm

 

Next, we will add the email address defined in our form. We will find the Add Email Address component in the Toolbox tab, under the category Integration > Internal Services > EmailAddressService.

dragAddEmail

 

In the Mapping Editor, we will map ContactInfoOwnerId to both ContactInfoID and ownerId. We will also map NewEmailAddress to Email Address and set Preferred Email Address to True.

mappingToAddEmail

 

Next, we will iterate through the Customer’s other emails and set their Preferred Email Address status to False. We will find the ForEach Step component in the Toolbox tab, under the category Flow Management.

dragForEachStep

 

Under the Collection section, we will use the Type selector to choose a collection type of EmailAddress.

pickCollectionTypeForEach

 

In the Mapping Editor, we will map All Emails to Collection, and rename the Item output to “ForEachEmail”.

mappingForEach

 

For each email address in our collection, we would like to update its Preferred Email Address status to be unchanged. We will find the Update Email Address component in the Toolbox tab, under the category Integration > Internal Services > EmailAddressService.

dragUpdateEmail

 

In the Mapping Editor, we will set Preferred Email Address to False, and map all other properties of the Email Address item directly to the inputs of the Update Email Address component. We will also map ContactInfoOwnerId to ownerId.

mappingToUpdate

 

Finally, we will connect our remaining unconnected outcomes.

flowCompleted

 

This completes our flow, so we will save it and close the Flow Designer.

saveFlow

 

For our new flow to be registered as an action, we must restart the Service Host Manager service.

19.-restart_service.png

Back in the portal, we will navigate to a Customer folder. We will see that this customer has two email addresses: “mary.watson@example.com” (Preferred) and “mary.anne.watson.73@gmail.com”.

contactHas2emails

 

To test our example flow, we will select the Customer folder and, in its Action menu, we will select Add New Primary Email Address.

addNewPrimaryEmailAction

 

In the resulting pop-up, we will see the Add Email Address Form, showing us this customer’s existing email addresses and a textbox for entering a new email address that will be designated as the preferred one. We will enter “mary.watson@excite.com” in the New Email Address field and click Save.

runningForm

 

Back in the Customer folder, we will see that our new email address has been added and designated as the preferred address, while the previous preferred address no longer has that status.

emailAdded

 

Additional Resources