cloneRecord()

Overview

public string function cloneRecord(
      required string  objectName   
    , required string  recordId     
    , required struct  data         
    ,          string  newRecordId   = ""
    ,          boolean isDraft       = false
    ,          numeric versionNumber
    ,          array   bypassTenants
)

Clones a record for the given object, record ID and supporting data

Arguments

NameTypeRequiredDescription
objectNamestringYesName of the object whose record you wish to clone
recordIdstringYesID of the record to clone
datastructYesData to overwrite any data for the existing record
newRecordIdstringNo (default="")Used to specify an ID to use for the new record
isDraftbooleanNo (default=false)Whether or not the clone is to be a draft record
versionNumbernumericNoSpecific version number to use when versioning the new record
bypassTenantsarrayNoArray of tenants to ignore when cloning (i.e. when cloning into an alternative tenant to the currently active one)