RUNMYBOT® Integration for HubSpot and SAP S/4HANA
1 Usage of this Document
This document serves as a reference for implementing a data synchronisation layer between HubSpot CRM and SAP S/4HANA ERP systems using the RUNMYBOT platform. It defines how each module is synchronised, how authentication is managed, and how data conflicts and errors are handled, while keeping the middleware layer completely transparent to end users.
2 Purpose
The purpose of this document is to provide a detailed solution design for building a middleware orchestration layer using our internal low-code platform, RUNMYBOT, between HubSpot CRM (primary commercial system) and SAP S/4HANA (ERP and financial system of record). This solution enables seamless, API-based synchronisation of customer master data, contact records, sales orders, product catalogues, invoices, and payments across both systems — without manual intervention and with full auditability through centralised logging.
3 Objective & Scope
The HubSpot–SAP S/4HANA integration enables secure, API-based orchestration of customers, contacts, sales orders, products, invoices, and payments across both platforms. The objectives of this integration are to:
- Ensure customer and contact master data remains consistent across HubSpot and SAP S/4HANA.
- Enable bi-directional synchronisation of Sales Orders so that deal lifecycle changes in either system are reflected in the other. (Only Deals in "Closed Won" stage are synced).
- Push Product master data, Sales Invoices, and Payment records from SAP S/4HANA into HubSpot to give sales teams full commercial visibility.
- Maintain transaction consistency across systems using cross-reference key fields and upsert logic.
- Provide full monitoring, logging, retry handling, and audit tracking within RUNMYBOT.
4 Prerequisites
| Component | Requirement |
|---|---|
| HubSpot Edition | Professional, Enterprise, Unlimited, or Developer Edition |
| HubSpot API Access | API access must be enabled on the connected user profile |
| HubSpot User | Dedicated integration user with System Administrator or custom profile |
| HubSpot Connection | Either install the RUNMYBOT HubSpot App (recommended) or configure a customer-owned HubSpot OAuth application by providing the Client ID and Client Secret in the RUNMYBOT Connection module. |
| S/4HANA Version | SAP S/4HANA Cloud Public Edition |
| S/4HANA API Access | OData V2 services enabled through the SAP Gateway (/sap/opu/odata) |
| S/4HANA User | Dedicated communication/API user with authorization to access required OData services (e.g., Business Partner, Customer, Material, Sales Order APIs) |
| Network | Outbound HTTPS (port 443) access to *.HubSpot.com and SAP S/4HANA endpoint |
| Custom Fields | Create necessary custom fields and custom objects for synchronization of payment & sales invoice in HubSpot |
5 Connection Setup & Configuration
Connection setups inside the RUNMYBOT Unified API require setting up credentials, base URLs, and authentication configurations.
5.1 Reference Field Creation
Create a custom field for each module in HubSpot to maintain a permanent cross-reference between the integrated systems.
| S/4HANA Object | Field Name | Field Label | Data Type |
|---|---|---|---|
| Contact | sap_contact_id | SAP Contact ID | Text |
| Account | sap_company_id | SAP Company ID | Text |
| Product | sap_product_id | SAP Product ID | Text |
| Deal | sap_reference_id | SAP Reference ID | Text |
| Sales Invoice | external_ref_id | External Ref ID | Text |
| Customer Payment | external_ref_id | External Ref ID | Text |
5.2 Custom Object Creation
Create Custom Objects for **Sales Invoice** and **Customer Payments** in HubSpot.
Sales Invoice Object Name: p246208318_sales_invoices
| Field Label | Field Name | Field Type |
|---|---|---|
| Invoice Amount | invoice_amount | Number |
| External Ref ID | external_ref_id | Single-line text |
| Note | note | Multi-line text |
| Status | status | Dropdown |
| Invoice Number | invoice_number | Single-line text |
| Invoice Date | invoice_date | Date |
| Company | company_id | Association |
| Deal | deal_id | Association |
Customer Payment Object Name: p246208318_customer_payments
| Field Label | Field Name | Field Type |
|---|---|---|
| Amount Paid | amount_paid | Number |
| External Ref ID | external_ref_id | Single-line text |
| Note | note | Multi-line text |
| Status | status | Dropdown |
| Payment Number | payment_number | Single-line text |
| Total Amount | total_amount | Number |
| Transaction Date | transaction_date | Date |
| Company | company_id | Association |
| Invoice | invoice_id | Association |
6 System Overview
6.1 RUNMYBOT® Platform
A real-time orchestration engine that aggregates data across multiple systems and manages complex cross-platform transactions. Unlike a simple connector model, it functions as a real-time transaction orchestration layer between HubSpot and SAP S/4HANA, making the integration layer completely invisible to end users.
6.2 HubSpot
Cloud-based CRM used as the primary commercial system and origin for customer relationship and sales pipeline management.
6.3 SAP S/4HANA
ERP system used as the financial and operational system of record, managing customers, contacts, order processing, and accounting records.
7 Scope Requirements
| Use Case | Direction | Description |
|---|---|---|
| Customer Sync | Hubspot ↔ S/4HANA | Bi-directional sync of BusinessPartner (S/4HANA) and Company (HubSpot) master records. |
| Contact Sync | Hubspot ↔ S/4HANA | Bi-directional sync of Contact records. |
| Deal Sync | Hubspot → S/4HANA | Synchronize Closed Won HubSpot Deals (including headers and line items) to SAP Sales Orders. |
| Product Master Sync | S/4HANA → Hubspot | Sync products to HubSpot. |
| Sales Invoice Sync | S/4HANA → Hubspot | Push posted Sales Invoices from SAP to HubSpot custom objects. |
| Customer Payment Sync | S/4HANA → Hubspot | Push customer payments to HubSpot custom objects. |
8 Process in Detail
8.1 Authentication
HubSpot (CRM): OAuth 2.0 Client Credentials authentication is used. RUNMYBOT handles secure token storage and refresh.
SAP S/4HANA: Basic Authentication is used securely over HTTPS with a dedicated API user.
8.2 Standard Workflows
The standard integration workflows between HubSpot and SAP S/4HANA synchronize core business entities including Customers, Contacts, Products, and Sales Orders.
8.2.1 HubSpot Company to SAP S/4HANA Customer
Company records created or updated in HubSpot are synchronized with SAP S/4HANA. When a Customer record is
created in SAP, the Business Partner ID is written back to HubSpot as the cross-reference key
(sap_company_id).
Connection: <Select HubSpot Connection>
Resource: Companies
Extract Type: All - Always extract all data
Include All Fields: True
Connection: <Select S/4HANA Connection>
Resource: Business Partner
Import Type: Upsert
Directly By ID: False
Lookup Condition 1: Lookup Field: BusinessPartnerCategory, Operator: Equal, Source: Mapping
Lookup Condition 2: Lookup Field: BusinessPartner, Operator: Equal, Source: Mapping
SAP S/4HANA Company Import Mapping
| Source Data (HubSpot) | Target Data (S/4HANA) | Description / Rules |
|---|---|---|
| properties.name | OrganizationBPName1 | Company Name |
| properties.address | to_BusinessPartnerAddress.results[*].StreetName | Street Address |
| properties.address2 | to_BusinessPartnerAddress.results[*].StreetPrefixName | Address Line 2 |
| properties.city | to_BusinessPartnerAddress.results[*].CityName | City |
| properties.country | to_BusinessPartnerAddress.results[*].Country | Lookup Mapping: United States - US, India - IN, Germany - GE, United Kingdom - GB, France - FR |
| properties.phone | to_BusinessPartnerAddress.results[*].to_PhoneNumber.results[*].PhoneNumber | Phone Number |
| properties.state | to_BusinessPartnerAddress.results[*].Region | Lookup Mapping: New York - NY, California - CA, Kerala - KL |
| properties.zip | to_BusinessPartnerAddress.results[*].PostalCode | Postal Code |
| BusinessPartnerCategory | Static: 2 | |
| id | ID | HubSpot Record ID |
| to_BusinessPartnerRole.results[*].BusinessPartnerRole | Static: FLCU01 | |
| to_Customer.CustomerAccountGroup | Static: CUST | |
| properties.sap_company_id | BusinessPartner | Cross-reference key |
| to_BusinessPartnerAddress.results[*].Language | Static: EN | |
| to_Customer.to_CustomerSalesArea.results[*].SalesOrganization | Static: 1710 | |
| to_Customer.to_CustomerSalesArea.results[*].DistributionChannel | Static: 10 | |
| to_Customer.to_CustomerSalesArea.results[*].Division | Static: 00 | |
| to_Customer.to_CustomerSalesArea.results[*].Currency | Static: usd | |
| to_Customer.to_CustomerSalesArea.results[*].CustomerPricingProcedure | Static: 02 |
Connection: <Select HubSpot Connection>
Resource: Companies
Method: Operation: Update, Directly By HubSpot ID: True
HubSpot Company Update Default mapping
| Source Data | Target Data | Description / Rules |
|---|---|---|
| s4hana_id | properties.sap_company_id | Default mapping |
| Reference_id | id | Default mapping |
HubSpot Company Update Conditional mapping (response - Not Equals - Null)
| Source Data | Target Data | Description / Rules |
|---|---|---|
| response.BusinessPartner | properties.sap_company_id | Conditional mapping (response != Null) |
| Reference_id | id | Conditional mapping (response != Null) |
8.2.2 HubSpot Contact to SAP S/4HANA Contact
Contact records created or updated in HubSpot are synchronized to SAP S/4HANA to ensure customer contact information remains consistent across both systems.
Connection: <Select HubSpot Connection>
Resource: Contacts
Extract Type: All - Always extract all data
Include All Fields: True
Connection: <Select S/4HANA Connection>
Resource: Business Partner
Import Type: Upsert
Directly By ID: False
Lookup Condition 1: Lookup Field: BusinessPartnerCategory, Operator: Equal, Source: Mapping
Lookup Condition 2: Lookup Field: BusinessPartner, Operator: Equal, Source: Mapping
SAP S/4HANA Contact Import Mapping
| Source Data (HubSpot) | Target Data (S/4HANA) | Description / Rules |
|---|---|---|
| properties.firstname | FirstName | First Name |
| properties.lastname | LastName | Last Name |
| properties.email | to_BusinessPartnerAddress.results[*].to_EmailAddress.results[*].EmailAddress | Email Address |
| BusinessPartnerCategory | Static: 1 | |
| properties.country | to_BusinessPartnerAddress.results[*].Country | Lookup Mapping: United States - US, India - IN, Germany - GE, United Kingdom - GB, France - FR |
| properties.address | to_BusinessPartnerAddress.results[*].StreetName | Street Address |
| properties.state | to_BusinessPartnerAddress.results[*].Region | Lookup Mapping: New York - NY, California - CA, Kerala - KL |
| properties.zip | to_BusinessPartnerAddress.results[*].PostalCode | Postal Code |
| properties.phone | to_BusinessPartnerAddress.results[*].to_PhoneNumber.results[*].PhoneNumber | Phone Number |
| properties.city | to_BusinessPartnerAddress.results[*].CityName | City Name |
| properties.fax | to_BusinessPartnerAddress.results[*].to_FaxNumber.results[*].FaxNumber | Fax Number |
| properties.gender | GenderCodeName | Lookup Mapping: male - 2, female - 1 |
| properties.salutation | FormOfAddress | Lookup Mapping: Mr. - 0002, MS - 0001 |
| to_BusinessPartnerAddress.results[*].to_EmailAddress.results[*].IsDefaultEmailAddress | Static: true | |
| id | ID | HubSpot Record ID |
| properties.sap_contact_id | BusinessPartner | Cross-reference key |
Connection: <Select HubSpot Connection>
Resource: Contact
Method: Operation: Update, Directly By HubSpot ID: True
HubSpot Contact Update Default mapping
| Source Data | Target Data | Description / Rules |
|---|---|---|
| s4hana_id | properties.sap_contact_id | Default mapping |
| Reference_id | id | Default mapping |
HubSpot Contact Update Conditional mapping (response - Not Equals - Null)
| Source Data | Target Data | Description / Rules |
|---|---|---|
| response.BusinessPartner | properties.sap_contact_id | Conditional mapping (response != Null) |
| Reference_id | id | Conditional mapping (response != Null) |
8.2.3 SAP S/4HANA Company to HubSpot Company
Customer records created or updated in SAP S/4HANA are synchronized back to HubSpot to ensure that address and master metadata are always identical.
Connection: <Select S/4HANA Connection>
Resource: Company
Extract Type: All - Always extract all data
Connection: <Select HubSpot Connection>
Resource: Companies
Method: Operation: Upsert, Directly By HubSpot ID: False
Lookup Condition: Lookup Field: properties.sap_company_id, Operator: Equal, Source: Mapping
Field Mapping Table
| Source Data (S/4HANA) | Target Data (HubSpot) | Description / Rules |
|---|---|---|
| to_BusinessPartnerAddress.results[*].CityName | properties.city | City Name |
| to_BusinessPartnerAddress.results[*].Country | properties.country | Lookup Mapping: US - United States, IN - India, GE - Germany, GB - United Kingdom, FR - France |
| to_BusinessPartnerAddress.results[*].Region | properties.state | Lookup Mapping: NY - New York, CA - California, KL - Kerala |
| to_BusinessPartnerAddress.results[*].PostalCode | properties.zip | Postal Code |
| to_BusinessPartnerAddress.results[*].StreetName | properties.address | Street Address |
| to_BusinessPartnerAddress.results[*].StreetPrefixName | properties.address2 | Address Line 2 |
| Industry | properties.industry | Industry Category |
| LastChangeDate | properties.hs_lastmodifieddate | Last Modified Timestamp |
| BusinessPartner | properties.sap_company_id | Cross-reference key |
| OrganizationBPName1 | properties.name | Company Name |
| to_BusinessPartnerAddress.results[*].Country | properties.hs_country_code | Country Code Reference |
| to_BusinessPartnerAddress.results[*].to_PhoneNumber.results[*].PhoneNumber | properties.phone | Phone Number |
8.2.4 SAP S/4HANA Contact to HubSpot Contact
Contact records created or updated in SAP S/4HANA are detected by RUNMYBOT and synchronized back to HubSpot, ensuring consistency across both environments.
Connection: <Select S/4HANA Connection>
Resource: Contact
Extract Type: All - Always extract all data
Connection: <Select HubSpot Connection>
Resource: Contacts
Operation: Upsert
Directly By HubSpot ID: False
Lookup Condition: Lookup Field: properties.sap_contact_id, Operator: Equal, Source: Mapping
Field Mapping Table
| Source Data (S/4HANA) | Target Data (HubSpot) |
|---|---|
| FirstName | properties.firstname |
| to_BusinessPartnerAddress.results[*].StreetName | properties.address |
| to_BusinessPartnerAddress.results[*].CityName | properties.city |
| to_BusinessPartnerAddress.results[*].Country | properties.country |
| to_BusinessPartnerAddress.results[*].to_EmailAddress.results[*].EmailAddress | properties.email |
| BusinessPartner | properties.sap_contact_id |
| LastName | properties.lastname |
| to_BusinessPartnerAddress.results[*].Region | properties.state |
| to_BusinessPartnerAddress.results[*].PostalCode | properties.zip |
| to_BusinessPartnerAddress.results[*].to_PhoneNumber.results[*].PhoneNumber | properties.phone |
| to_BusinessPartnerAddress.results[*].to_FaxNumber.results[*].FaxNumber | properties.fax |
| GenderCodeName | properties.gender |
| FormOfAddress | properties.salutation |
8.2.5 HubSpot Deal to SAP S/4HANA Sales Order
Closed Won HubSpot Deals are synchronized to SAP S/4HANA Sales Orders. RUNMYBOT retrieves Deal data from HubSpot through REST APIs, validates the incoming payload, and performs the required field mapping and data transformation to align HubSpot Deal, Company, Contact, and Product information with the corresponding SAP S/4HANA Sales Order fields.
Connection: <Select Hubspot Connection>
Resource: Deals
Associations: Companies, Line Items
Extract Type: All - Always extract all data
Include All Fields: True
Enable Lookup: True
Lookup Condition: Lookup Field: StageName, Operator: Equal, Source: Static, Value: closedwon
Condition 1: Operation: Filter, Field Name: properties.sap_reference_id, Condition: Is EMPTY
Condition 2: Operation: Filter, Field Name: line_items, Condition: Is Not Empty
Condition 3: Operation: Filter, Field Name: companies, Condition: Is Not Empty
Condition 1: Operation: Filter, Field Name: id, Condition: Unique
Data Preprocess - Filter2 Mapping
| Source Data | Target Data | Description / Rules |
|---|---|---|
| companies | companies | Companies list |
Connection: <Select S/4HANA Connection>
Resource: Business Partner
Import Type: Upsert
Directly By ID: False
Lookup Condition 1: Lookup Field: BusinessPartnerCategory, Operator: Equal, Source: Mapping
Lookup Condition 2: Lookup Field: BusinessPartner, Operator: Equal, Source: Mapping
SAP S/4HANA Company Import Mapping
| Source Data (HubSpot) | Target Data (S/4HANA) | Description / Rules |
|---|---|---|
| properties.name | OrganizationBPName1 | Company Name |
| properties.address | to_BusinessPartnerAddress.results[*].StreetName | Street Address |
| properties.address2 | to_BusinessPartnerAddress.results[*].StreetPrefixName | Address Line 2 |
| properties.city | to_BusinessPartnerAddress.results[*].CityName | City |
| properties.country | to_BusinessPartnerAddress.results[*].Country | Lookup Mapping: US - United States, IN - India, GE - Germany, GB - United Kingdom, FR - France |
| properties.phone | to_BusinessPartnerAddress.results[*].to_PhoneNumber.results[*].PhoneNumber | Phone Number |
| properties.state | to_BusinessPartnerAddress.results[*].Region | Lookup Mapping: NY - New York, CA - California, KL - Kerala |
| properties.zip | to_BusinessPartnerAddress.results[*].PostalCode | Postal Code |
| BusinessPartnerCategory | Static Category: 2 | |
| id | ID | HubSpot ID Reference |
| to_BusinessPartnerRole.results[*].BusinessPartnerRole | Static Role: FLCU01 | |
| to_Customer.CustomerAccountGroup | Static Group: CUST | |
| properties.sap_company_id | BusinessPartner | Business Partner ID Reference |
| to_BusinessPartnerAddress.results[*].Language | Static Language: EN | |
| to_Customer.to_CustomerSalesArea.results[*].SalesOrganization | Static Org: 1710 | |
| to_Customer.to_CustomerSalesArea.results[*].DistributionChannel | Static Channel: 10 | |
| to_Customer.to_CustomerSalesArea.results[*].Division | Static Division: 00 | |
| to_Customer.to_CustomerSalesArea.results[*].Currency | Static Currency: usd | |
| to_Customer.to_CustomerSalesArea.results[*].CustomerPricingProcedure | Static Pricing: 02 |
Connection: <Select Hubspot Connection>
Resource: Companies
Operation: Update
Directly By Hubspot ID: True
Hubspot Account Update Default mapping
| Source Data | Target Data | Description / Rules |
|---|---|---|
| s4hana_id | properties.sap_company_id | S/4HANA BP ID |
| Reference_id | id | HubSpot Company ID Reference |
Hubspot Account Update Conditional mapping (response - Not Equals - Null)
| Source Data | Target Data | Description / Rules |
|---|---|---|
| response.BusinessPartner | properties.sap_company_id | S/4HANA BP ID |
| Reference_id | id | HubSpot Company ID Reference |
Condition 1: Operation: Merge, Join Type: Left Join, Split Field: PurchaseOrderByCustomer, Left Data: WITH SPLIT KEY PRESENT, Group By Fields: company_id
Hubspot Company to Data Preprocess Mapping
| Source Data | Target Data | Description / Rules |
|---|---|---|
| id | company_id | HubSpot ID Reference |
| properties.sap_company_id | businesspartner | S/4HANA Business Partner ID |
Data Preprocess Mapping
| Source Data | Target Data | Description / Rules |
|---|---|---|
| properties.amount | TotalNetAmount | Amount Reference |
| line_items | to_Item | Line Items details |
| properties.dealname | PurchaseOrderByCustomer | Deal Name Reference |
| id | hubspot_id | HubSpot Deal ID |
| companies[*].id | company_id | HubSpot Company ID |
Connection: <Select S/4HANA Connection>
Resource: Sales Order
Import Type: Create
Ignore Existing Records: False
SAP S/4HANA Sales Order Import Mapping
| Source Data | Target Data | Description / Rules |
|---|---|---|
| SalesOrderType | Static: OR | |
| SalesOrganization | Static: 1710 | |
| DistributionChannel | Static: 10 | |
| OrganizationDivision | Static: 00 | |
| businesspartner | SoldToParty | Customer Sold-to Party |
| PurchaseOrderByCustomer | PurchaseOrderByCustomer | Order Reference |
| TotalNetAmount | TotalNetAmount | Total Net Amount |
| hubspot_id | ID | HubSpot ID Reference |
| to_Item[*].properties.quantity | to_Item.results[*].RequestedQuantity | Item Quantity |
| to_Item[*].properties.hs_sku | to_Item.results[*].Material | Product SKU |
| to_Item[*].properties.description | to_Item.results[*].SalesOrderItemText | Line Item Memo |
| to_Item[*].properties.hs_effective_unit_price | to_Item.results[*].NetAmount | Item Net Price |
| to_Item[*].properties.hs_tax_amount | to_Item.results[*].TaxAmount | Item Tax Amount |
| to_Item.results[*].TransactionCurrency | Static Currency: USD |
Connection: <Select Hubspot Connection>
Resource: Deal
Operation: Update
Directly By Hubspot ID: True
Hubspot Deal Update Mapping
| Source Data | Target Data | Description / Rules |
|---|---|---|
| Reference_id | id | HubSpot Deal ID Reference |
| response.SalesOrder | properties.sap_reference_id | SAP Sales Order Number |
8.2.6 SAP S/4HANA Product to HubSpot Product
Product records created or updated in SAP S/4HANA are synchronized to HubSpot to ensure that the CRM catalog has accurate description, SKU, and price details.
Connection: <Select S/4HANA Connection>
Resource: Product
Extract Type: All - Always extract all data
Connection: <Select HubSpot Connection>
Resource: Product
Method: Operation: Upsert, Directly By HubSpot ID: False
Lookup Condition: Lookup Field: properties.sap_product_id, Operator: Equal, Source: Mapping
Field Mapping Table
| Source Data (S/4HANA) | Target Data (HubSpot) | Description / Rules |
|---|---|---|
| Product | properties.name | Product Name |
| to_Valuation.results[*].StandardPrice | properties.price | Product Price |
| Product | properties.sap_product_id | SAP Product ID Reference |
| ProductType | properties.hs_product_type | Lookup Mapping: SERV - service, FERT - inventory |
| Product | properties.hs_sku | SKU Code |
8.2.7 SAP S/4HANA Fulfillment to HubSpot Deal
Fulfillment records created or updated in SAP S/4HANA are synchronized to the corresponding HubSpot Deal to ensure that the deal reflects the latest fulfillment status and related shipment information.
Connection: <Select S/4HANA Connection>
Resource: Order Fulfillment
Extract Type: All - Always extract all data
Connection: <Select HubSpot Connection>
Resource: Deals
Method: Operation: Update
Directly By HubSpot ID: False
Lookup Condition: Lookup Field: properties.sap_reference_id, Operator: Equal, Source: Mapping
Field Mapping Table
| Source Data (S/4HANA) | Target Data (HubSpot) |
|---|---|
| ReferenceSDDocument | properties.sap_reference_id |
| LastChangedDate | properties.sap_ship_date |
| GoodsMovementStatus | properties.sap_delivery_status |
8.3 Custom Workflows
Custom workflows extend the integration features for financial transactions such as invoices and payments.
8.3.1 SAP S/4HANA Sales Invoice to HubSpot Sales Invoice
Synchronize posted Billing Documents (Sales Invoices) from SAP S/4HANA into HubSpot custom objects to give sales teams full commercial and financial visibility.
Connection: <Select S/4HANA Connection>
Resource: Invoice
Extract Type: All - Always extract all data
Enable Lookup: true
Lookup Condition 1: Lookup Field: SDDocumentCategory, Operator: Equal, Source: Static, Value: M
Connection: <Select Hubspot Connection>
Resource: Deals
Associations: Companies
Extract Type: All - Always extract all data
Include All Fields: True
Enable Lookup: True
Lookup Condition: Lookup Field: sap_reference_id, Operator: Equal, Source: Mapping
Hubspot Deal Export Mapping
| Source Data | Target Data | Description / Rules |
|---|---|---|
| to_Item.results[*].SalesDocument | sap_reference_id | SAP Sales Order Reference |
| BillingDocument | prev_data.invoice_number | SAP Invoice Number |
Condition 1: Operation: Merge, Join Type: Left Join, Split Field: associations, Left Data: WITHOUT SPLIT KEY PRESENT, Group By Fields: invoice_number
Condition 2: Operation: Filter, Field Name: associations, Condition: Is Not EMPTY
Hubspot Opportunity Export to Data preprocess Mapping
| Source Data | Target Data | Description / Rules |
|---|---|---|
| id | associations[*].to.id | HubSpot Deal ID Reference |
| prev_data.invoice_number | invoice_number | Invoice Number Reference |
| associations[*].types[*].associationCategory | Static Category: USER_DEFINED | |
| associations[*].types[*].associationTypeId | Static Type ID: 21 |
S/4HANA Invoice Export to Data Preprocess Mapping
| Source Data | Target Data | Description / Rules |
|---|---|---|
| TotalGrossAmount | TotalGrossAmount | Total Gross Amount |
| BillingDocumentDate | BillingDocumentDate | Billing Document Date |
| BillingDocument | BillingDocument | Invoice Reference ID |
| to_Item.results[*].SalesDocument | sap_reference_id | SAP Sales Order Reference |
| OverallSDProcessStatus | status | Invoice Status |
| SoldToParty | sap_company_id | S/4HANA Sold-to Party ID |
| BillingDocument | invoice_number | Invoice Number |
Condition 1: Operation: Merge, Join Type: Full Join, Group By Fields: invoice_number
Data preprocess Mapping
| Source Data | Target Data | Description / Rules |
|---|---|---|
| companies[*].id | associations[*].to.id | Company ID Reference |
| companies[*].properties.sap_company_id | sap_company_id | S/4HANA BP ID |
| companies[*].properties.name | company_name | Company Name |
| properties.sap_reference_id | sap_reference_id | Sales Order Reference |
| prev_data.invoice_number | invoice_number | Invoice Number |
| associations[*].types[*].associationCategory | Static Category: USER_DEFINED | |
| associations[*].types[*].associationTypeId | Static Type ID: 21 |
Connection: <Select Hubspot Connection>
Resource: Custom Object
Custom Object Name: p246208318_sales_invoices
Operation: Upsert
Directly By Hubspot ID: False
Lookup Condition: Lookup Field: properties.external_ref_id, Operator: Equal, Source: Mapping
Hubspot Sales Invoice Import Mapping
| Source Data (S/4HANA) | Target Data (HubSpot) | Description / Rules |
|---|---|---|
| BillingDocument | properties.external_ref_id | External Reference ID |
| TotalGrossAmount | properties.invoice_amount | Total Invoice Amount |
| BillingDocumentDate | properties.invoice_date | Invoice Date |
| BillingDocument | properties.invoice_number | Invoice Number Reference |
| status | properties.status | Lookup Mapping: A - Open, B - Partially Paid, C - Paid |
| associations | associations | Links to Deals & Companies |
8.3.2 SAP S/4HANA Customer Payment to HubSpot Payment
SAP Customer Payments are synchronized to HubSpot Customer Payment custom objects, matching them against corresponding HubSpot Sales Invoices.
Connection: <Select S/4HANA Connection>
Resource: Payment
Extract Type: All - Always extract all data
Enable Lookup: true
Lookup Condition 1: Lookup Field: BillingDocument, Operator: Not Equal to Empty
Lookup Condition 2: Lookup Field: PaymentReference, Operator: Not Equal to Empty
Connection: <Select HubSpot Connection>
Resource: Custom Object
Custom Object Name: p246208318_sales_invoices
Extract Type: All - Always extract all data
Include All Fields: True
Enable Look Up: True
Lookup Condition 1: Lookup Field: invoice_number, Operator: Equal, Source: Mapping
Hubspot Sales Invoice Export to Data preprocess Mapping
| Source Data | Target Data | Description / Rules |
|---|---|---|
| id | associations[*].to.id | HubSpot Invoice ID Reference |
| properties.invoice_number | invoice_number | Invoice Number Reference |
| properties.invoice_amount | total_amount | Invoice Total Amount |
| associations[*].types[*].associationCategory | Static Category: USER_DEFINED | |
| associations[*].types[*].associationTypeId | Static Type ID: 39 | |
| prev_data.payment_number | payment_number | Payment Number Reference |
Condition 1: Operation: Merge, Join Type: Left Join, Split Field: associations, Left Data: WITHOUT SPLIT KEY PRESENT, Group By Fields: payment_number
Condition 2: Operation: Filter, Field Name: associations, Condition: Is Not EMPTY
S/4HANA Customer Payment Export to Data Preprocess Mapping
| Source Data | Target Data | Description / Rules |
|---|---|---|
| BillingDocument | invoice_number | Invoice Number Reference |
| PostingDate | PostingDate | Posting/Payment Date |
| IsCleared | status | Payment status (Cleared/Open) |
| PaymentReference | payment_number | Payment Reference ID |
| AmountInCompanyCodeCurrency | amount_paid | Amount Paid Value |
| Customer | customer_id | S/4HANA Customer ID |
Connection: <Select Hubspot Connection>
Resource: Companies
Extract Type: All - Always extract all data
Include All Fields: True
Enable Look Up: True
Lookup Condition 1: Lookup Field: sap_company_id, Operator: Equal, Source: Mapping
Hubspot Company Export Mapping
| Source Data | Target Data | Description / Rules |
|---|---|---|
| customer_id | sap_company_id | SAP Customer ID Reference |
| payment_number | prev_data.payment_number | Payment Number Reference |
Condition 1: Operation: Merge, Join Type: Full Join, Group By Fields: payment_number
Data preprocess Mapping
| Source Data | Target Data | Description / Rules |
|---|---|---|
| id | associations[*].to.id | Company ID Reference |
| associations[*].types[*].associationCategory | Static Category: USER_DEFINED | |
| associations[*].types[*].associationTypeId | Static Type ID: 48 | |
| prev_data.payment_number | payment_number | Payment Number Reference |
| properties.name | company_name | Company Name Reference |
Connection: <Select Hubspot Connection>
Resource: Custom Object
Custom Object Name: p246208318_customer_payments
Operation: Create
Ignore existing records: True
Enable Look Up: True
Lookup Condition 1: Lookup Field: properties.external_ref_id, Operator: Equal, Source: Mapping
Hubspot Customer Payment Import Mapping
| Source Data (S/4HANA) | Target Data (HubSpot) | Description / Rules |
|---|---|---|
| total_amount | properties.total_amount | Total Invoice Amount |
| amount_paid | properties.amount_paid | Amount Paid Value |
| payment_number | properties.external_ref_id | External Reference ID |
| payment_number | properties.payment_number | Payment Number Reference |
| status | properties.status | Lookup Mapping: true - Paid, false - Open |
| PostingDate | properties.transaction_date | Payment Date |
| associations | associations | Links to Invoice & Company |
9 Exception Handling
Error handling is implemented across trigger, transformation, and action stages of each flow to ensure reliable synchronization:
- Validation: Checks identify missing mandatory fields, invalid data formats, and incorrect reference mappings before processing.
- Duplicates: Managed using external identifiers and upsert logic to prevent duplicate record insertion.
- Retries: Automated retry schedules for network interruptions, API timeouts, rate limits, or temporary service unavailability.
- Logging: All integration activities, payloads, and errors are logged inside the RUNMYBOT monitoring dashboard.
