iCM Objects are identified either by a unique ObjectID or the combination of their Type and Label.
ObjectID, Type and Label must be supplied as parameters in attributes.ObjectArray. When updating an existing object you will need to know the values of all three of these attributes. When creating new objects, you will need to set the Type and supply a new unique value for the Label. The ObjectID should be an empty string (this is different to other create modules where an ID of 0 is often used).
An object type must already be defined in iCM before objects of that type can be created.
iCM_obj_objectUpdateMultiple also requires a ReturnArray parameter to be supplied in the attributes.ObjectArray. This can be any string you choose.
Properties
Name | Type | Description |
---|---|---|
ObjectArray | Array | An array of object structures, each containing the following |
ObjectArray.ObjectID | Integer or empty string, Required | Provide the ObjectID when updating an existing object or empty string to create a new object |
ObjectArray.Type | String, Required | The type of the object to update or create |
ObjectArray.Label | String, Required | The label of the object to update or a new unique label |
ObjectArray.ObjectData | Object, Required | The object data, as defined in the object's type definition |
ReturnArray | String, Required | A name for the array in which information will be returned |
Returns
If the request was successful the result data object will contain an object called CONTENT which includes the ObjectID, Type and Label and another called STATE which indicates the object was created/updated successfully.
Example 1 - Updating Objects
In this example two existing objects are being updated. The current values of ObjectID, Label and Type are provided for each. Each object's single property, EXAMPLEPROPERTY, is given a new value.
Request
function(params, credentials) {
let createObjects = this.callWorkerMethod("icmapi", "iCM_obj_objectUpdateMultiple", {
"attributes": {
"ObjectArray": [{
"ObjectID": 244,
"Label": "608756846-0590001029",
"Type": "EXAMPLETYPE",
"ObjectData": {
"EXAMPLEPROPERTY": "My new value"
}
},{
"ObjectID": 246,
"Label": "456156156-0090801064",
"Type": "EXAMPLETYPE",
"ObjectData": {
"EXAMPLEPROPERTY": "Some other new value"
}
}],
"ReturnArray": "ReturnArray"
}
});
return createObjects;
}
Example 2 - Creating Objects
In this example two new objects are created. The type is EXAMPLE and it has two properties, FIRSTNAME and LASTNAME, which hold the values we're storing.
Note how the ObjectID is supplied as an empty string and we're using this.invokeEP to call another End Point which has been written to generate unique values for our Label.
Request
function(params, credentials) {
let createObjects = this.callWorkerMethod("icmapi", "iCM_obj_objectUpdateMultiple", {
"attributes": {
"ObjectArray": [{
"ObjectID": "",
"Label": this.invokeEP( "goss.solutions.api.utils.createUUID", {}).uuid,
"Type": "EXAMPLE",
"ObjectData": {
"FIRSTNAME": "Tim",
"LASTNAME": "G"
}
},{
"ObjectID": "",
"Label": this.invokeEP("goss.solutions.api.utils.createUUID", {}).uuid,
"Type": "EXAMPLE",
"ObjectData": {
"FIRSTNAME": "Tom",
"LASTNAME": "A"
}
}],
"ReturnArray": "ReturnArray"
}
});
return createObjects;
}
Response
{
"id": 87,
"result": [{
"CONTENT": {
"ObjectID": 14411,
"Type": "EXAMPLE",
"Action": "Insert",
"Label": "C0FB686D-1F9E-49C6-A022-07F921817EEE"
},
"STATE": {
"Status": "ACCESS GRANTED"
}
}, {
"CONTENT": {
"ObjectID": 14412,
"Type": "EXAMPLE",
"Action": "Insert",
"Label": "6CDDEF3B-17DE-4089-8250-80A8B7115A23"
},
"STATE": {
"Status": "ACCESS GRANTED"
}
}],
"jsonrpc": "2.0"
}