Update Custom Value Object

Operation ID: updateCustomValueObject

Group: Value Accounting › Custom Value Objects

Open in the interactive reference

PATCH /value-accounting/custom-value-objects/{id}

Retry-safe: A write that accepts Idempotency-Key: repeating a request with the same key replays the stored answer instead of executing twice.

Partially update one custom value object. WRITES — this changes an existing value; returns an empty body on success. Only the fields sent are written; an omitted field keeps its value. categoryId accepts null to clear it. endDate: null clears an end of today or later (the shadow and their mapping follow) and is REFUSED with REACTIVATE_VIA_FLOW on an end before today — re-open a retired value with reactivateCustomValueObjects (POST value-accounting/custom-value-objects/reactivate), which re-opens its shadow value object and mapping with it; setting endDate to a date on an open value (or an earlier one) ends the value with its legs — the shadow value object, their mapping and its other mapping rows still open after that day end on it, and a cluster cut back to one record is retired with it — and a LATER date on a value that already ended moves the rows its retire closed (the shadow value object, their mapping and its other mapping rows ending on the previous day) with it. A rename renames the value's shadow value object too and a new startDate moves the shadow's and the mapping's start, so tagging follows automatically; only the shadow follows — a hand-made value object linked one-to-one to the value (a duplicate from before the one-open-one-to-one rule, which refuses a second open one-to-one value object with ONE_TO_ONE_EXISTS since) keeps its own name and dates. Moving the value to another dimension is allowed only while it is not in use (DIMENSION_LOCKED otherwise). The dates the value would END UP with must form a range (END_BEFORE_START), the name must not be blank (NAME_REQUIRED) or already used on the value's dimension — the target dimension when it moves (NAME_TAKEN), and both references must exist (CUSTOM_VALUE_DIMENSION_NOT_FOUND, CATEGORY_NOT_FOUND). Every check runs first, so a rejected call writes nothing. A PATCH that changes nothing — an empty body, or every field sent with the value already stored — is not written at all, so it does not touch lastModifiedDate and an incremental sync on that column does not see the value again. An endDate moved into the future on a value that already ended re-opens the rows its retire closed (the shadow's mapping and the record's other rows) and is refused with ONE_TO_ONE_EXISTS when one of their value objects would then stand alone for a record another value object represents one-to-one with an open mapping. The same move is refused with MAPPING_EXISTS when a row it re-opens names a record its value object already maps with another mapping open today.

Partially updates one custom value object and returns an empty body.

Only the fields you send are written: omit a field to leave it unchanged. Two fields can be cleared with an explicit null: categoryId (back to uncategorised) and endDate — but only an end of today or later, a schedule that never took effect (the shadow value object and their mapping follow). A value whose end is before today is retired and is re-opened together with its shadow value object and mapping by reactivateCustomValueObjects (POST value-accounting/custom-value-objects/reactivate), so endDate: null on it fails with REACTIVATE_VIA_FLOW rather than re-opening the value alone. Setting an endDate to a DATE on an open value — or an earlier one than stored — ENDS the value with its legs, as a delete's retire does: its shadow value object, their mapping and its other mapping rows still open after that day end on the same day, and a cluster value object cut back to one record is retired with it; moving the endDate of a value that already ended to a LATER day moves the rows its retire closed with it — its shadow value object, their mapping and its other mapping rows ending on the previous day. Either way reactivateCustomValueObjects (POST value-accounting/custom-value-objects/reactivate) re-opens them together, while a row ended on another day stays.

The value's shadow value object follows it: a rename renames the shadow, and a new startDate moves the shadow's and the mapping's start with it. Tagged allocations reference the id, not the text, so nothing breaks.

customValueDimensionId re-files the value on another axis, which is allowed only while the value is NOT in use — once it is tagged, or a value object mapping it (its shadow, a cluster it belongs to, a hand-made one linked to it) carries allocation lines, the move fails with DIMENSION_LOCKED, because every posting was made against the current axis.

The dates are judged on what the value will END UP with (a date you omit keeps its stored value), so an endDate before the startDate fails with END_BEFORE_START. Every check runs before anything is written. A PATCH that changes nothing is not written at all and leaves lastModifiedDate untouched. Moving the end date of a value that already ended into the future re-opens the rows its retire closed and is refused with ONE_TO_ONE_EXISTS when another value object already holds an open one-to-one link to the value: end that link first.

Parameters

Name In Type Required Description
Api-Version header string · v1 yes The API version this request targets, named by its public identifier. Required on every request; omitting it, or naming a version this company does not have, is answered with 400. This document describes version v1.
Idempotency-Key header string no An opaque caller-chosen string (1-255 characters) that makes this request safe to retry. Repeating the same key with an identical request body replays the original response instead of re-executing - but only once that original request succeeded; a failed attempt re-executes on retry. Repeating the key with a different body is answered with 422. A key still in flight is answered with 409 - as is a key whose original request was interrupted before it finished, for a few minutes afterwards, until that attempt is presumed dead. A completed response stays replayable for 24 hours. The key is scoped to the caller, not to the action: reusing it for a different action is answered with 409 or 422 rather than treated independently. On read actions this header is ignored. On write actions that cannot offer the guarantee it is answered with 400 IDEMPOTENCY_NOT_SUPPORTED rather than silently ignored.
id path string yes Id (a UUID) of the custom value object to change; bound from the :id path segment. An id that matches no value is rejected with NOT_FOUND. Ids are matched case-insensitively and returned in canonical lowercase. Example: "6d2c8f31-b4a7-4e19-9f2b-77c0a1d4e5b2".

Request body

Required, application/json: updateCustomValueObjectInput.

Field Type Required Description
customValueDimensionId string no Id (a UUID) of the custom value dimension to move the value to, from the customValueDimensions data-set (GET value-accounting/custom-value-dimensions). OMIT TO LEAVE IT on its current dimension; it cannot be cleared. Moving re-files the value on another reporting axis, so do it only when the value was created on the wrong one: once the value is IN USE — tagged anywhere, or a value object mapping it (its shadow, a cluster it belongs to, a hand-made one linked to it) carrying allocation lines — the move is refused with DIMENSION_LOCKED and nothing is written. Re-sending the dimension it is already on is not a change and always passes. An id that names no dimension is rejected with CUSTOM_VALUE_DIMENSION_NOT_FOUND.
name string no New display name. OMIT TO LEAVE IT UNCHANGED; it cannot be cleared. When sent it must not be empty or whitespace only (NAME_REQUIRED) and must be unused on the dimension the value ends up on (NAME_TAKEN); re-sending the name it already has is a valid no-op. Stored exactly as sent, untrimmed. The shadow value object is renamed with it; a hand-made value object linked to the value (a duplicate from before the one-open-one-to-one rule, which refuses a second open one-to-one value object with ONE_TO_ONE_EXISTS since) is not. Example: "North-East".
startDate date no New first valid day, inclusive. Format YYYY-MM-DD. OMIT TO LEAVE IT UNCHANGED. Must not fall after the endDate the value will have — the one sent in this call, or the stored one (END_BEFORE_START). The shadow value object and its mapping move to the same startDate — on a LATER start only the shadow's mappings still running on the new day, and a shadow mapping that ended before it refuses the move (START_AFTER_MAPPING_HISTORY); a hand-made value object linked to the value (a duplicate from before the one-open-one-to-one rule, which refuses a second open one-to-one value object with ONE_TO_ONE_EXISTS since) is never re-dated.
endDate date | null no New last valid day, inclusive. Format YYYY-MM-DD. OMIT TO LEAVE IT UNCHANGED. Setting it on an open value — or an earlier date than stored — retires the value by hand with its legs, the set deleteCustomValueObject (DELETE value-accounting/custom-value-objects/:id) closes on a value in use: the shadow value object, their mapping and the value's other mapping rows still open after that day end on the same day (rows that ended earlier keep their day), and a cluster value object cut back to one record is retired with it. A LATER date on a value that already ended moves every row its retire closed with it — the shadow value object, their mapping and its other mapping rows ending on the previous day; a row ended on another day stays. Must not fall before the startDate the value will have (END_BEFORE_START). null CLEARS an end of TODAY OR LATER — a schedule that never took effect: the shadow value object, their mapping and the value's other rows ending with it follow to no end. ⛔ On a value whose end date is BEFORE today null is REFUSED with REACTIVATE_VIA_FLOW and nothing is written — re-open a retired value with reactivateCustomValueObjects (POST value-accounting/custom-value-objects/reactivate) instead. A null on a value WITHOUT an end date repairs a legacy half-state: an end its shadow value object carries on its own, of today or later (it never took effect), is cleared on the shadow, their mapping and the rows ending with it; a past one is left to reactivateCustomValueObjects.
categoryId string | null no Id (a UUID) of the category to file the value under, from the categories data-set (GET value-accounting/categories). OMIT TO LEAVE IT UNCHANGED; send null to clear it back to uncategorised. An id that names no category is rejected with CATEGORY_NOT_FOUND; null is a clear, not a reference, and is never rejected.
{}

Response

200 Success

Under data (updateCustomValueObjectOutput):

Field Type Required Description
removedMappingIds array<string> no Present only when this request moved the value's end date EARLIER and that DELETED mappings: the ids (UUIDs) of the value object mappings naming this value — its shadow's, its other links — or belonging to a cluster value object retired with it, that would only have started after the new end date. Such a mapping is never in effect inside the value's life, so it is deleted rather than ended before its own start (never left canceled); every other leg still open after that day ends on it. The ids no longer exist. Absent when nothing was deleted (the body is then empty, as before).
{
  "data": {
    "removedMappingIds": [
      "<removedMappingIds>"
    ]
  },
  "diagnostics": [
    {
      "code": "<code>",
      "message": "<message>",
      "severity": "error",
      "path": [
        "<path>"
      ],
      "details": "<details>"
    }
  ]
}

Response headers

Errors

Code Status
NOT_FOUND 400
REACTIVATE_VIA_FLOW 400
NAME_REQUIRED 400
END_BEFORE_START 400
START_AFTER_MAPPING_HISTORY 400
CUSTOM_VALUE_DIMENSION_NOT_FOUND 400
DIMENSION_LOCKED 400
NAME_TAKEN 400
CATEGORY_NOT_FOUND 400
MAPPING_EXISTS 400
ONE_TO_ONE_EXISTS 400
IDEMPOTENCY_KEY_CONFLICT 409
IDEMPOTENCY_PAYLOAD_MISMATCH 422

Statuses