Transaction Manager: Integration - POST

  • Release version: Australia
  • Updated March 12, 2026
  • 5 minutes to read
  • Summarize
    Summarized using AI
    This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.

    Summary of Transaction Manager: Integration - POST

    This guide details how to write data to Salesforce using the POST integration within the Transaction Manager, specifically for CPQ environments integrated with Salesforce. It covers prerequisites, setup, and the use of the Salesforce Composite Graph API for efficient data updates.

    Show full answer Show less

    Prerequisites

    Ensure that your CPQ environment is integrated with a Salesforce environment and that the Salesforce Transaction Manager Integration Package extension is installed. It is crucial to have the Salesforce transaction record's identifier available for writing CPQ data back to Salesforce.

    Salesforce Setup

    For successful integration, confirm that the necessary fields exist in the Salesforce Transaction and TransactionLine objects. Key fields include:

    • Header Fields:
      • LGKStagec: Stage of the CPQ transaction.
      • LGKPricingExtendedNetc: Header-level net total.
      • LGKIdc: Parent transaction ID.
    • Line Fields:
      • LGKQuantityc: Line-level quantity.
      • LGKPricingListc: Line-level list price.
      • LGKPricingNetc: Line net price.
      • LGKPricingExtendedNetc: Line net total.
      • LGKParentTransactionLineIdc: Checks for parent line reference.
      • LGKProduct2Idc: Product ID associated with the transaction line.

    Key Features

    The POST integration leverages the Salesforce Composite Graph API, allowing multiple Salesforce objects to be updated in a single API call. This capability enhances data consistency and reduces API usage, making the integration process more efficient. Key features include:

    • Atomic transactions ensure that all operations succeed together.
    • No additional setup is required for using the Composite Graph API.
    • Dynamic mappings for transaction and product data facilitate accurate line updates and discount application.

    Transaction Manager Setup

    Configure transaction ID mappings to ensure accurate updates in Salesforce. Employ two custom fields: lineReferenceId and parentLineReferenceId to manage line-level references effectively. It's important to remove hyphens from identifiers to comply with Salesforce restrictions, which can be achieved through determination rules.

    Debugging the POST Call

    If issues arise with the POST call, utilize the Integration Admin interface to debug by fetching the transaction JSON and running transformation logic to identify errors. This can be further tested using Postman.

    Next Steps

    To implement the POST data back to Salesforce, create a new integration in the Integrations section with the appropriate HTTP method and path. Use the provided JSON transformation template to ensure that the required fields are correctly populated.

    Learn how to write data to a third-party application such as Salesforce by using the POST integration.

    Prerequisites

    This article assumes that you have a CPQ environment that is integrated to a corresponding Salesforce environment. Before you continue, see Installing the Salesforce Transaction Manager Integration Package extension to complete the necessary integrations.

    When the end user initiates a function that writes CPQ data back to the corresponding Salesforce transaction record, CPQ must have the Salesforce transaction’s record identifier on hand. To understand how to retrieve the Salesforce transaction ID and save it into CPQ for future use, see Transaction Manager: Integration - GET.

    Salesforce setup

    In this example, we write LGK data to the Salesforce fields listed below. Review the Salesforce Transaction and TransactionLine objects to ensure these fields are present.

    Header fields (Salesforce object:LGK__Transaction__c)

    • LGK__Stage__c holds the stage of the CPQ transaction.
    • LGK__PricingExtendedNet__c is the transaction (header-level) net total.
    • LGK__Id__c is mapped to the id of the parent transaction.

    Line Fields (Salesforce object: LGK__TransactionLine__c)

    • LGK__Quantity__c: the line-level quantity.
    • LGK__PricingList__c: the line-level list price.
    • LGK__PricingNet__c: the line net price, or discounted piece price.
    • LGK__PricingExtendedNet__c: the line net total, or extended net price (includes quantity).
    • LGK__ParentTransactionLineId__c checks whether txn.line.custom.parentLineReferenceId exists. If it does, it assigns the corresponding line's id; otherwise, it sets the value to null.
    • LGK__Product2Id__c is mapped to the partnerId of the product associated with the current transaction line.

    POST integration using Composite Graph

    The LGK POST integration uses the Salesforce Composite Graph API to update multiple Salesforce objects simultaneously in a single API call, allowing both header-level and line-level fields to be updated in the same request.

    The Salesforce Composite Graph API enables bundling multiple operations into a single request, making it highly efficient for integrations. It allows writing to multiple Salesforce objects in a single POST call, reducing API usage, ensuring data consistency, and enabling atomic transactions—where either all operations succeed or none are applied. This simplifies integration processes and improves error handling. For more details on the Composite Graph construct, see Composite Graph | REST API Developer Guide | Salesforce Developers.

    Because the Composite Graph API is a core Salesforce capability, no setup is necessary. However, we introduce the concept here, before we populate a Composite Graph in the LGK POST call, described below. In the example below for POST, the integration uses the previously mentioned header-level and line-level fields in the Salesforce Setup section above, with the option for users to add or remove fields as per their requirements.

    Transaction Manager setup

    The transaction ID mappings mentioned in the Salesforce Setup section help CPQ send the right line IDs to Salesforce and manage updates, deletions, and additions effectively. By mapping LGK__TransactionId__c to the parent transaction ID, Salesforce can link all line-level changes to the correct transaction, ensuring proper association. The LGK__ParentTransactionLineId__c checks for a parent line reference; if present, it assigns the corresponding line ID, ensuring that only valid lines are updated or deleted. If no reference exists, it sets the value to null. The LGK__Product2Id__c maps to the product’s partner ID, ensuring the correct product is linked to the line for accurate pricing and discount application. These dynamic mappings ensure that Salesforce can accurately update quantities, delete lines, and add new ones while preserving user's line-level discounts by maintaining proper associations with transaction and product data.

    This integration transform requires the use of two custom line fields, lineReferenceId and parentLineReferenceId. These fields must be set up to store a variation of the txn.line.id and (potentially) txn.line.parent.id system fields.

    Rules

    The Salesforce Composite Graph API does not support hyphens in certain identifiers, which can cause issues when sending data that includes hyphenated IDs, such as the LGK line IDs. To make the integration work, the system removes any hyphens present in the LGK line IDs before sending them to Salesforce. This ensures that the IDs comply with Salesforce's format requirements and that the integration functions correctly without errors related to invalid characters. By removing the hyphens, the system ensures that all identifiers are accepted by Salesforce, allowing the integration to process updates and other operations smoothly.

    To remove hyphens by using a rule, create a determination rule action to make line-level reference Id fields Salesforce-compatible. You can add both the lineReferenceId determination action and parentLineReferenceId determination action in a single rule.

    Below are two determination scripts (transaction line level) for how the fields should be defined.

    // lineReferenceId Determination Action
    
    var original = txn.line.id;
    var result = "";
    for (var i = 0; i < original.length; i++) {
      if (original.charAt(i) !== "-") {
    	    result += original.charAt(i);
    	  }
    }
    return result;
    // parentLineReferenceId Determination Action
    
    var original = txn.line.parent.id;
    var result = "";
    if (txn.line.parent.id != txn.id) {
      for (var i = 0; i < original.length; i++) {
        if (original.charAt(i) !== "-") {
            result += original.charAt(i);
          }
      }
    }
    return result;

    The rule should be configured as follows, with two determination actions to handle txn.line.custom.lineReferenceId and txn.line.custom.parentLineReferenceId:

    Transaction Manager Setup

    Transaction Manager Setup

    Add Connection

    The screenshot below shows the external connection as “Salesforce” in the POST integration.

    If you want to create a new connection, see the "Creating a Connection" section in Transaction Manager: Integrations.

    Transaction Manager Setup

    To POST data back to Salesforce, you need the Salesforce transaction record ID. If you have not yet set up the GET integration to fetch the transaction ID, see Transaction Manager: Integration - GET.

    Add integration

    1. Navigate to the Integrations section and create a new integration.
      • HTTP Method: POST
      • Additional Path:/services/data/vXX.X/composite/graph, where vXX.X is the latest composite graph version. You can check for the latest version here.
      • Line Item Details to Include: Selected Lines
      • Connection: Salesforce

        Transaction Manager Setup

    2. In the Request Transformation section, add this sample transaction JSON (header and line-level fields may vary according to your preference):
    {
      "graphs": [
        {
          "graphId": "graph0",
          "compositeRequest": [
            {
              "method": "PATCH",
              "url" : "/services/data/v61.0/sobjects/LGK__Transaction__c/LGK__TransactionUUID__c/{{txn.id}}",
              "referenceId": "parentTransaction",
              "body": {
                "LGK__Stage__c": "{{txn.stage}}",
                "LGK__NetTotal__c": "{{txn.pricing.total}}"
              }
            }
            {{#if lines}}
    				{{~#each lines~}}
    				{{#if txn.line.product.partnerId}}
    				,
            {
              "method": "PATCH",
              "url": "/services/data/v61.0/sobjects/LGK__TransactionLine__c/LGK__TransactionLineId__c/{{txn.line.id}}",
              "referenceId": "line_{{txn.line.custom.lineReferenceId}}",
              "body": {
                "LGK__TransactionId__c": "@{parentTransaction.id}",
                "LGK__ParentTransactionLineId__c": {{#if txn.line.custom.parentLineReferenceId}}"@{line_{{txn.line.custom.parentLineReferenceId}}.id}"{{else}}null{{/if}},
                "LGK__Product2Id__c": "{{txn.line.product.partnerId}}",
                "LGK__Quantity__c": "{{txn.line.quantity}}",
                "LGK__ListPrice__c": "{{txn.line.pricing.list}}",
                "LGK__NetPrice__c": "{{txn.line.pricing.net}}",
                "LGK__NetTotal__c": "{{txn.line.pricing.extendedNet}}"
              }
            }
            {{/if}}
    		{{/each}}
    		{{/if}}
          ]
        }
      ]
    }

    This transformation template is added to the Transformation Template area of the Request Transformation section as follows:

    Transaction Manager Setup

    For more information about Handlebar syntax, see Transaction Manager: Integrations - Handlebars syntax.

    Debugging the POST call

    To use the Integration Admin interface to debug a POST call that is not working as expected, follow these steps:

    1. Copy the transaction ID for which the integration is not working, paste it in the small Transaction ID box, and then click Fetch JSON.

      Transaction Manager Setup

      The application populates the Sample Transaction JSON box.

      Transaction Manager Setup

    2. Click Run Transformation. This processes the transaction information contained in the Sample Transaction JSON input through the transformation logic and generates a result that you can test using Postman.

      For more information about setting up Postman to interface with your Salesforce org, see Connect Postman to Salesforce.

      Transaction Manager Setup