North America
×

How would you like to connect to Sales?

Get a Call Send an Email Schedule a Meeting

Automate Your Workflow with Data Cloud-Triggered Flows and Invocable Actions

data cloud
Reading Time: 5 minutes

Salesforce Data Cloud is a robust platform that helps organizations unify customer data from multiple sources, building an actionable and comprehensive view of each customer. Triggered flows let businesses automate actions created on real-time data updates within Salesforce Data Cloud. This data integration lets you react to changes within data as they occur, guaranteeing business processes and workflows are synced with the most updated information. 

Invocable actions within Salesforce Flow are sustainable actions that can be triggered in a flow. Developers create pre-built or custom invocable actions with Apex, permitting more specific or complex functionality. These actions can simplify flow design and minimize the need for complicated logic. Additionally, invocable actions allow external integration of services and systems by offering actions that perform integration tasks and make API calls. 

This blog will discuss utilizing Data Cloud-triggered flows using invocable action to increase efficiency through Data Cloud automation. 

Essential Steps to Create an Automated Workflow within Data Cloud 

Let’s assume a situation where a customer applies for a credit card online. In Data Cloud, application data will include a data model object (DMO), initiating a Data Cloud-triggered flow. There will be an action to review the customer’s credit score and send that data back to Sales Cloud. 

data cloud

Step 1: Set Data Required 

It’s essential to decide the data of fields required to support your current use case before you indulge data within Data Cloud through the Ingestion API. The given object must uphold all the fields linked to a credit card. 

When you define fields required to support your use case, before utilizing the ingestion API, you should follow the Ingestion API Schema File criteria to create a file to get data into Data Cloud seamlessly. Look at the following sample YAML to assist the object defined before:

data cloud

This code will get the sample application for the above-mentioned use case. The YAML and object design are linked to the POST approach in this sample application.  

Step 2: Bring and Map Data 

Now, establish a data stream that brings credit card information into the Data Cloud. Then, chart the data lake object coming through the stream into a data model object.

data cloud

Step 3: Build an Invocable Action 

After that, build an Apex class for all data actions, go to Setup > Developer Console, and press File > New > Apex Class. Type in a name for the Apex class, e.g., “CreditCheck.” We have built an endpoint in the personalized code below that generates an HTTP request to a credit company that returns the required score. 

data cloud

Step 4: Build a Platform Event 

Now, build a platform event to assist the call for a credit check. This type of event is initiated every time someone requests a credit check. It has two specific fields: one that records the SNN, and the second captures a Lead ID; these are then used to update the current Lead record. In the event-triggered flow platform, both fields will be referenced. 

data cloud

Step 5: Generate a Platform Event-Triggered Flow 

In this step, generate a platform event-triggered flow that is initiated every time an event is created to get a credit check. Platform event-triggered flow will utilize the Apex class to obtain the credit score and update all Lead records with the required credit score retrieved from the Apex class. 

You need to do the following steps:

  • Configure the triggered flow whenever a credit card application platform event is obtained. 
  • Build a variable, e.g., vCreditScore, to save the credit score sent back through the Apex class. 
  • Attach the action built within Step 2 through the Apex class. 
  • Choose the SSN in the action being presented as the parameter. 
  • Define the result from the Apex action.
  • Update all Lead records via the Lead ID that initiated the flow, and then update the credit score using the value received from the invocable action. 

Here’s a complete flow looks like:

data cloud

Step 6: Build a Data Cloud-Triggered Flow 

Make a Data Cloud-triggered flow provoked when a row is included in the Credit Card Application DMO. Data Cloud-triggered flow will identify if consent is accessible. If case consent exists, a Lead record will be built, and a request will be made to get the credit score through the LeadID as a parameter. If, by any chance, consent isn’t there, then the flow will automatically exit.

You need to do the following steps:

  • Configure the flow when a record is included in the credit_card_application DMO.
  • Build a variable, e.g., vLeadid, to save the ID from the Lead record that’s recently created.
  • Make a decision split to identify whether a credit check request has been received. This decision is taken from a field from the credit_card_application DMO.
  • There can be two outcomes: if the decision is true, utilize an action to form a Lead record and conserve the Lead ID of the record recently created to the variable vLeadID. 
  • After creating the Credit Card Application event, give it to the SSN linked to the record within the DMO and the newly recorded Lead ID. 

Here’s what a completed event looks like:

data cloud

Next, activate these flows. As information is stored in the Data Cloud, the flow is activated, invoking credit appeals performed via an invocable action, enabling HTTP requests to a credit agency. Here, we discussed how to utilize the invocable action within a single flow, but it’s also possible to trigger and reuse it with numerous Data Cloud-triggered flows. 

Concluding Thoughts 

Data Cloud invocable actions and triggered flows provide robust tools to streamline and automate processes in the Salesforce Data Cloud. With the ability to trigger custom code by using invocable actions and real-time data integration, businesses can use a system created to handle high-frequency updates and huge volumes of data. Using an event-triggered architecture, it responds to data updates instead of depending on a schedule, making Data Cloud more responsive and efficient. 

PureLogics has 19+ in offering Salesforce development services. Our certified developers can help you build customized Salesforce solutions for your unique business needs. We offer solutions for everything from Salesforce implementation to data migration and seamless integrations. Partner with PureLogics for a flawless Salesforce experience! 

Get in touch,
send Us an inquiry