Generic object mutation
The generic changeObject() mutation can be used to execute most kinds of change actions
in the Content Engine. It can be used to execute changes against types of objects for which there is
not currently a specific mutation available or when change actions (pending actions in the CE Java
API) must be combined in some custom manner.
The following example creates a custom role
object:
mutation {
changeObject(
repositoryIdentifier:"OS1"
properties:[
{DisplayName:"My Custom Role"}
{CustomString:"Test value"}
{CustomInteger:93287}
]
actions:[
{
type:CREATE
subCreateAction:{
classId:"CustomRole"
}
}
]
)
{
className
objectReference {
repositoryIdentifier
classIdentifier
identifier
}
properties(includes:["Id","DisplayName","CustomString","CustomInteger"]) {
id
label
type
cardinality
value
}
}
}
The following example creates a custom
CmTask object, connecting it to a
Coordinator object (a Folder) and promoting it twice to the working
state:mutation {
changeObject(
repositoryIdentifier:"OS1"
properties:[
{CustomString:"A Task"}
{CustomInteger:73216}
]
objectProperties:[
{
identifier:"Coordinator"
objectReferenceValue:{
repositoryIdentifier:"OS1"
classIdentifier:"Folder"
identifier:"/Folder for Browsing/GraphQL Folder"
}
}
]
actions:[
{
type:CREATE
subCreateAction:{
classId:"CustomTask"
}
}
{
type:CHANGE_STATE
subChangeStateAction:{
lifecycleAction:PROMOTE
}
}
{
type:CHANGE_STATE
subChangeStateAction:{
lifecycleAction:PROMOTE
}
}
]
)
{
className
objectReference {
repositoryIdentifier
classIdentifier
identifier
}
properties( includes:["Id", "CustomString", "CustomInteger", "Coordinator"]) {
id
label
type
cardinality
value
... on ObjectProperty {
objectValue {
className
... on Folder {
id
name
pathName
}
}
}
}
}
}