Skip to content
Developerhome
Sage Distribution and Manufacturing Operations

Mutations

  Less than to read

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 
          }
        } 
      } 
    } 
  } 
} 
{ 
  "data": { 
    "xtremMasterData": { 
      "item": { 
        "query": { 
          "edges": [ 
            { 
              "node": { 
                "id": "PIE_BLUEBERRY", 
                "_id": "161", 
                "_customData": "{\"rating\":35,\"marketingDate\":\"2023-08-17\"}" 
              } 
            }
          ] 
        }
      }
    }
  }, 
  "extensions": { 
    "diagnoses": [] 
  }
} 
mutation { 
    xtremMasterData { 
        item { 
            update ( 
              data:{ 
                _id:"161", 
                _customData: "{\"rating\":28}" 
              }
            ) 
          { 
            rate:_customData(selector:"rating") 
          } 
        } 
    }
} 
{ 
  "data": { 
    "xtremMasterData": { 
      "item": { 
        "update": { 
          "rate": "28" 
        } 
      } 
    } 
  }, 
  "extensions": { 
    "diagnoses": [] 
  } 
} 
{ 
  xtremMasterData{ 
    item{ 
      query (filter: "{_customData: { _ne: null}}"){ 
        edges { 
          node { 
            id 
            _id 
            _customData 
          } 
        } 
      } 
    } 
  }
} 
{ 
  "data": { 
    "xtremMasterData": { 
      "item": { 
        "query": { 
          "edges": [ 
            { 
              "node": { 
                "id": "PIE_BLUEBERRY", 
                "_id": "161", 
                "_customData": "{\"rating\":28,\"marketingDate\":\"2023-08-17\"}" 
              } 
            } 
          ]
        }
      }
    }
  }, 
  "extensions": { 
    "diagnoses": [] 
  }
} 

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'}}" 
            ) 
        } 
    } 
} 
{ 
  "data": { 
    "xtremMasterData": { 
      "item": { 
        "bulkUpdate": true 
      } 
    } 
  }, 
  "extensions": { 
    "diagnoses": [] 
  } 

} 
mutation { 
    xtremMasterData { 
        item { 
             bulkUpdate( 
              data:{ 
                volume:10, 
                _customData: "{\"contractDate\":\"2023-05-29\"}", 
              } 
              filter : "{stockUnit:{name:'Each'}}" 
            ) 
        } 
    } 
} 
{ 
  "data": { 
    "xtremMasterData": { 
      "item": { 
        "bulkUpdate": true 
      } 
    } 
  }, 
  "extensions": { 
    "diagnoses": [] 
  } 
} 
mutation { 
    xtremMasterData { 
        item { 
             bulkUpdate( 
              data:{ 
              _customData: null, 
              } 
              filter : "{stockUnit:{name:'Each'}}" 
            ) 
        } 
    } 
} 
{ 
  "data": { 
    "xtremMasterData": { 
      "item": { 
        "bulkUpdate": true 
      } 
    } 
  },
  "extensions": { 
    "diagnoses": [] 
  } 
}