To try out the steps in this section, install Postman and open the Postman collection we have prepared for you. In the collection, open the Create a transaction from an opportunity request and replace variables with actual values.

Download Postman Open Postman Collection


Step 1: Create a POST request

Configure your application to send the following request:

POST https://{your_Salesforce_domain}/services/data/v44.0/actions/custom/apex/s2cor__Sage_INV_Create_Transaction

where


Step 2: Configure authorization

Make sure your request uses OAuth 2.0. Authorization data must be included in the request URL.


Step 3: Configure headers

Configure the request headers to include the following key-value pairs:

Key Value
Authorization Bearer {access_token}
Example:
Bearer 00D0N000000h6Yq!AR0AQObORnk9lCldrMydk1Y3cuyqpscqcU.T1xvoM1uWkWrr8MLu2ehJLKp7Mz3Qeu.eQGI13qlH_HfGEEMxV_J8FdI1TwdR
Content-Type application/json

Step 4: Add JSON payload

Add the following JSON payload to the request body:

{
  "inputs" : [ {
    "sourceId" : "{ salesforce_record_id }",
    "targetTransactionType" : "{ target_transaction_type }"
  } ]
}

In this JSON, replace the following placeholders with actual values:

TIP: Values of the s2cor__UID__c attribute can be autogenerated or created manually. We recommend that you manually create descriptive, self-explanatory values. Ensure that each s2cor__UID__c value you create is unique across your Salesforce org.


Step 5: Send your request

As a result, Financials creates a new draft Transaction record whose post status is Unposted and returns the record ID in the response.

NOTE: You can use a tool called Object Maps to map the fields of an Opportunity record to the corresponding fields of a Transaction record. For more information, see the article Object Maps - Financials posted on the Sage Customer Community.


Example request

POST https://my-domain.01.salesforce.com/services/data/v44.0/actions/custom/apex/s2cor__Sage_INV_Create_Transaction
{
  "inputs" : [ {
    "sourceId" : "0060E000008egNmQAI",
    "targetTransactionType" : "ContractProposal_TD_IE"
  } ]
}

Example response

[
    {
        "actionName": "s2cor__Sage_INV_Create_Transaction",
        "errors": null,
        "isSuccess": true,
        "outputValues": {
            "output": "a1v0E000000VtfWQAS"
        }
    }
]

where output contains the Id of the created Transaction record (a1v0E000000VtfWQAS).