You can apply mutations to custom fields.
A JSON field must be used to apply a mutation on a custom field.
In the case of a bulk update mutation, the system will be responsible for merging the values.
The following table displays the result of a query before and after a mutation is applied to a custom field. Some of the fields displayed are not mandatory and others have been omitted.
{
xtremMasterData{
item{
query (filter: "{_customData: { _ne: null}}" ){
edges {
node {
id
_id
_customData
}
}
}
}
}
}
Copy
{
"data" : {
"xtremMasterData" : {
"item" : {
"query" : {
"edges" : [
{
"node": {
"id": "PIE_BLUEBERRY",
"_id": "161",
"_customData": "{\"rating\":35,\"marketingDate\":\"2023-08-17\"}"
}
}
]
}
}
}
},
"extensions" : {
"diagnoses" : [ ]
}
}
Copy
mutation {
xtremMasterData {
item {
update (
data:{
_id:"161" ,
_customData: "{\"rating\":28}"
}
)
{
rate:_customData(selector:"rating" )
}
}
}
}
Copy
{
"data" : {
"xtremMasterData" : {
"item" : {
"update" : {
"rate" : "28"
}
}
}
},
"extensions" : {
"diagnoses" : [ ]
}
}
Copy
{
xtremMasterData{
item{
query (filter: "{_customData: { _ne: null}}" ){
edges {
node {
id
_id
_customData
}
}
}
}
}
}
Copy
{
"data" : {
"xtremMasterData" : {
"item" : {
"query" : {
"edges" : [
{
"node": {
"id": "PIE_BLUEBERRY",
"_id": "161",
"_customData": "{\"rating\":28,\"marketingDate\":\"2023-08-17\"}"
}
}
]
}
}
}
},
"extensions" : {
"diagnoses" : [ ]
}
}
Copy
You can also apply bulk mutations to custom fields.
The following table displays examples of queries where a bulk mutation is applied to a custom field. Some of the fields displayed are not mandatory and others have been omitted.
mutation {
xtremMasterData {
item {
bulkUpdate(
data:{
volume:20 ,
_customData: "{\"suggestedPrice\":10}" ,
}
filter : "{stockUnit:{name:'Each'}}"
)
}
}
}
Copy
{
"data" : {
"xtremMasterData" : {
"item" : {
"bulkUpdate" : true
}
}
},
"extensions" : {
"diagnoses" : [ ]
}
}
Copy
mutation {
xtremMasterData {
item {
bulkUpdate(
data:{
volume:10 ,
_customData: "{\"contractDate\":\"2023-05-29\"}" ,
}
filter : "{stockUnit:{name:'Each'}}"
)
}
}
}
Copy
{
"data" : {
"xtremMasterData" : {
"item" : {
"bulkUpdate" : true
}
}
},
"extensions" : {
"diagnoses" : [ ]
}
}
Copy
mutation {
xtremMasterData {
item {
bulkUpdate(
data:{
_customData: null ,
}
filter : "{stockUnit:{name:'Each'}}"
)
}
}
}
Copy
{
"data" : {
"xtremMasterData" : {
"item" : {
"bulkUpdate" : true
}
}
},
"extensions" : {
"diagnoses" : [ ]
}
}
Copy