Loading
Quote Creation Issue - Non-USD CurrenciesRead More
Important Advisory: iOS Update Impacting CG Mobile ApplicationRead More
Communications Cloud
Convert Assets to a Quote in Batch Invocable Action

Convert Assets to a Quote in Batch Invocable Action

Use b2bCmexAssetToQuoteInBatch invocable action to convert assets to quote line items and create associated quote members in an asynchronous, two-stage batch process.

Required Editions

Available in: Lightning Experience
Available in: Enterprise, Unlimited, and Developer Editions

Available from the Salesforce REST Actions API, Flow Builder, and OmniStudio in API version 68.0 and later, this action starts the Asset-to-Quote pipeline. The first stage converts assets to quote line items, and the second stage creates quote members. The action immediately returns a batch job ID.

Note
Note To configure this invocable action as an Agentic action in Agentforce, use wrappers for both input and output payload transformation. You can create the wrappers in Apex or in Flow.

Input Values

Parameter Required Description Data Type
quoteId Yes The ID of the enterprise quote to add assets to. String
accountId Yes The ID of the account that owns the assets. String
assets Yes A JSON array of asset objects. Each object has an Id and can include a products array with attribute configurations. String (JSON array)
accountToQuoteMemberFieldMap Yes A JSON object that maps the fields in the asset's service account to Quote Member fields. String (JSON object)
atqBatchSize No The number of assets processed per batch in the asset conversion stage. The default value is 3. Integer
createQmBatchSize No The number of assets processed per batch in the quote member creation stage. The default value is 100. Integer
checkAsyncJobStatus No A Boolean value that indicates whether to prevent submission when another asynchronous job is running for the quote. The default value is true. Set the value to false to intentionally chain the job after other asynchronous work. Boolean

Output Values

Parameter Description Data Type
batchJobId The ID of the submitted batch job. String
successMessage A message that confirms the job was submitted. String
error An error message if the job couldn't be submitted. String

Usage

Use this action to convert account assets to quote line items and create quote members in batch.

Map Account fields to Quote Member fields with accountToQuoteMemberFieldMap. You can include products and attribute configurations in each asset object.

Poll the AsyncApexJob record by using batchJobId to monitor processing.

Considerations

  • The action supports asynchronous processing only.
  • The assets and accountToQuoteMemberFieldMap inputs are sent as JSON-encoded strings when the REST Actions API is used.
  • By default, the action doesn't submit a job if another asynchronous job is running for the quote.
  • The pipeline uses separate batch sizes for asset conversion and quote member creation.
  • Business and validation failures are returned in outputValues.error.

Example Input

{
    "quoteId": "0Q0Hs000001AbcDEFG",
    "accountId": "001Hs00003AE5DfIAL",
    "assets": [
        {
            "Id": "02iHs0000001rootA",
            "products": [
                {
                    "productId": "01tHs000001ROOTpc",
                    "attributes": [
                        {
                            "attributeCode": "BANDWIDTH",
                            "value": "1Gbps"
                        },
                        {
                            "attributeCode": "TERM_MONTHS",
                            "value": 24
                        }
                    ]
                },
                {
                    "productId": "01tHs000001CHILDa",
                    "attributes": [
                        {
                            "attributeCode": "PORT_SPEED",
                            "value": "10G"
                        },
                        {
                            "attributeCode": "MEDIA_TYPE",
                            "value": "Fiber"
                        }
                    ]
                },
                {
                    "productId": "01tHs000001CHILDb",
                    "attributes": [
                        {
                            "attributeCode": "STATIC_IP_COUNT",
                            "value": 8
                        }
                    ]
                }
            ]
        },
        {
            "Id": "02iHs0000002rootB",
            "products": [
                {
                    "productId": "01tHs000001ROOTpc",
                    "attributes": [
                        {
                            "attributeCode": "BANDWIDTH",
                            "value": "500Mbps"
                        }
                    ]
                }
            ]
        }
    ],
    "accountToQuoteMemberFieldMap": {
        "Id": "vlocity_cmt__ServiceAccountId__c",
        "Name": "Name",
        "vlocity_cmt__BillingEmailAddress__c": "vlocity_cmt__Email__c",
        "ShippingCity": "vlocity_cmt__City__c",
        "ShippingCountry": "vlocity_cmt__Country__c",
        "ShippingPostalCode": "vlocity_cmt__PostalCode__c",
        "ShippingState": "vlocity_cmt__State__c",
        "ShippingStreet": "vlocity_cmt__StreetAddress__c"
    },
    "atqBatchSize": 5,
    "createQmBatchSize": 100,
    "checkAsyncJobStatus": false
}

Example Output

[
  {
    "actionName": "vlocity_cmt__B2BCmexAssetToQuoteInBatchInvocable",
    "isSuccess": true,
    "errors": null,
    "outputValues": {
      "batchJobId": "707XXXXXXXXXXXXXXX",
      "successMessage": "Asset-to-Quote batch job has been submitted. Job Id: <jobId>",
      "error": null
    }
  }
]

Error Handling

Check outputValues.error to determine whether the request was submitted. Business and validation failures don't populate the Actions API errors array.

The action returns an error when quoteId, accountId, assets, or accountToQuoteMemberFieldMap isn't specified.

If another job is running and checkAsyncJobStatus is true, the action can return:

An asynchronous job is running for this quote. Wait for it to finish, and then try again.
 
Loading
Salesforce Help | Article