insertData()

Overview

public any function insertData(
      required string  objectName             
    , required struct  data                   
    ,          boolean insertManyToManyRecords = false
    ,          boolean isDraft                 = false
    ,          boolean useVersioning           = automatic
    ,          numeric versionNumber           = 0
    ,          array   bypassTenants          
)

Inserts a record into the database, returning the ID of the newly created record

Arguments

NameTypeRequiredDescription
objectNamestringYesName of the object in which to to insert a record
datastructYesStructure of data whose keys map to the properties that are defined on the object
insertManyToManyRecordsbooleanNo (default=false)Whether or not to insert multiple relationship records for properties that have a many-to-many relationship
isDraftbooleanNo (default=false)Whether or not to save the record as a draft record
useVersioningbooleanNo (default=automatic)Whether or not to use the versioning system with the insert. If the object is setup to use versioning (default), this will default to true.
versionNumbernumericNo (default=0)If using versioning, specify a version number to save against (if none specified, one will be created automatically)
bypassTenantsarrayNoArray of tenants to ignore (i.e. when the insert data wants to create a record in an alternative tenant to the current one)

Example:

newId = presideObjectService.insertData(
          objectName = "event"
        , data       = { name="Summer BBQ", startdate="2015-08-23", enddate="2015-08-23" }
);