Loading
Salesforce now sends email only from verified domains. Read More
Help Agent Performance DegradationRead More
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Create Orders and Related Records

          Create Orders and Related Records

          Use the composite API to create multiple Order records and related records, including App Usage Assignment, Order Action, Order Item, Order Item Relationship records.

          Resource
          https://yourInstance.salesforce.com/services/data/vXX.X/composite
          JSON Request Sample

          This sample request demonstrates how to create orders.

          {
            "allOrNone": true,
            "compositeRequest": [
              {
                "method": "POST",
                "url": "/services/data/vXX.X/sobjects/Order",
                "referenceId": "refOrder",
                "body": {
                  "AccountId": "{{accountId}}",
                  "EffectiveDate": "{{currentDate}}",
                  "Pricebook2Id": "{{standardPricebookId}}",
                  "BillToContactId": "{{contactId}}",
                  "Status": "Draft"
                }
              },
              {
                "method": "POST",
                "url": "/services/data/vXX.X/sobjects/AppUsageAssignment",
                "referenceId": "refAppTag",
                "body": {
                  "AppUsageType": "RevenueLifecycleManagement",
                  "RecordId": "@{refOrder.id}"
                }
              },
              {
                "method": "POST",
                "url": "/services/data/vXX.X/sobjects/OrderAction",
                "referenceId": "refOrderAction",
                "body": {
                  "OrderId": "@{refOrder.id}",
                  "Type": "New Sale"
                }
              },
              {
                "method": "POST",
                "url": "/services/data/vXX.X/sobjects/OrderItem",
                "referenceId": "refOrderItem1",
                "body": {
                  "OrderId": "@{refOrder.id}",
                  "OrderActionId": "@{refOrderAction.id}",
                  "PricebookEntryId": "{{priceBookEntryId1}}",
                  "ServiceDate": "{{currentDate}}",
                  "EndDate": "{{futureDate}}",
                  "PricingTermCount": 12,
                  "Quantity": 10,
                  "UnitPrice": 100,
                  "NetUnitPrice": 100,
                  "TotalLineAmount": 12000,
                  "PeriodBoundary": "AlignToCalendar",
                  "BillingFrequency2": "Monthly"
                }
              },
              {
                "method": "POST",
                "url": "/services/data/vXX.X/sobjects/OrderItem",
                "referenceId": "refOrderItem2",
                "body": {
                  "OrderId": "@{refOrder.id}",
                  "OrderActionId": "@{refOrderAction.id}",
                  "PricebookEntryId": "{{priceBookEntryId2}}",
                  "ServiceDate": "{{currentDate1}}",
                  "EndDate": "{{futureDate}}",
                  "PricingTermCount": 11,
                  "Quantity": 5,
                  "UnitPrice": 100,
                  "NetUnitPrice": 100,
                  "TotalLineAmount": 5500,
                  "PeriodBoundary": "AlignToCalendar",
                  "BillingFrequency2": "Monthly"
                }
              },
              {
                "method": "POST",
                "url": "/services/data/vXX.X/sobjects/OrderItemRelationship",
                "referenceId": "refOrderItemRelationship1",
                "body": {
                  "MainOrderItemId": "@{refOrderItem1.id}",
                  "AssociatedOrderItemId": "@{refOrderItem2.id}",
                  "AssociatedOrderItemPricing": "NotIncludedInBundlePrice",
                  "ProductRelationshipTypeId": "{{productRelationshipType}}"
                }
              }
            ]
          }

          Considerations

          Keep these considerations in mind when creating historical orders.

          • You can backdate only initial-sale orders.
          • You can’t backdate amendments, renewals, and cancellations.
          • When migrating numerical fields, having 0 or null as the field value is an important distinction. When you amend an asset corresponding to an order, the field values 0 and null are treated differently. If the field value is null but the system sets the value to 0, this could be treated as a field amendment and trigger certain behavior.

          Make sure that you migrate these records and fields.

          App Usage Assignment Records

          An App Usage Assignment record differentiates Revenue Management orders from other types of Salesforce orders. It also makes sure that orders link to the related order actions and order items.

          Each Asset record requires an App Usage Assignment record.

          App Usage Assignment Field Requirement
          AppUsageType Specify RevenueLifecycleManagement.

          See AppUsageAssignment.

          Order Records

          Orders from previous actions and initial-sale are used as a reference to create orders by using ARC APIs.

          Order Field Requirement
          AccountId The initial-sale order created by composite APIs needs an AccountId and it should be the same as the AccountId of the related asset.
          BillToContactId The BillToContactId should be the same as the ContactId of the related asset.
          EffectiveDate

          The EffectiveDate must be the same as the LifecycleStartDate of the related asset and in the HH:MM:SS format.

          The EffectiveDate value need not be 00:00:00.

          Pricebook2Id The Pricebook2Id shouldn't be null and should be related to the product and price book entry.

          See Order.

          Order Action Records

          Every Asset Action record should have a related Order Action record.

          Order Action Field Requirement
          SourceAssetId The SourceAssetId can’t be null for amendment, renewal, and cancellation orders.
          Type The Type should be the same as the type of the AssetAction.

          See OrderAction.

          Order Item Records

          These Order Item values are required.

          Order Item Field Requirement
          BillingFrequency2 Specify a value matching with the product selling model, and the evergreen, termed, or one-time asset.
          EndDate Specify the end date of the asset in the Date only format. The EndDate can't be null.
          PeriodBoundary Specify the same value as the PeriodBoundary of the product selling model, and the evergreen, termed, or one-time asset.
          PricebookEntryId

          Create a pricebook entry from the relevant product and product selling model, and specify it.

          The ARC API request fails if the combination of pricebook, product, and product selling model for an order item is inaccurate.

          PricingTermCount The length of asset subscription for a termed asset.
          ServiceDate The start date of the asset is in the Date only format. If it’s not provided, the effective date of the related order is used.
          TotalLineAmount

          The TotalLineAmount is calculated by multiplying the quantity by the pricing term count and the unit price.

          The TotalLineAmount value reflects the TotalLifecycleAmount of the asset.

          See OrderItem.

          Order Relationship Records

          Order Relationship Field Requirement
          AssociatedOrderItemPricing Specify the pricing type.
          ProductRelationshipTypeId The unique identifier of the record that describes the relationship between the main and associated order products.

          See OrderItemRelationship.

          To understand the impact of creating orders on your event credit consumption, see Revenue Management Billable Usage Types.

           
          Loading
          Salesforce Help | Article