Toggle menu

replaceEvent()

This feature is available from iCM 10.1.0.102

Description

This function replaces an existing visible event with new event data. It works with active and sealed histories.

Mechanically it hides the old event (without renumbering anything else) and writes a new one that reuses the exact same N position and created timestamp - so from a normal read, a replacement is indistinguishable from the original having always been there. The genuine replacement time is only recoverable via audit mode.

Replacing an event also writes a hidden "metadata event" which includes the ID of the event, the type of action (ie "replaceevent") and the optional reason. Metadata events are returned when history queries are made in audit mode.

For an overview, see Hiding and Replacing Events.

Parameters

FieldTypeRequiredNotes
eventidpositive integerYesThe event to replace - from log/replaceEvent's response, or a gethistory event's eventId. You can't replace an already-hidden, already-replaced, or metadata event.
eventobjectYesThe new event data, following the same conventions as log()
idstring (UUID)One of id / labelsThe ID of the history the event belongs to. Mutually exclusive with labela-labele
labela ... labelesimple value"The labels to identify the history
coordinatesystemstringNoSee log()
fieldhintsobjectNoSee log()
reasonstringNoFree text, stored in the metadata event. Omit entirely for no reason field at all.

Returns

If the operation was successful then the "result" structure will contain the following.

PropertyDescription
historyidThe unique ID of the history
replacedeventidThe ID of the event that was replaced
neweventidThe ID of the new event
metadataeventidThe ID of the corresponding metadata event

Example

{
  "method": "replaceevent",
  "params": {
    "labela": "ReplaceSingleEventTest",
    "labelb": "1234-1234-1234-1234",
    "eventid": 1002,
    "event": {
      "event": "event two - replacement",
      "description": "work to do"
    },
    "reason": "correcting a mistake"
  }
}

"result": {
    "historyid": "3f2504e0-...-0305e82c3301",
    "replacedeventid": 1002,
    "neweventid": 1004,
    "metadataeventid": 1005
}

Last modified on 5 August 2026