Chilkat Online Tools

SQL Server / Salesforce Platform APIs / Create Order With Bundle

Back to Collection Items

-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    DECLARE @iTmp0 int
    -- Important: Do not use nvarchar(max).  See the warning about using nvarchar(max).
    DECLARE @sTmp0 nvarchar(4000)
    -- This example assumes the Chilkat API to have been previously unlocked.
    -- See Global Unlock Sample for sample code.

    DECLARE @http int
    -- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
    EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    DECLARE @success int

    -- Use this online tool to generate code from sample JSON: Generate Code to Create JSON

    -- The following JSON is sent in the request body.

    -- {
    --   "allOrNone": true,
    --   "compositeRequest": [
    --     {
    --       "method": "POST",
    --       "url": "/services/data/v57.0/sobjects/Order",
    --       "referenceId": "refOrder",
    --       "body": {
    --         "AccountId": "{{defaultAccount}}",
    --         "EffectiveDate": "2023-01-01",
    --         "Pricebook2Id": "{{standardPricebook}}",
    --         "BillToContactId": "{{defaultBillToContact}}",
    --         "Status": "Draft"
    --       }
    --     },
    --     {
    --       "method": "POST",
    --       "url": "/services/data/v57.0/sobjects/AppUsageAssignment",
    --       "referenceId": "refAppTag",
    --       "body": {
    --         "AppUsageType": "SubscriptionManagement",
    --         "RecordId": "@{refOrder.id}"
    --       }
    --     },
    --     {
    --       "method": "POST",
    --       "url": "/services/data/v57.0/sobjects/OrderAction",
    --       "referenceId": "refOrderAction",
    --       "body": {
    --         "OrderId": "@{refOrder.id}",
    --         "Type": "New Sale"
    --       }
    --     },
    --     {
    --       "method": "POST",
    --       "url": "/services/data/v57.0/sobjects/OrderItem",
    --       "referenceId": "refWorkAnywhereBundle",
    --       "body": {
    --         "OrderId": "@{refOrder.id}",
    --         "OrderActionId": "@{refOrderAction.id}",
    --         "PricebookEntryId": "{{WorkAnywhereBundlePBE}}",
    --         "ServiceDate": "2023-01-01",
    --         "Quantity": 1,
    --         "UnitPrice": 10000,
    --         "NetUnitPrice": 10000,
    --         "TotalLineAmount": 10000,
    --         "PeriodBoundary": "AlignToCalendar",
    --         "BillingFrequency2": "Monthly"
    --       }
    --     },
    --     {
    --       "method": "POST",
    --       "url": "/services/data/v57.0/sobjects/OrderItem",
    --       "referenceId": "refVirtualRouter",
    --       "body": {
    --         "OrderId": "@{refOrder.id}",
    --         "OrderActionId": "@{refOrderAction.id}",
    --         "PricebookEntryId": "{{VirtualRouterEvergrnPBE}}",
    --         "ServiceDate": "2023-01-01",
    --         "Quantity": 100,
    --         "UnitPrice": 0,
    --         "NetUnitPrice": 0,
    --         "TotalLineAmount": 0,
    --         "PeriodBoundary": "AlignToCalendar",
    --         "BillingFrequency2": "Monthly"
    --       }
    --     },
    --     {
    --       "method": "POST",
    --       "url": "/services/data/v57.0/sobjects/OrderItem",
    --       "referenceId": "refBronzeSLA",
    --       "body": {
    --         "OrderId": "@{refOrder.id}",
    --         "OrderActionId": "@{refOrderAction.id}",
    --         "PricebookEntryId": "{{SLABronzeEvergrnMonthPBE}}",
    --         "ServiceDate": "2023-01-01",
    --         "Quantity": 3,
    --         "UnitPrice": 0,
    --         "NetUnitPrice": 0,
    --         "TotalLineAmount": 0,
    --         "PeriodBoundary": "AlignToCalendar",
    --         "BillingFrequency2": "Monthly"
    --       }
    --     },
    --     {
    --       "method": "POST",
    --       "url": "/services/data/v57.0/sobjects/OrderItemRelationship",
    --       "referenceId": "refOrderItemRelationship1",
    --       "body": {
    --         "ProductRelationshipTypeId": "{{BundleProductRelationshipType}}",
    --         "MainOrderItemId": "@{refWorkAnywhereBundle.id}",
    --         "AssociatedOrderItemId": "@{refVirtualRouter.id}",
    --         "AssociatedOrderItemPricing": "IncludedInBundlePrice",
    --         "AssociatedQuantScaleMethod": "Proportional"
    --       }
    --     },
    --     {
    --       "method": "POST",
    --       "url": "/services/data/v57.0/sobjects/OrderItemRelationship",
    --       "referenceId": "refOrderItemRelationship2",
    --       "body": {
    --         "ProductRelationshipTypeId": "{{BundleProductRelationshipType}}",
    --         "MainOrderItemId": "@{refWorkAnywhereBundle.id}",
    --         "AssociatedOrderItemId": "@{refBronzeSLA.id}",
    --         "AssociatedOrderItemPricing": "IncludedInBundlePrice",
    --         "AssociatedQuantScaleMethod": "Constant"
    --       }
    --     }
    --   ]
    -- }

    DECLARE @json int
    -- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
    EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @json OUT

    EXEC sp_OAMethod @json, 'UpdateBool', @success OUT, 'allOrNone', 1
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[0].method', 'POST'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[0].url', '/services/data/v57.0/sobjects/Order'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[0].referenceId', 'refOrder'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[0].body.AccountId', '{{defaultAccount}}'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[0].body.EffectiveDate', '2023-01-01'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[0].body.Pricebook2Id', '{{standardPricebook}}'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[0].body.BillToContactId', '{{defaultBillToContact}}'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[0].body.Status', 'Draft'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[1].method', 'POST'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[1].url', '/services/data/v57.0/sobjects/AppUsageAssignment'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[1].referenceId', 'refAppTag'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[1].body.AppUsageType', 'SubscriptionManagement'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[1].body.RecordId', '@{refOrder.id}'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[2].method', 'POST'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[2].url', '/services/data/v57.0/sobjects/OrderAction'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[2].referenceId', 'refOrderAction'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[2].body.OrderId', '@{refOrder.id}'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[2].body.Type', 'New Sale'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[3].method', 'POST'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[3].url', '/services/data/v57.0/sobjects/OrderItem'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[3].referenceId', 'refWorkAnywhereBundle'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[3].body.OrderId', '@{refOrder.id}'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[3].body.OrderActionId', '@{refOrderAction.id}'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[3].body.PricebookEntryId', '{{WorkAnywhereBundlePBE}}'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[3].body.ServiceDate', '2023-01-01'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'compositeRequest[3].body.Quantity', 1
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'compositeRequest[3].body.UnitPrice', 10000
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'compositeRequest[3].body.NetUnitPrice', 10000
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'compositeRequest[3].body.TotalLineAmount', 10000
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[3].body.PeriodBoundary', 'AlignToCalendar'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[3].body.BillingFrequency2', 'Monthly'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[4].method', 'POST'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[4].url', '/services/data/v57.0/sobjects/OrderItem'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[4].referenceId', 'refVirtualRouter'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[4].body.OrderId', '@{refOrder.id}'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[4].body.OrderActionId', '@{refOrderAction.id}'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[4].body.PricebookEntryId', '{{VirtualRouterEvergrnPBE}}'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[4].body.ServiceDate', '2023-01-01'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'compositeRequest[4].body.Quantity', 100
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'compositeRequest[4].body.UnitPrice', 0
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'compositeRequest[4].body.NetUnitPrice', 0
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'compositeRequest[4].body.TotalLineAmount', 0
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[4].body.PeriodBoundary', 'AlignToCalendar'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[4].body.BillingFrequency2', 'Monthly'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[5].method', 'POST'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[5].url', '/services/data/v57.0/sobjects/OrderItem'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[5].referenceId', 'refBronzeSLA'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[5].body.OrderId', '@{refOrder.id}'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[5].body.OrderActionId', '@{refOrderAction.id}'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[5].body.PricebookEntryId', '{{SLABronzeEvergrnMonthPBE}}'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[5].body.ServiceDate', '2023-01-01'
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'compositeRequest[5].body.Quantity', 3
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'compositeRequest[5].body.UnitPrice', 0
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'compositeRequest[5].body.NetUnitPrice', 0
    EXEC sp_OAMethod @json, 'UpdateInt', @success OUT, 'compositeRequest[5].body.TotalLineAmount', 0
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[5].body.PeriodBoundary', 'AlignToCalendar'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[5].body.BillingFrequency2', 'Monthly'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[6].method', 'POST'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[6].url', '/services/data/v57.0/sobjects/OrderItemRelationship'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[6].referenceId', 'refOrderItemRelationship1'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[6].body.ProductRelationshipTypeId', '{{BundleProductRelationshipType}}'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[6].body.MainOrderItemId', '@{refWorkAnywhereBundle.id}'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[6].body.AssociatedOrderItemId', '@{refVirtualRouter.id}'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[6].body.AssociatedOrderItemPricing', 'IncludedInBundlePrice'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[6].body.AssociatedQuantScaleMethod', 'Proportional'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[7].method', 'POST'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[7].url', '/services/data/v57.0/sobjects/OrderItemRelationship'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[7].referenceId', 'refOrderItemRelationship2'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[7].body.ProductRelationshipTypeId', '{{BundleProductRelationshipType}}'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[7].body.MainOrderItemId', '@{refWorkAnywhereBundle.id}'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[7].body.AssociatedOrderItemId', '@{refBronzeSLA.id}'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[7].body.AssociatedOrderItemPricing', 'IncludedInBundlePrice'
    EXEC sp_OAMethod @json, 'UpdateString', @success OUT, 'compositeRequest[7].body.AssociatedQuantScaleMethod', 'Constant'

    -- Adds the "Authorization: Bearer <access_token>" header.
    EXEC sp_OASetProperty @http, 'AuthToken', '<access_token>'

    DECLARE @resp int
    EXEC sp_OAMethod @http, 'PostJson3', @resp OUT, 'https://domain.com/services/data/v{{version}}/composite', 'application/json', @json
    EXEC sp_OAGetProperty @http, 'LastMethodSuccess', @iTmp0 OUT
    IF @iTmp0 = 0
      BEGIN
        EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @http
        EXEC @hr = sp_OADestroy @json
        RETURN
      END

    EXEC sp_OAGetProperty @resp, 'StatusCode', @iTmp0 OUT
    PRINT @iTmp0
    EXEC sp_OAGetProperty @resp, 'BodyStr', @sTmp0 OUT
    PRINT @sTmp0
    EXEC @hr = sp_OADestroy @resp


    EXEC @hr = sp_OADestroy @http
    EXEC @hr = sp_OADestroy @json


END
GO

Curl Command

curl -X POST
	-H "Authorization: Bearer <access_token>"
	-d '{
    "allOrNone": true,
    "compositeRequest": [
        {
            "method": "POST",
            "url": "/services/data/v57.0/sobjects/Order",
            "referenceId": "refOrder",
            "body": {
                "AccountId": "{{defaultAccount}}",
                "EffectiveDate": "2023-01-01",
                "Pricebook2Id": "{{standardPricebook}}",
                "BillToContactId": "{{defaultBillToContact}}",
                "Status": "Draft"
            }
        },
        {
            "method": "POST",
            "url": "/services/data/v57.0/sobjects/AppUsageAssignment",
            "referenceId": "refAppTag",
            "body": {
                "AppUsageType": "SubscriptionManagement",
                "RecordId": "@{refOrder.id}"
            }
        },
        {
            "method": "POST",
            "url": "/services/data/v57.0/sobjects/OrderAction",
            "referenceId": "refOrderAction",
            "body": {
                "OrderId": "@{refOrder.id}",
                "Type": "New Sale"
            }
        },
        {
            "method": "POST",
            "url": "/services/data/v57.0/sobjects/OrderItem",
            "referenceId": "refWorkAnywhereBundle",
            "body": {
                "OrderId": "@{refOrder.id}",
                "OrderActionId": "@{refOrderAction.id}",
                "PricebookEntryId": "{{WorkAnywhereBundlePBE}}",
                "ServiceDate": "2023-01-01",
                "Quantity": 1,
                "UnitPrice": 10000,
                "NetUnitPrice": 10000,
                "TotalLineAmount": 10000,
                "PeriodBoundary": "AlignToCalendar",
                "BillingFrequency2": "Monthly"
            }
        },
        {
            "method": "POST",
            "url": "/services/data/v57.0/sobjects/OrderItem",
            "referenceId": "refVirtualRouter",
            "body": {
                "OrderId": "@{refOrder.id}",
                "OrderActionId": "@{refOrderAction.id}",
                "PricebookEntryId": "{{VirtualRouterEvergrnPBE}}",
                "ServiceDate": "2023-01-01",
                "Quantity": 100,
                "UnitPrice": 0,
                "NetUnitPrice": 0,
                "TotalLineAmount": 0,
                "PeriodBoundary": "AlignToCalendar",
                "BillingFrequency2": "Monthly"
            }
        },
        {
            "method": "POST",
            "url": "/services/data/v57.0/sobjects/OrderItem",
            "referenceId": "refBronzeSLA",
            "body": {
                "OrderId": "@{refOrder.id}",
                "OrderActionId": "@{refOrderAction.id}",
                "PricebookEntryId": "{{SLABronzeEvergrnMonthPBE}}",
                "ServiceDate": "2023-01-01",
                "Quantity": 3,
                "UnitPrice": 0,
                "NetUnitPrice": 0,
                "TotalLineAmount": 0,
                "PeriodBoundary": "AlignToCalendar",
                "BillingFrequency2": "Monthly"
            }
        },
        {
            "method": "POST",
            "url": "/services/data/v57.0/sobjects/OrderItemRelationship",
            "referenceId": "refOrderItemRelationship1",
            "body": {
                "ProductRelationshipTypeId": "{{BundleProductRelationshipType}}",
                "MainOrderItemId": "@{refWorkAnywhereBundle.id}",
                "AssociatedOrderItemId": "@{refVirtualRouter.id}",
                "AssociatedOrderItemPricing": "IncludedInBundlePrice",
                "AssociatedQuantScaleMethod": "Proportional"
            }
        },
        {
            "method": "POST",
            "url": "/services/data/v57.0/sobjects/OrderItemRelationship",
            "referenceId": "refOrderItemRelationship2",
            "body": {
                "ProductRelationshipTypeId": "{{BundleProductRelationshipType}}",
                "MainOrderItemId": "@{refWorkAnywhereBundle.id}",
                "AssociatedOrderItemId": "@{refBronzeSLA.id}",
                "AssociatedOrderItemPricing": "IncludedInBundlePrice",
                "AssociatedQuantScaleMethod": "Constant"
            }
        }
    ]
}'
https://domain.com/services/data/v{{version}}/composite

Postman Collection Item JSON

{
  "name": "Create Order With Bundle",
  "request": {
    "method": "POST",
    "header": [
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n    \"allOrNone\": true,\n    \"compositeRequest\": [\n        {\n            \"method\": \"POST\",\n            \"url\": \"/services/data/v57.0/sobjects/Order\",\n            \"referenceId\": \"refOrder\",\n            \"body\": {\n                \"AccountId\": \"{{defaultAccount}}\",\n                \"EffectiveDate\": \"2023-01-01\",\n                \"Pricebook2Id\": \"{{standardPricebook}}\",\n                \"BillToContactId\": \"{{defaultBillToContact}}\",\n                \"Status\": \"Draft\"\n            }\n        },\n        {\n            \"method\": \"POST\",\n            \"url\": \"/services/data/v57.0/sobjects/AppUsageAssignment\",\n            \"referenceId\": \"refAppTag\",\n            \"body\": {\n                \"AppUsageType\": \"SubscriptionManagement\",\n                \"RecordId\": \"@{refOrder.id}\"\n            }\n        },\n        {\n            \"method\": \"POST\",\n            \"url\": \"/services/data/v57.0/sobjects/OrderAction\",\n            \"referenceId\": \"refOrderAction\",\n            \"body\": {\n                \"OrderId\": \"@{refOrder.id}\",\n                \"Type\": \"New Sale\"\n            }\n        },\n        {\n            \"method\": \"POST\",\n            \"url\": \"/services/data/v57.0/sobjects/OrderItem\",\n            \"referenceId\": \"refWorkAnywhereBundle\",\n            \"body\": {\n                \"OrderId\": \"@{refOrder.id}\",\n                \"OrderActionId\": \"@{refOrderAction.id}\",\n                \"PricebookEntryId\": \"{{WorkAnywhereBundlePBE}}\",\n                \"ServiceDate\": \"2023-01-01\",\n                \"Quantity\": 1,\n                \"UnitPrice\": 10000,\n                \"NetUnitPrice\": 10000,\n                \"TotalLineAmount\": 10000,\n                \"PeriodBoundary\": \"AlignToCalendar\",\n                \"BillingFrequency2\": \"Monthly\"\n            }\n        },\n        {\n            \"method\": \"POST\",\n            \"url\": \"/services/data/v57.0/sobjects/OrderItem\",\n            \"referenceId\": \"refVirtualRouter\",\n            \"body\": {\n                \"OrderId\": \"@{refOrder.id}\",\n                \"OrderActionId\": \"@{refOrderAction.id}\",\n                \"PricebookEntryId\": \"{{VirtualRouterEvergrnPBE}}\",\n                \"ServiceDate\": \"2023-01-01\",\n                \"Quantity\": 100,\n                \"UnitPrice\": 0,\n                \"NetUnitPrice\": 0,\n                \"TotalLineAmount\": 0,\n                \"PeriodBoundary\": \"AlignToCalendar\",\n                \"BillingFrequency2\": \"Monthly\"\n            }\n        },\n        {\n            \"method\": \"POST\",\n            \"url\": \"/services/data/v57.0/sobjects/OrderItem\",\n            \"referenceId\": \"refBronzeSLA\",\n            \"body\": {\n                \"OrderId\": \"@{refOrder.id}\",\n                \"OrderActionId\": \"@{refOrderAction.id}\",\n                \"PricebookEntryId\": \"{{SLABronzeEvergrnMonthPBE}}\",\n                \"ServiceDate\": \"2023-01-01\",\n                \"Quantity\": 3,\n                \"UnitPrice\": 0,\n                \"NetUnitPrice\": 0,\n                \"TotalLineAmount\": 0,\n                \"PeriodBoundary\": \"AlignToCalendar\",\n                \"BillingFrequency2\": \"Monthly\"\n            }\n        },\n        {\n            \"method\": \"POST\",\n            \"url\": \"/services/data/v57.0/sobjects/OrderItemRelationship\",\n            \"referenceId\": \"refOrderItemRelationship1\",\n            \"body\": {\n                \"ProductRelationshipTypeId\": \"{{BundleProductRelationshipType}}\",\n                \"MainOrderItemId\": \"@{refWorkAnywhereBundle.id}\",\n                \"AssociatedOrderItemId\": \"@{refVirtualRouter.id}\",\n                \"AssociatedOrderItemPricing\": \"IncludedInBundlePrice\",\n                \"AssociatedQuantScaleMethod\": \"Proportional\"\n            }\n        },\n        {\n            \"method\": \"POST\",\n            \"url\": \"/services/data/v57.0/sobjects/OrderItemRelationship\",\n            \"referenceId\": \"refOrderItemRelationship2\",\n            \"body\": {\n                \"ProductRelationshipTypeId\": \"{{BundleProductRelationshipType}}\",\n                \"MainOrderItemId\": \"@{refWorkAnywhereBundle.id}\",\n                \"AssociatedOrderItemId\": \"@{refBronzeSLA.id}\",\n                \"AssociatedOrderItemPricing\": \"IncludedInBundlePrice\",\n                \"AssociatedQuantScaleMethod\": \"Constant\"\n            }\n        }\n    ]\n}\n",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "{{_endpoint}}/services/data/v{{version}}/composite",
      "host": [
        "{{_endpoint}}"
      ],
      "path": [
        "services",
        "data",
        "v{{version}}",
        "composite"
      ]
    },
    "description": "Creates a Subscription Management order for a product bundle."
  },
  "response": [
  ]
}