Whatever message this page gives is out now! Go check it out!

BatchWriteItem

Last update:
May 18, 2026

Description

This function inserts or removes one or more items into one or multiple tables.
For more information, see BatchWriteItem.

Category

History

ColdFusion (2021 release): Added this function.

Syntax

serviceHandle.batchWriteItem(requestParameters)

Parameters

See the request parameters of BatchWriteItem.

Example

<cfscript> 
 cred = { 
    "credentialAlias" : "myalias", 
    "vendorName" : "AWS", 
    "region" : "us-east-2", 
    "secretAccessKey" : "xxxxx", 
    "accessKeyId" : "xxxx" 
  } 
  conf={ 
    "serviceName"="DYNAMODB" 
  } 
 
  dynamo=getCloudService(cred, conf) 
  tableName="batchWriteMovie" 
 
 // put multiple items in table 
 batchWriteItemStruct={ 
   "RequestItems":{ 
      "#tableName#":[ 
        { 
          "PutRequest":{ 
            "Item":{ 
              "year": {"N": 2018}, 
              "title": {"S": "Solo"} 
            } 
          } 
        }, 
        { 
          "PutRequest":{ 
            "Item":{ 
              "year":{"N":2018}, 
              "title":{"S":"Aquaman"} 
            } 
          } 
        }, 
        { 
          "PutRequest":{ 
            "Item":{ 
              "year":{"N":2018}, 
              "title":{"S":"Hereditary"} 
            } 
          } 
        } 
      ] 
   } 
 } 
 try{ 
  batchWriteItemResponse=dynamo.batchWriteItem(batchWriteItemStruct,{"hasType":true}) 
  writeOutput("Write item operation successful") 
  writeDump(batchWriteItemResponse) 
 } 
 catch(any e){ 
  writeDump(e) 
 } 
</cfscript>

Output

Figure: BatchWriteItem output
BatchWriteItem output

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page