# Account Hierarchy in Salesforce and QuickBooks

## I**ntegrating objects from Salesforce to QuickBooks**

* If QuickBooks Customer and Salesforce Account object has hierarchy structures enabled, then the following changes have to be implemented within your DBSync mappings/template to facilitate hierarchy mappings.
* Let's say Avankia & DBSync are Parent & Child accounts, respectively, in Salesforce. Also, Avankia & DBSync are the Customer & Job in QuickBooks, respectively.
* The default mappings within the DBSync standard template integrate the above Salesforce Account records as two separate Customer records—" Avankia" and "DBSync"—as opposed to Parent and child records.
* Login to DBSync accounts with user credentials to make changes or create hierarchy mappings. Once the user has logged into their DBSync account, click on the *Development Studio to go to the* DBSync Project page and navigate to the flow page from the DBSync Task.
* Drag and drop a new flow action and enter the name **AccountToCustomer2** and Save.
* After Creating the flow '**AccountToCustomer2'**, move this next to the '**AccountToCustomer'** flow.
* Configure the '**AccountToCustomer2'** flow to add query and Transform\&write properties from the '**AccountToCustomer'** workflow.
* Once all the properties are filled, copy all the mappings from the '**AccountToCustomer'** mapping page.
* Once the mappings are completed, add the following changes in the "Mapping page".

```
Target == "CustomerAddRq/CustomerAdd/ParentRef/FullName"
```

```
Source Field == "VALUE("Parent/Name")"
```

* Now use the following query in '**AccountToCustomer2'** Trigger using Advanced Query Builder.

```
select {!.} from Account where AVSFQB__QuickBooks_Id__c = '' and Parent.Name!='' 
```

* Similarly, replace '**AccountToCustomer'** query with the query below:

```
 select {!.} from Account where AVSFQB__QuickBooks_Id__c = '' and Parent.Name ='' 
```

Once the user is done with all the above-mentioned changes, then "initiate the integration through web connector". Data will be integrated into QuickBooks with their respective hierarchies in place as shown below.

<figure><img src="https://1036205596-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fv9avy716UiAsS24zOznZ%2Fuploads%2FxNhIuYhDI04zdKO23w4Q%2Fimage.png?alt=media&#x26;token=f6b9a0c0-c713-4a23-a36d-9d4be8a724c8" alt=""><figcaption></figcaption></figure>

This concludes Account hierarchy mappings for the data-flow from Salesforce into QuickBooks.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mydbsync.com/cloud-workflow/tutorials/salesforce-and-quickbooks/account-hierarchy-in-salesforce-and-quickbooks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
