Toggle menu

CSObjectMultiple

The CSObjectMultiple class handles the querying of several iCM objects.

The CSObjectMultiple class includes methods for the retrieval, update and removal of several objects. All such methods require that certain database and key information (ObjectList for example) be specified via the properties provided, prior to their invocation.

iCM Objects are identified either by their unique ID or their Type and Label used in combination.

The ability to search object data for specific information is also handled by this class. Values of all elements that have been flagged as searchable within the Object Types section of iCM Management can be searched using this class.

All database access/connectivity is handled internally by the CSObjectMultiple class. 

For a general overview of iCM objects, see Object Types.

Methods

Parameters must use the get-set structure described in the introduction - Java API (CSObjects).

  • get a string (comma separated) that lists the properties whose values should be returned, an asterisk to indicate that all properties should be returned, or an empty string to return nothing
  • set the properties which should be set before the specified method is performed

CSObjectMultiple_delete

Deletes the set objects from the database.

Request Parameters

NameTypeDescription
getStringSet as an empty string
set.ObjectListStringOptional. A comma separated list of Object IDs to delete
set.LabelListStringOptional. A comma separated list of Object Labels. Set LabelList and Type to delete these objects
set.TypeStringSet Type on its own to delete all objects of that type from the database. Can be used in combination with LabelList or on its own

{
    "get": "",
    "set": {
        "ObjectList": "1,2,3",
        "LabelList": "label1,label2,label3",
        "Type": "MYOBJECT"
    }
}

Response

NameTypeDescription
data.multipleItemDataArrayThe empty object structures. Will include the deleted ID if requested
data.itemDataObjectThe properties of the request, if present

{
    "id": 13,
    "result": {
        "data": {
            "multipleItemData": [{}, {}],
            "itemData": {}
        },
        "success": true
    },
    "jsonrpc": "2.0"
}

Example

Request:

function(params, credentials) {
    var object = this.callWorkerMethod("icmapi", "CSObjectMultiple_delete", {
        "get": "",
        "set": {
            "ObjectList": "20079,20080,20081"
        }
    });
    return object;
}

CSObjectMultiple_exist

Checks to see whether iCM objects exist in the database.

Request Parameters

NameTypeDescription
getStringSet as an empty string
set.ObjectListStringOptional. A comma separated list of Object IDs
set.LabelListStringOptional. Required if Type is used
set.TypeStringOptional.  Required if LabelList is used

{
    "get": "",
    "set": {
        "ObjectList": "1,2,3",
        "LabelList": "label1,label2,label3",
        "Type": "MYOBJECT"
    }
}

Response

NameTypeDescription
data.MultipleItemDataArrayThe properties of the request, if present
data.returnValueBooleanTrue if all of the objects exist. False if any one of the listed objects does not exist

{
    "id": 33,
    "result": {
        "data": {
            "multipleItemData": [{}, {}, {}],
            "returnValue": true,
            "itemData": {}
        },
        "success": true
    },
    "jsonrpc": "2.0"
}

Example

Request:

Note the use of rawMode: true when working with this.callWorkerMethod so that the full response can be seen, not just the multipleItemData array.

function(params, credentials) {
    var object = this.callWorkerMethod("icmapi", "CSObjectMultiple_exist", {
        "get": "",
        "set": {
            "ObjectList": "20087,20088,20089"
        }
    }, {
        "rawMode": true
    });
    return object;
}

Response:

{
    "id": 33,
    "result": {
        "data": {
            "multipleItemData": [{}, {}, {}],
            "returnValue": false,
            "itemData": {}
        },
        "success": true
    },
    "jsonrpc": "2.0"
}

CSObjectMultiple_get

Retrieves the details of several iCM objects from the database. The amount of information returned is set by the DetailLevel property.

Request Parameters

NameTypeDescription
getStringA comma separated list of properties to return
set.DateActionIntegerOptional. Both StartDate and EndDate must be set.
1- CREATED. Objects created between the two dates
2 - LAST_UPDATED. Objects last updated between the two dates
1|2 - Objects created or updated between the two dates
set.DetailLevelIntegerOptional. The detail level, default: 4
set.EndDateDateTimeOptional. Used with DateAction
set.ObjectListStringOptional. A comma separated list of Object IDs. The retrieved objects will be returned in the order that their IDs appear within the list 
set.LabelListStringOptional, used with Type. A comma separated list of Object Labels
set.MaxRowsIntegerOptional. The maximum number to return
set.SortOrderStringOptional. Used with Type when returning all objects of a type, see below
setStartDateDateTimeOptional. Used with DateAction
set.StartRowIntegerOptional. The row to start from
set.TypeStringOptional. Set Type on its own to return the details of all objects of the specified type. By default, the objects will be retrieved in descending creation date. This can be overridden using the SortOrder property. The StartRow and MaxRows properties can be used to restrict the number of objects that are retrieved
set.UseSearchablesBooleanOptional. Rather than specifiying Types, Labels or Object IDs you can search for objects. See below

{
    "get":"",
    "set":{
        "DetailLevel": 2,
        "ObjectList": "1,2,3",
        "LabelList": "label1,label2,label3",
        "MaxRows": 3,
        "SortOrder": "DATETIMECREATED ASC",
        "StartRow": 5,
        "Type": "MYOBJECT"
        "UseSearchables": false,
        "DateAction": 1,
        "StartDate": "2022-10-28T09:30:00Z",
        "EndDate": "2022-10-28T10:30:00Z"
    }
}

Response

NameTypeDescription
data.MultipleItemDataArrayAn array of CSObjects containing the properties of the get request

"result": {
    "data": {
        "multipleItemData": [{},{},{}],
        "itemData": {
            "_ItemClass": "CSObjectMultiple"
        }
    },
    "success": true
}

Example

Request:

function(params, credentials) {
    var object = this.callWorkerMethod("icmapi", "CSObjectMultiple_get", {
        "get": "ObjectData,ObjectID",
        "set": {
            "Type": "EXAMPLEHOUSE",
            "DateAction": 1,
            "StartDate": "2022-10-28T09:30:00Z",
            "EndDate": "2022-10-28T10:30:00Z"
        }
    });
    return object;
}

Response:

{
    "id": 82,
    "result": [{
        "_ItemClass": "CSObject",
        "ObjectID": 20092,
        "ObjectData": {
            "NUMBER": 1,
            "ROAD": "Darklake View"
        }
    }, {
        "_ItemClass": "CSObject",
        "ObjectID": 20091,
        "ObjectData": {
            "NUMBER": 2,
            "ROAD": "Darklake View"
        }
    }, {
        "_ItemClass": "CSObject",
        "ObjectID": 20090,
        "ObjectData": {
            "NUMBER": 3,
            "ROAD": "Darklake View"
        }
    }, {
        "_ItemClass": "CSObject",
        "ObjectID": 20083,
        "ObjectData": {
            "NUMBER": 4,
            "ROAD": "Darklake View"
        }
    }, {
        "_ItemClass": "CSObject",
        "ObjectID": 20082,
        "ObjectData": {
            "NUMBER": 5,
            "ROAD": "Darklake View"
        }
    }],
    "jsonrpc": "2.0"
}

CSObjectMultiple_update

Update is used to update existing, or create new, objects of a defined type. To update existing objects either the ObjectID or Type and Label must be supplied.

To create new objects the Type must already exist and a new unique Label should be supplied for each.

Request Parameters

NameTypeDescription
getStringA comma separated list of properties to return
set.itemDataObject, requiredHolds the properties of the CSObjectMultiple class itself, can be left empty
set.multipleItemDataArray of objectsAn array of objects each of which contains the details of the objects to update or create. See update in CSObject

{
    "get": "",
    "set": {
        "itemData": {},
        "multipleItemData": [{
            "Label": generateUUID(),
            "Type": "ANOTHERTYPE",
            "ObjectData": {
                "ANOTHERPROPERTY": "Tim"
            }
        }, {
            "Label": generateUUID(),
            "Type": "ANOTHERTYPE",
            "ObjectData": {
                "ANOTHERPROPERTY": "Tim"
            }
        }]
    }
}

Properties

PropertyTypeDescription
DateActionIntegerThe type of objects that are of interest when the StartDate and EndDate properties are used. Both StartDate and EndDate must be set.
1- CREATED. Objects created between the two dates
2 - LAST_UPDATED. Objects last updated between the two dates
1|2 - Objects created or updated between the two dates
DetailLevelIntegerThe level of detail returned. Either:
1 - ID. Just the Object ID
2 - SUMMARY. The ID, Type and Label
3 - DETAIL. The ID, Type, Label, DateCreated, DateLastUpdated, CreatedBy and LastUpdatedBy
4 - ALL. Everything, including the object's data

Default: 4. We recommend setting the detail level to something other than 4 if the data is not needed to improve performance
EndDateDateTimeUsed with DateAction. Objects changed/updated/created before this date (inclusive) will be retrieved, for example "2018-01-12T10:29:59Z"
LabelGreaterThanStringA string which the label should be greater than. Used with Type or UseSearchables
LabelGreaterThanOrEqualsStringA string which the label should be greater than or equal to. Used with Type or UseSearchables
LabelLessThanStringA string which the label should be less than. Used with Type or UseSearchables
LabelLessThanOrEqualsStringA string which the label should be less than or equal to. Used with Type or UseSearchables
LabelLikeStringA pattern which the label should match according to the SQL LIKE operator. Used with Type or UseSearchables
LabelListStringA comma separated list of object labels. Used with Type
LogicStringOnly relevant when UseSearchables is true. Compares the contents of the element specified via Var with the value specified via Value. See below
ObjectListStringA comma separated list of object IDs.
SolrURLStringThe Solr URL. Must be supplied when UseSearchables is set to true
SortOrderStringA comma separated list of sort orders. 

Available sort orders when not in search mode (UseSearchables set to false) are:
OBJECTID - Order by ObjectID
IDTYPE - Order by Object Type name
LABEL - Order by Label 
DATETIMECREATED - Order by time created
DATETIMELASTUPDATED - Order by last updated time
Use ASC or DESC to indicate the direction of ordering, eg "OBJECTID DESC"

Available sort orders when in search mode (UseSearchables set to true) are:
ASC
DESC
Where the ordering is the value that's being searched on
StartDateDateTimeUsed with DateAction. Objects changed/updated/created after this date (inclusive) will be retrieved, for example "2018-01-12T10:29:59Z"
TolerateNotFoundBooleanBy default, if a requested object is not found a CSNotFoundException will be raised. Set the TolerateNotFound property to true to prevent these exceptions from being generated
TypeStringThe type of this object
UpdateDataBooleanDefault: false. If true, any new properties that have been added to the type definition since this object was created will be added to the ObjectData when it is retrieved. ObjectData saved in the database will be unaffected until an update call is performed following the retrieval of the UpdateData
UserIntegerThe UserID that the CreatedBy/LastUpdatedBy property of retrieved objects should match
UserActionIntegerThe type of changes that are of interest when either of the User or Username properties are used. Either:
1- CREATED
2 - LAST_UPDATED
1|2 - Objects created or updated
UsernameStringThe Username that the CreatedBy/LastUpdatedBy property of retrieved objects should match
UserProfileTypeStringDefault: USERPROFILE. Gets/sets the object type that is used to store user profile information. The type is used to identify insert/update/delete of user profile objects so that, for example, the appropriate gateway messages can be triggered to ensure the site user search index is kept up to date
UseSearchablesBooleanSet UseSearchables to true in order to retrieve the details of all objects whose searchable elements matches the criteria specified via the Var, Value and Logic properties. Note that this property can only be used with get. See below
ValueStringThe value that is to be used as the only or lower range setting in a search operation. See below
Value2StringThe value that is to be used as the second (upper) filter value in a LOGIC_BETWEEN search operation. See below
VarStringThe fully qualified name of the object property you would like to search, for example BILLTO.ELECTRONICINFO.EMAIL. See below
VarSubtypeStringThe VarSubtype property (together with the VarType property) may be used in place of or in addition to the Type property. See below
VarTypeStringThe VarType property may be used in place of or in addition to the Type property. When used in addition to Type property it removes the need to load the data type definition in order to ascertain the data type from the original object type definition. See below

Comparing Labels

Object labels are strings. When comparing labels using the LableGreaterThan and LabelLessThan properties, they are compared lexicographically (ie using alphabetical ordering).

Assume objects exist with the labels "MyNewerLabel", "MyNewLabel" and "MyNewLabels".

"MyNewLabels" is greater than "MyNewLabel" because it comes after it alphabetically. "MyNewerLabel" is less than "MyNewLabel" because it comes before it alphabetically.

UseSearchables

The properties within an Object Type Definition can be set as searchable. If true the values of those properties are indexed by the iCM search provider and can be queried using the UseSearchables property. UseSearchables can only be used with get.

When using UseSearchables, SolrURL, Logic, Var and Value are required. Either Type (the object type within which to search) or VarType are also required.

VarType is one of CHAR, LONGCHAR, INTEGER, NUMERIC or DATETIME.

Logic

The logic operators when using UseSearchables are:

OperatorDescription
=Equals. Will find matches if the contents of the Var property is equal to the value of the Value property
<Less than. Will find matches if the contents of the Var property is deemed to be less than the value of the Value property
<=Less than or equal. Will find matches if the contents of the Var property is deemed to be less than or equal to the value of the Value property
>Greater than. Will find matches if the contents of the Var property is deemed to be greater than the value of the Value property
>=Greater than or equal. Will find matches if the contents of the Var property is deemed to be greater than or equal to the value of the Value property
LIKECompares the contents of the Var property to the value of the Value property. Wildcards can be inserted using %
BETWEENWill find a match of all items between the Value and Value2 properties
CONTAINSWill find a match if the contents of the element specified via the Var property contains the value specified via the Value and Value2 properties
FUZZYWill find a match if the contents of the element specified via the Var property are deemed to be approximately equal to the value specified via the Value property

Example

In this example, the search is restricted to objects of the EXAMPLEHOUSE type. We are looking for all objects that have a value of "Darklake View" in their ROAD property.

function(params, credentials) {
    var object = this.callWorkerMethod("icmapi", "CSObjectMultiple_get", {
        "get": "ObjectData,ObjectID",
        "set": {
            "UseSearchables": true,
            "SolrURL": "http://localhost:5506/solricm",
            "Logic": "=",
            "Type": "EXAMPLEHOUSE",
            "Var": "ROAD",
            "Value": "Darklake View"
        }
    });
    return object;
}

Last modified on 30 April 2024

Share this page

Facebook icon Twitter icon email icon

Print

print icon