1. Home
  2. Docs
  3. Tutorials
  4. 39. How to import hierarchical data using xml and csv file?

39. How to import hierarchical data using xml and csv file?

Learning Objectives

After completing this unit, you’ll be able to:

  • Describe data import feature.
  • Comfortably use How to import hierarchical data with xml and csv format.


Skyvva Added this feature to import data,  to support xml file with element syntax, support json file, support csv file which contain hierarchical data . It is used with inbound interface which is a normal or ichained interface. In case of ichained interface we have hierarchical data.

What Is this feature?

This feature is built to import data(chained interface),  to support xml file with element syntax(The xml file contain flat or hiearchical data), support json file (The json file contain flat or hiearchical data), support csv file which contain hierarchical data (The format is described in task ).

With integrate3 we provide the possibility to use a custom class to code the entire business logic using the message payload. Integrate3 will pass all messages to the custom class and the customer class will post the message for example insert or update. The custom class can also do other specific logic based on the requirement. With custom class, we can build complex processing and even provide the transactional handling e.g. rollback to a save point. Note that when we use custom class it will do all the logic of the whole processing block e.g. workflow, mapping and operation like upsert. With custom class, we do the whole logic for all steps.

Here we need to create apex calss.

Apex class: A apex class is similar to java class. It is template or blueprint from which objects are created. In Apex, you can define top-level classes (also called outer classes) as well as inner classes, that is, a class defined within another class.

Why we use apex class here?

For some custom requirement, client needs to change some data from inbound interface or client needs to add some condition before inserting data apex formula is used. For example, if we have to calculate some field before sending data to outbound interface, but just more complex formula can be done through apex class.

It is used when any of the functions does not support the logic which needs to be in formula. e.g. one customer have  requirement where I used this. they had one field called timestamp provider.  They need check that if timestamp which is coming from outside salesforce to salesforce is older than current timestamp or not. In this case we cannot access existing data in salesforce through formula. here we need some custom formula which can be build apex formula.

How to create apex class?

To built apex class please follow the given steps:

Step1: We have to go to set up in our salesforce organisation. Click on set up option.

Step 2: Search apex class in quick search box and click on new button to create new apex class.

Step 3: New button should navigate to new page. Enter the following code there:


global class ABC_Test_Integration3 extends skyvvasolutions.AbstractHierarchyProcess {

public override  void doProcess(Map<Id,List<skyvvasolutions__IMessage__c>> intf2Messages,Map<Id,skyvvasolutions__IMessage__c> allMessage,Map<Id,List<skyvvasolutions__IChained_Interfaces__c>> treeInterface,Id pInterface){

system.debug(‘>>>>>>>>>>>>> ‘+intf2Messages);


} .

And click on save button to save the apex class.

Pre-requisite :

  1. We have to create apex class.
  2. We have to create hierarchical Message type:

3. We have to create Integration.

4. We have to create three interfaces.

  • Account (parent) Interface using hierarchical message type.
  • Contact Interface: child of account interface.
  • Asset Interface: child of contact interface.

Note : While create hierarchical Interface using hierarchical message type, message type name should be same as our object name.

In integration3, here we no need to do mapping manually.

How to process message type based Interface?

To process the message type based interface we have to follow the given steps:

Step1:  We have to configure Ichain interface

Configuration of Ichained Interface in account and contact object.

Configuration of Ichained Interface in contact and Asset objects.

Step2: Configure in 2 fields in the parent interface is Account

-Custom Processing = True
-Custom Processing Class = enter the name of a custom class e.g: (ABC_Test_Integration3)

Step3: Navigate to Integration => Manual Load => select parent interface (Account) => select Data Type = XML HIERARCHY => Choose hierarchical data xml and upload.

Here is example hierarchical data payload.

We can not select data to push. We have to push all the uploaded data.

Click on the Message Board button to view all messages after processed.

Was this article helpful to you? Yes No

How can we help?