Download as pdf or txt
Download as pdf or txt
You are on page 1of 26

Data Raptor

❖ Data Raptor is a mapping tool that enables you to read,


transform, and write Salesforce data. Think of it this way: for
every digital customer interaction or business process, your
system needs to extract data to display it. When the user
changes that data or enters new data, it must be saved too.
That’s where Omni Studio Data Raptors come in.
❖ There are four different types of Data Raptors (and we cover
each in detail shortly), but in general, Data Raptors supply data
to Omni Scripts and Omni Studio Flex Cards from Salesforce,
and write updates from Omni Scripts and Flex Cards back to
Salesforce.
❖ Here’s an example of the data flow:-
● Get Data: An Omni Script calls a Data Raptor Extract (via
an Integration Procedure) to read data from Salesforce. For
example, an Edit Account Omni Script needs to display
data such as the account name, phone number, and
website.
● Manipulate Data: The Omni Script captures changed and
new data based on user input. For example, an agent
changes the account phone number.
● Save Data: The Omni Script calls a Data Raptor Load
(via an Integration Procedure) to write data back to
Salesforce. For example, the updated account phone
number is saved back to the Account record.
❖ Although Apex classes can read, write, and transform data,
DataRaptors offer a few more perks. DataRaptors take less time
to create and are easier to maintain; that’s why we recommend
using DataRaptors as a best practice.

What it is What it Does

Data Raptor Turbo Extract Gets data from a single Salesforce object
(sObject)

Data Raptor Extract Gets data from one or more Salesforce sObjects

Data Raptor Load Saves data to one or more Salesforce sObjects


by:

● Updating Salesforce records


● Creating Salesforce records
● Migrating CSV data into Salesforce
records

Data Raptor Transform Manipulates any data that comes from inside or
outside Salesforce
Data Raptor Turbo Extract

❖ DataRaptor Turbo Extract retrieves and filters data from a single


Salesforce object type with support for fields from related
objects. You can filter the data and select the fields to return.
Unlike a standard DataRaptor Extract (which we describe next),
a DataRaptor Turbo Extract doesn’t support formulas or complex
output mappings.
❖ It has two advantages over a standard DataRaptor Extract.
● Simpler configuration
● Better performance at runtime

Example 1:-

❖ Extract Information of Contacts from AccountId

Step1:-
Step 2:-

Step 3:-
Step 4:-

Step 5:-
● Click on Preview give account id in edit as params
● Click on Execute to see the result
❖ We can also fetch data from related objects with the help of
Turbo Data Raptor
For Example:-
● Fetch Account related to an Opportunity

Step 1:-

Step 2:-

❖ Click on the preview tab give Opportunity Id as input and then


click on execute to see the result.
Data Raptor Extract

DataRaptor Extract, the second type of DataRaptor that pulls data


from Salesforce, reads Salesforce data and returns results in JSON,
XML, or custom formats via complex field mappings. You typically use
DataRaptor Extracts to provide OmniScripts and FlexCards with any
internal Salesforce data they need to display. They support formulas
and complex output mappings.

Use DataRaptor Extracts if you are:

● Extracting data from a single object: For example, to retrieve


account data such as Account Name and other details from the
Account object in Salesforce.
● Extracting data from three related objects: For example, create a
DataRaptor Extract for use by a case-handling OmniScript. The
agents who handle cases need to look up a case using the case
number, and need to be able to view the name of the account, the
description of the case, and all the contacts for the account.
● Paging through sorted data using data values or offset values: If
you expect a DataRaptor Extract to retrieve a lot of records, use
paging to retrieve a few at a time based on field values or offset
values. For example, page through a long list of accounts by
Account Id or contacts by last name.
Example1:-

Extract Account data:-

Step1:-
Step 2:-

Step 3:-

❖ Click on preview tab then click on edit as params nd give


accountId
❖ Click on Execute to see the result.
Data Raptor Load

DataRaptor Loads write data to Salesforce objects from JSON or XML


input. A DataRaptor Load updates records with changed data and also
creates new records at the same time.
● To modify the input data, you define formulas, transform values,
and change the output data type.
● To specify how the resulting data is written to Salesforce objects,
you map fields from the output JSON to fields in Salesforce
objects.
The DataRaptor Load applies its mappings and formulas to the input
data to create the output data, then loads the output data into
Salesforce objects according to the mappings.
Use DataRaptor Loads if you are:
● Creating a contact and using a formula: A DataRaptor Load
creates a new Contact record. A formula checks whether the
contact is over 18 years old; if so, a custom Authorized field is
set to true.
● Creating a contact for an existing account: A DataRaptor Load
creates a new Contact record. A link to an Account record with a
specific Id ensures that the new Contact is related to that
account.
DataRaptors can access external objects and custom metadata as
well as Salesforce objects. No special syntax or additional
configuration is required to do this.
Example 1:-

❖Load Contact Data Related to an Account


Step 2:-

Step 3:-
❖ Make AccountId as an upsert key.

Step 4:-
Step 5:-

Step 6:-

❖ Click on execute to see the Result


Data Raptor Transform

❖ DataRaptor Transforms do the following.


● Convert JSON input to XML output, and vice versa.
● Restructure input data and rename fields.
● Substitute values in fields (all DataRaptors can substitute
values).
❖ Use DataRaptor Transforms for the following situations.
● When an OmniScript must populate a DocuSign template.
● When an OmniScript must fill fields in a PDF document.

In the following example, an insurance company implemented


DataRaptor Transform so that its labels make more sense to the user.
Policy information is stored in the Salesforce Asset sObject, but
DataRaptor Transform changes the label the user sees from “Asset” to
“Policy.” It also changes “vlocity_ins__AnnualPremium__c” to “Annual
Premium.” And it changes two labels for Contacts from “Contact” to
“Policy Holder,” and from “Contact” to “Policy Beneficiary.”
Example 1:-

XML to JSON
Step 1:-
Step 2:-

Step 3:-
Step 4:-

JSON to XML
Step 1:-
Step 2:-

Step 3:-
❖ Click on preview give input and then click on execute to see the
result:-
Tabs in Data Raptor
❖ When you’re ready to configure DataRaptors, you use the
OmniStudio DataRaptor Designer. You can access it via the
OmniStudio DataRaptors tab in the OmniStudio app. The
designer has tabs too. Use the following designer tabs to specify
what you want the DataRaptor to do.

● Extract Tab
● Formula Tab
● Output Tab
● Options Tab
● Preview Tab

Extract Tab:-
❖ On the Extract tab (1), you specify the Salesforce objects you
want the DataRaptor to query and the filters that determine the
data to be returned from the object.
Formula Tab
❖ On the Formulas tab (2), you define formulas. Three types of
DataRaptors (Extract, Transform, and Load) support formulas.
When you define a formula, you map its output to the output
JSON (for extracts and transforms) or Salesforce object field (for
loads).

Output Tab:-
❖ On the Output tab (3), you map data from the extract step JSON
to the output JSON.

Options Tab:-
❖ On the Options tab (4), you set advanced options such as
whether to check the user's access permissions for the fields
before executing the DataRaptor. Set the Platform Cache Type to
Session Cache for data related to users and their login sessions,
or Org Cache for all other types of data. The Time to Live in
Minutes setting determines how long the data remains in the
cache.

Preview Tab:-
❖ On the Preview tab (5), you test the output of the DataRaptor.
You provide input parameters as Key/Value pairs and then click
Execute. The result is displayed in the Response section.
Functions in Data Raptor

❖ When you need to change the data you are working with in more
complex ways than with mapping inputs and outputs, use
functions.
❖ A DataRaptor function is an equation you use for operations to
do the following.
● Manipulate data about date and time
● String text together
● Determine a result based on logic
● Perform mathematical operations on numbers using
fractions

Function Type Includes Example


Numerical +,-,*,/,^,ROUND Multiply the number of texts
sent by the rate per text to
get a total amount for a cell
phone bill.

Aggregate SUM, AVG, MAX, and MIN A customer signs up for a


flat-rate payment plan. The
payment is calculated based
on the average amount
spent over the past 12
months.

Logical OR, AND, IF If the customer is less than


18 years old, return a value
of “Minor”. Otherwise, return
a value of “Adult”. To make
this functionality work, the
function would be:
IF(AGE<18, “Minor”, “Adult”).

String CONCAT Display city and state


together, separated by a
comma.

Date and Time AGE, AGEON, DATEDIFF TODAY() returns today’s


date and NOW() returns the
current date and time.
Terminology:-
❖ Batch Size :-The default batch size in Data Loader is 200 or, if
you select "Enable Bulk API", the default batch size is 2,000. The
number of batches submitted for a data manipulation operation
(insert, update, delete, etc) depends on the number of records
and batch size selected. ... Each batch consumes one API call.
❖ JSON :- JSON (JavaScript Object Notation) is a lightweight
data-interchange format. It is easy for humans to read and write.
It is easy for machines to parse and generate. It is based on a
subset of the JavaScript Programming Language Standard
ECMA-262 3rd Edition - December 1999. JSON is a text format
that is completely language independent but uses conventions
that are familiar to programmers of the C-family of languages,
including C, C++, C#, Java, JavaScript, Perl, Python, and many
others. These properties make JSON an ideal data-interchange
language.

XML

XML is a software- and hardware-independent tool for storing


and transporting data.

What is XML?

● XML stands for eXtensible Markup Language


● XML is a markup language much like HTML
● XML was designed to store and transport data
● XML was designed to be self-descriptive
● XML is a W3C Recommendation
<note>

<to>Tove</to>

<from>Jani</from>

<heading>Reminder</heading>

<body>Don't forget me this weekend!</body>

</note>
Resources

❖ https://trailhead.salesforce.com/content/learn/modules/omnistudi
o-dataraptors
❖ https://www.w3schools.com/xml/xml_whatis.asp

You might also like