CX Works

CX Works brings the most relevant leading practices to you.
It is a single portal of curated, field-tested and SAP-verified expertise for SAP Customer Experience solutions

Side-by-side Extensibility with SAP Rapid Application Development Service by Mendix Part 3/3

16 min read

SAP Marketing Cloud - Side-by-side extensibility with SAP Rapid Application Development Service by Mendix

The SAP Marketing Cloud standard solution can be enhanced with in-app extensibility and external tools. In this article series we will focus on SAP Rapid Application Development service by Mendix for side-by-side extensibility to build applications for desktop and mobile. SAP Rapid Application Development service by Mendix can be leveraged in all CX solutions, as well as for S4 and other SAP products. In the first article we gave a short overview on SAP Rapid Application Development service by Mendix as well as the trade fair use case. The use case will be used as an implementation example of the trade fair application. In the second part you did learn more on how to get started with side-by-side extensibility of your solution. In this part we will provide examples how the business logic was implemented with microflows and pages in SAP Rapid Application Development service by Mendix. The app includes too many microflows to go into details for each, therefore some examples were picked to give you a better understanding of the implementation itself.

Table of Contents

Microflows

Microflows encapsulate your business logic of your app. They can perform actions, like executing an OData call to retrieve/send data, show pages or call other microflows.

You can model your microflows in a visual way. This reduces complexity so that knowledge about specific programming languages are not required.  

Authentication Microflow

To retrieve/send data between the application and SAP Marketing Cloud, both systems have to communicate with each other. In the Trade Fair scenario basic authentication is used for communication.

Please note, there are 2 different app user scenarios:

  • Employees of your company (business users/employees that actually work in SAP Marketing Cloud) accessing the app
    => implement Single-Sign-On for authentication
  • End users of your company (contacts/consumers, so golden records in SAP Marketing Cloud) that access the data via the app
    => implement authentication via technical interface user (basic authentication) and filter the data you provide in your business scenario 

Prerequisites

  1. Setup of a communication user in SAP Marketing Cloud with the "Maintain Communication users" app 
  2. Setup of a communication system in SAP Marketing Cloud with the "Communication System" app
  3. Setup of a communication arrangements in SAP Marketing Cloud with the "Communication Arrangements" app
API Communication Scenario
API_MKT_CONTACT_SRV SAP_COM_0207
API_MKT_INTERACTION_SRV SAP_COM_0206
API_MKT_EVENT_SRV SAP_COM_0371
API_MKT_PRODUCT_SRV SAP_COM_171

Setup constants for authentication in SAP Rapid Application Development service by Mendix

Create constants for user & password:

Constant Name Constant Value
ZUZ_usr e.g. SAPMENDIXUSR
ZUZ_pw password of the communication user

Setup authentication microflow "CreateAuthentication"

Create an authentication microflow, that can be re-used later in other microflows. Objects "Create request params" and "Add basic authentication" from the "SAP OData Connector" tab of SAP Rapid Application Development service by Mendix toolbox are used:

Retrieve Objects Microflow

Contact, product, event and interaction data has to be retrieved from SAP Marketing Cloud to the application. In this microflow several sub-microflows are called to request the data from the different OData APIs. 
After the trade fair visitor did the logon in the app on the booth, the actual data is replicated.

The data is just transferred once to the app. This approach simplifies the app and the communication between both systems.

The microflow "GetObjects" executes the following business logic:


Object Object Name Description
1 parameter TradeFairObject

The parameter "TradeFairObject" is provided from the previous microflow and encapsulates the booth visit for the user. The "TradeFairObject" will be enriched with the below mentioned entities via association.  

2 page Close page After the user did logon in the app (press search button), the microflow "GetObjects" is triggered. First action in the microflow is to close the "Search Dialog"
3 microflow GetTradeFairInvitation Based on the entered search parameters (registration code & email) in the "Search Dialog", the contact UUID is determined in SAP Marketing Cloud via interaction type email outbound
4 microflow GetContact The contact and permission data is retrieved for the previous identified contact UUID
5 page ShowContactOverview The page "ContactOverview" is called to provide the contact profile to the logged in user on the app UI
6 microflow GetSessions All event objects related to the trade fair are replicated to provide further information regarding the demo sessions
7 microflow GetProducts All product objects related to the demo sessions are replicated to provide additional information for the product presentations
8 microflow GetSessionRegistration If the contact did already register to a demo session via a previous visit on the booth or the landing page, then interactions of type session registration are already available. These interactions are transferred from SAP Marketing Cloud so that in the app we don't provide the opportunity to register again for the specific session.

In the following chapters the microflows for "GetContact" and "GetProducts" will be explained in more detail.

GetContact Microflow

After the contact UUID was determined correctly via the "GetTradeFairInvitation" microflow, the master data (like general, address or permission information) can be determined from SAP Marketing Cloud. 

The "GetContact" microflow retrieves the data and stores it in SAP Rapid Application Development service by Mendix domain model. 



Operator Object Name Description
1 parameter TradeFairObject

The parameter "TradeFairObject" is provided from the microflow "GetObjects" and encapsulates the booth visit for the user. The "TradeFairObject" will be enriched with contact information via association.  

2 microflow CreateAuthentification The authentication microflow was already introduced in the previous section of this chapter. The basic authentication is called before retrieving the data to establish the connection.
3 get list Get list The Get list operator of the "OData Connector" retrieves a list of objects from SAP Marketing Cloud to the application. In our microflow contact origin data and permissions are replicated as list. More details can be found in the subchapter 'Get list - 3' below.
4 list operation Head Operation Head is used to select the first entry of the list. Since we did query a unique record via the contact UUID, in the result list only one entry is available.
5 retrieve Retrieve list of Marketing Permission by $Contact/MarketingPermissions Marketing Permissions are queried with the $expand operation in addition to the contact origin data and stored in a list as well. The retrieve operator is used to read the data from the contact data model.

6 loop IteratorMarketingPermission From SAP Marketing Cloud implicit and explicit permissions are replicated. The data cannot be filtered in the query itself. Therefore the permissions have to be iterator-ed. Only explicit permissions for email, phone and mobile should be visible on the UI. The permissions are stored in own fields on the "main domain model" as boolean values. More details can be found in the subchapter 'IteratorMarketingPermission - 6' below.
7 change object Change Contact Last step of the microflow is the change of the "TradeFairObject" to assign the contact information via association.

Get list - 3

The following settings are maintained for the Get list operation. Request parameters handle the authentication in the OData call. 
OData service API_MKT_CONTACT_SRV with query on entity "ContactOriginData" and expand to sub-entity "MarketingPermissions" is executed, based on the InteractionContactUUID. 
A list with return type "ContactOriginData" is the result of the OData call.

Response type API_MKT_CONTACT_SRV.ContactOriginData
Destination empty
Query

@API_MKT_CONTACT_SRV.API_MKT_CONTACT_SRV + '/' + toString(API_MKT_CONTACT_SRV.EntitySetNames.ContactOriginData) + '?$expand=MarketingPermissions&$filter=ContactUUID%20eq%20guid''' + $TradeFairObject/MyFirstModule.TradeFairObject_TradeFairRegistration/API_MKT_INTERACTION_SRV.Interaction/InteractionContactUUID + '''&$top=1'

Request parameters $RequestParams
Parent empty
Result info empty
Return type List of API_MKT_CONTACT_SRV.ContactOriginData
List name Contacts

IteratorMarketingPermission - 6

During the iteration of the marketing permission, the following rules apply for the decision (e.g. for email):

If there is a explicit permission found for the communication medium, then the correspondent field on the "TradeFairObject" is updated:

GetProducts Microflow

This microflow retrieves all product information for the trade fair from SAP Marketing Cloud to the app.

Product description, URL to webshop, etc. can be used to personalize the "SessionOverview" page with product presentation attributes. 


Operator Object Name Description
1 parameter TradeFairObject

The parameter "TradeFairObject" is provided from the microflow "GetObjects" and encapsulates the booth visit for the user. The "TradeFairObject" will be enriched with product information via association of the demo sessions.

2 retrieve Retrieve list of MarketingEvents The demo sessions were already replicated from SAP Marketing Cloud with previous microflow "GetSessions". The demo sessions are associated with the "TradeFairObject". 
With the retrieve operator all demo sessions of the Trade Fair are provided in the microflow.
3 microflow CreateAuthentification The authentication microflow was already introduced in previous section of this chapter. The basic authentication is called before retrieving the data to establish the connection.
4 get list Get list The get list operator of the OData Connector retrieves a list of objects from SAP Marketing Cloud to the application. In our microflow products are replicated as list. More details can be found in the subschapter 'Get list - 4' below.
5 loop IteratorProduct Via the query operation "Get list", only relevant products for the Trade Fair scenario are replicated from SAP Marketing Cloud. Demo sessions and product presentation information shall be displayed together in the "SessionOverview" UI. Therefore to each demo session the correspondent product has to be determined and assigned via association.

Get list - 4

The following settings are maintained for the get list operation. Request parameters handle the authentication in the OData call. 
OData service API_MKT_PRODUCT_SRV with query on entity "Products" and expand to sub-entity "ProductNames" is executed, based on the trade fair object. 
A list with return type "Product" is the result of the OData call.

Response type API_MKT_PRODUCT_SRV.Product
Destination empty
Query

@API_MKT_PRODUCT_SRV.API_MKT_PRODUCT_SRV + '/' + toString(API_MKT_PRODUCT_SRV.EntitySetNames.Products) + '?$expand=ProductNames&$filter=YY1_TradeFair1_MPR%20eq%20''' + @MyFirstModule.TradeFair + '''&$top=20'

Request parameters $RequestParams
Parent empty
Result info empty
Return type List of API_MKT_PRODUCT_SRV.Product
List name Products

UpdateContactMicroflow 

The microflow updates the contact information in SAP Marketing Cloud. 


Operator Object Name Description
1 parameter TradeFairObject

The parameter "TradeFairObject" is provided from the microflow "GetObjects" and encapsulates the booth visit for the user. The "TradeFairObject" will provide the contact origin data  via association to update the contact profile.

2 microflow CreateAuthentification The authentication microflow was already introduced in previous section of this chapter. The basic authentication is called before retrieving the data to establish the connection.
3 update Update The Update operator of the "OData Connector" updates a specific entity in SAP Marketing Cloud. More details can be found in the subchapter 'Update - 3' below.
4 commit object Commit TradeFairObject The contact changes are also committed in "main domain model" to reflect the updated data there as well.

Update - 3

The following settings are maintained for the Update operation. Request parameters handle the authentication in the OData call. 
OData service API_MKT_CONTACT_SRV with OData object "ContactOriginData" is used to push the data that changed in the "ContactOverview" page in the app.

OData Object $TradeFairObject/MyFirstModule.TradeFairObject_Contact/API_MKT_CONTACT_SRV.ContactOriginData
Destination empty
Request parameters $RequestParams

Pages

Business users access the app via pages. The pages (UI) is used to display the information from SAP Marketing Cloud and enables the users to create and edit information. Also microflows can be triggered for further business logic processing.

ContactOverview Page

On the ContactOverview page the general communication with permission and address information of the logged in visitor are shown.

Most of the data can be edited directly in the app by the booth visitor. After changing the data in the app, the save button will trigger the "UpdateContact" microflow, as described in chapter 'UpdateContactMicroflow' before. 

The "UpdateContact" microflow will push the data to SAP Marketing Cloud to update the contact profile there.


The "ContactOverview" page is based on a Fiori themed form layout. Our "TradeFairObject" provides the data for the page. 

Different sections are created to structure the page, as you can see for the "General Data" below. The attributes on the page are determined via the association of the contact domain model to the "main domain model" ("TradeFairObject").

For example:  TradeFairObject_Contact/ContactOriginData/FirstName

SessionOverview Page

The demo session with product presentation information are shown in the "SessionOverview" page.

Section "General Data" is showing attributes of the demo session (event) and section "Demo Information" provides information of the product presentation. 

If a user is already registered for a demo session (interaction of type registration already exists in SAP Marketing Cloud), then the button "Create Registration" is not visible.

In the example below the logged in user can still register for demo session "Face Feature extraction service".

The "SessionOverview" page is based on a Fiori themed form layout. Our "TradeFairObject" provides the data for the page. 

Different sections are created to structure the page "SessionOverview" as well. The demo session (event) attributes are provided in section "General Data" and are determined via the association of the demo session.

The product attributes are shown in section "Demo Information" and are determined via the association of the product domain model to the "main domain model" ("TradeFairObject").

The button "Create Registration" triggers the microflow "CreateSessionRegistration" that creates an interaction of type demo registration with event and product reference in SAP Marketing Cloud. 

Conclusion

In this article series you learned how to get started with SAP Rapid Application Development service by Mendix. In the last part you learned how some of the microflows and pages of the trade fair scenario were implemented in the app. From authentication, retrieving and sending data to SAP Marketing Cloud, as well as showing the data in the app UI. All those topics were covered in this last part.

With the help of this article series you should now have a better understanding on how to structure and model microflows within SAP Rapid Application Development service by Mendix.

Overlay