Entity item change document

The entity item change document contains all changes which are persisted in a specific save operation including the old and new values.In case this save operation would only modify a single field, the change document only contains this field. In case a full item is created or modified with sub-entities and hundreds of fields, the document will have all that in it. The document is hierarchical like the repository entities. It's basic structure is derived from there. One exception to this rule are the characteristics which have an inherent hierarchical nature and thus will also be provided fully hierarchical in the document.

Datatypes

  • ENTITY_ITEM objects always contain the _entityId, _internalId and _externalId attributes

    • _internalId = Service API syntax with internal numeric IDs - includes the container in case the entity item has one

    • _externalId = Service API syntax with the alphanumeric identifier of the entity item. Includes the container as well in case the entity item has one

    • _entityId = The numeric id of the repository entity

  • MIME_VALUE objects always contain the relative _filePath, the _label and the _mimeType

  • timestamp: ISO 8601, e.g.: 2012-04-23T18:25:43.511Z

  • date: ISO 8601, e.g.: 2019-07-04

  • numbers: standard JSON

  • "no value" is either provided as null, or the attribute is not in the document.

  • Empty string is returned as null, which is omitted when possible!

  • Enumeration fields

    • _key: always holds the unique key of the enumeration entry
      In case the enumeration field is of datatype ENTITY_ITEM, then the key will be provided with the ENTITY_ITEM syntax (see above)

    • _code: the external code of the enumeration entry, if the enum entry has one, and it differs from the key!

Meta attributes

Meta attributes are prefixed with an underscore.

_module

The area of the application which has triggered the modification: IMPORT, MERGE, CLONE, SERVICEAPI, REVISION, ENVIRONMENT_TRANSFER, UI, OTHER.

_user

The entity item of the user which executed the CRUD operation

_eventTimestamp

The timestamp at which this document is created

_revision

The entity item of the revision in which the operation has been performed

_changeType

The change type of the entity record. The change type of the parent record applies if no change type is given.

  • CREATED = the entity record has been created (this implies that all children of this also have been created)

  • CHANGED = the entity record has been changed. Also it's children MIGHT have been changed, but at least the entity itself has changed

  • CHANGED_CHILD = only one or multiple children of this entity record have changed, not the record itself

  • DELETED = the entity record has been marked as deleted or has been physically deleted.

_qualification

The qualification of the entity. The combination of the fields in the qualification object define this record as unique within it's parent. Qualification values do not have current and old values as a change in the qualification implies a create/delete of the record even if that is not the case in our database.

_entity

The root entity which is changed

_identifier

The identifier of the entity item

_container

The container of the root entity record

_entityItem

The root entity record's proxy information

  • In case the identifier of an item is changed, the externalId of the item also changes, starting with the next change document. So when you search for it, you will at least find the document with the old identifier and see that the last change for this is a change of the identifier. This is identical for the _identifier attribute of course.

_changedFields

An array of fields which got changed (fields are without qualifications)

  • We use the field identifier, not the short identifier for this element. This way sub-entity fields are unique as well

  • In chase characteristics are affected, the ArticleCharacteristicValueLang.Values field is included

_changedEntities

An array of entity identifiers which are part of the change summary (but only in case the entity is created, changed or deleted - not for changed_child!)

_transactionStatus

State of the current audit trail transaction. Every record has one of the following status

  • COMPLETE = the whole transaction was successfully completed

  • INCOMPLETE = transaction has still not completed yet. This can happen as we store the document while parallely persisting record in the database.
    This signifies transaction under processing stage. If these documents stay in this state for too long, then they would be picked up by the watchdog.

  • COMPLETE_BY_WATCHDOG = this status signifies that an incomplete document that was picked up by the watchdog has been processed and marked as valid transaction.

  • INVALID = this status signifies that the transaction for which this document was created didn't really process successfully.

  • POTENTIALLY_INVALID = this status signifies that it can't be guaranteed that the transaction did happen successfully.

  • EXCEPTION = an exception while validating that the transaction was valid or not.

_invalidReason

Defines the reason why the document was marked as invalid or had an exception

_relationshipType

Internal attribute

This defines what type of document it is. It can be of either of these 2 types

  • changeSummaryDoc = contains the change summary specific document

  • triggerFiredDoc = containes the trigger related information

Change Summary

All data elements are located within the _changeSummary attribute. The _current and _old attributes for fields provide the current and old value, if one of them is omitted, it means there was/is no corresponding value. Qualifications do not have current and old values, in case a qualification field is modified, the whole record is twice in the document, one time with the old value marked as deleted, one time with the new one, marked as created.

In case an entity item has been deleted, the change document does not contain a change summary!

Field or entity names

A new repository property has been added in the custom section of the repository. The new "shortIdentifier" can be generated by a function in the repository editor in case no value is set for it.
However, it should never be changed for standard fields. There might be specially contributed logic which is linked to the short identifier. On the other hand, when enabling a reserved field in the custom section, the short identifier must be defined. It should reflect the logical content of the field, and not it's field type. So, instead of having "res_Text_200" as short identifier, chose something more meaningful.

The short identifier must be unique within it's parent entity. This short identifier is available for entities, fields and logical keys. In case of logical keys which are bound to a field, it should be identical.

Please see the Domain Model (Repository) documentation on details on allowed characters and syntax.

What is not part of the change summary

  • Object permissions. If someone modifies the object permission of an entity item, this is not recorded in the audit log

  • Password fields: fields which are marked as password fields are not recorded in the audit trail

  • Fields/Entities without the "shortIdentifier" attribute in the repository

  • Qualifiations which have a fixed value and are not modifiable by the user - so called "disabled" logical keys

  • Fields/Entities which has supportsAuditTrail set to false

  • Root Entities which do not have an AuditTrailSettings child element, or in which the retention policy has been set to "NO_RETENTION"

Examples

CREATE

CHANGED

Item is created with a name and description in English and French

{
"_module": "IMPORT",
"_user": {
"_entityId": 2600,
"_internalId": "47",
"_externalId": "\u0027abuehler\u0027"
},
"_eventTimestamp": "2020-05-28T23:28:56.782Z",
"_revision": {
"_entityId": 5600,
"_internalId": "1",
"_externalId": "\u0027HEAD\u0027"
},
"_entity": "Item",
"_identifier": "MyItem",
"_container": {
"_entityId": 2900,
"_internalId": "1",
"_externalId": "\u0027MASTER\u0027"
},
"_entityItem": {
"_entityId": 1000,
"_internalId": "345@1",
"_externalId": "\u0027MyItem\u0027@\u0027MASTER\u0027"
},
"_changeType": "CREATED",
"_changedEntities": [
"Article",
"ArticleLang"
],
"_changedFields": [
"Article.GTIN",
"ArticleLang.Name",
"ArticleLang.Description"
],
"_changeSummary": {
"item": {
"gtin": {
"_current": "11112222333"
},
"lang": [
{
"_qualification": {
"language": {
"_key": 9,
"_code": "eng"
}
},
"name": {
"_current": "spicy cookie"
},
"description": {
"_current": "yummy cookie"
}
},
{
"_qualification": {
"language": {
"_key": 12,
"_code": "fra"
}
},
"name": {
"_current": "somethingInFrench"
},
"description": {
"_current": "somethingInFrench"
}
}
]
}
},
"_transactionStatus": "COMPLETE",
"_relationshipType": {
"name": "changeSummaryDoc"
}
}

Item is changed. New value for German, modified value for English and
the French value is removed

{
"_module": "UI",
"_user": {
"_entityId": 2600,
"_internalId": "47",
"_externalId": "\u0027abuehler\u0027"
},
"_eventTimestamp": "2020-05-28T23:28:56.782Z",
"_revision": {
"_entityId": 5600,
"_internalId": "1",
"_externalId": "\u0027HEAD\u0027"
},
"_entity": "Item",
"_identifier": "MyItem",
"_container": {
"_entityId": 2900,
"_internalId": "1",
"_externalId": "\u0027MASTER\u0027"
},
"_entityItem": {
"_entityId": 1000,
"_internalId": "345@1",
"_externalId": "\u0027MyItem\u0027@\u0027MASTER\u0027"
},
"_changeType": "CHANGED",
"_changedEntities": [
"Article",
"ArticleLang"
],
"_changedFields": [
"ArticleLang.Name",
"ArticleLang.Description"
],
"_changeSummary": {
"item": {
"gtin": {
"_current": "4711239283",
"_old": "11112222333"
},
"lang": [
{
"_changeType": "CREATED",
"_qualification": {
"language": {
"_key": 7,
"_code": "deu"
}
},
"name": {
"_current": "Spekulazius"
},
"description": {
"_current": "Lecker Kekse!"
}
},
{
"_changeType": "CHANGED",
"_qualification": {
"language": {
"_key": 9,
"_code": "eng"
}
},
"name": {
"_current": "spiced cookie",
"_old": "spicy cookie"
},
"description": {
"_old": "yummy cookie"
}
},
{
"_changeType": "DELETED",
"_qualification": {
"language": {
"_key": 12,
"_code": "fra"
}
},
"name": {
"_old": "somethingInFrench"
},
"description": {
"_old": "somethingInFrench"
}
}
]
}
},
"_transactionStatus": "COMPLETE",
"_relationshipType": {
"name": "changeSummaryDoc"
}
}

DELETED

Item is deleted in the system.

{
"_module": "UI",
"_user": {
"_entityId": 2600,
"_internalId": "47",
"_externalId": "\u0027abuehler\u0027"
},
"_eventTimestamp": "2020-05-28T23:28:56.782Z",
"_revision": {
"_entityId": 5600,
"_internalId": "1",
"_externalId": "\u0027HEAD\u0027"
},
"_entity": "Item",
"_identifier": "MyItem",
"_container": {
"_entityId": 2900,
"_internalId": "1",
"_externalId": "\u0027MASTER\u0027"
},
"_entityItem": {
"_entityId": 1000,
"_internalId": "345@1",
"_externalId": "\u0027MyItem\u0027@\u0027MASTER\u0027"
},
"_changeType": "DELETED",
"_transactionStatus": "COMPLETE",
"_relationshipType": {
"name": "changeSummaryDoc"
}
}

Characteristic Values

Characteristic values are rendered in a specialized structure in order to honor their hierarchical nature.
This structure is not identical to the repository as it is fully hierarchical. This is the reason for extra meta attributes which help to not get in conflict with repository based data.

Additional Meta Attributes

_characteristicRecords

Top level element for all characteristic records

_recordLang

Language specific record values. In case the characteristic is not language specific, the qualification for "not language specific" is returned (-1 or xxz)

_children

Children of the current characteristic record

_datatype

The characteristic data type - to be able to interpret the values even in case the characteristic is no longer in the system

_formatPattern

The format pattern of the characteristic - to be able to format the values even in case the characteristic is no longer in the system

Examples

{
"_module": "IMPORT",
"_user": {
"_entityId": 2600,
"_internalId": "47",
"_externalId": "\u0027abuehler\u0027"
},
"_eventTimestamp": "2020-05-28T23:28:56.782Z",
"_revision": {
"_entityId": 5600,
"_internalId": "1",
"_externalId": "\u0027HEAD\u0027"
},
"_entity": "Item",
"_identifier": "MyItem",
"_container": {
"_entityId": 2900,
"_internalId": "1",
"_externalId": "\u0027MASTER\u0027"
},
"_entityItem": {
"_entityId": 1000,
"_internalId": "345@1",
"_externalId": "\u0027MyItem\u0027@\u0027MASTER\u0027"
},
"_changeType": "CREATED",
"_changedEntities": [
"Article",
"ArticleLang",
"ArticleCharacteristicValue",
"ArticleCharacteristicValueLang"
],
"_changedFields": [
"Article.GTIN",
"ArticleLang.Name",
"ArticleLang.Description",
"ArticleCharacteristicValueLang.Values"
],
"_changeSummary": {
"item": {
"gtin": {
"_current": "11112222333"
},
"lang": [
{
"_qualification": {
"language": {
"_key": 9,
"_code": "eng"
}
},
"name": {
"_current": "spicy cookie"
},
"description": {
"_current": "yummy cookie"
}
}
],
"_characteristicRecords": [
{
"_changeType": "CREATED",
"_qualification": {
"characteristic": {
"_key": {
"_entityId": 8000,
"_internalId": "7",
"_externalId": "\u0027AnimalIngredient\u0027"
},
"_code": "AnimalIngredient"
},
"recordKey": "0000.0000.RK",
"parentRecordKey": "root"
},
"_dataType": "LOOKUP",
"order": {
"_current": -32767
},
"_recordLang": [
{
"_qualification": {
"language": {
"_key": -1,
"_code": "zxx"
}
},
"values": {
"_current": [
{
"_entityId": 7300,
"_internalId": "23@5",
"_externalId": "\u0027Down\u0027@\u0027AnimalIngredient\u0027"
}
]
}
}
],
"_children": [
{
"_qualification": {
"characteristic": {
"_key": {
"_entityId": 8000,
"_internalId": "8",
"_externalId": "\u0027CertDown\u0027"
},
"_code": "CertDown"
},
"recordKey": "0000.0000.RK",
"parentRecordKey": "0000.0000.RK"
},
"_dataType": "LOOKUP",
"order": {
"_current": -32766
},
"_recordLang": [
{
"_qualification": {
"language": {
"_key": -1,
"_code": "zxx"
}
},
"values": {
"_current": [
{
"_entityId": 7300,
"_internalId": "25@6",
"_externalId": "\u0027Other\u0027@\u0027CertDown\u0027"
}
]
}
}
],
"_children": [
{
"_qualification": {
"characteristic": {
"_key": {
"_entityId": 8000,
"_internalId": "11",
"_externalId": "\u0027CertDownExpDate\u0027"
},
"_code": "CertDownExpDate"
},
"recordKey": "0000.0000.RK",
"parentRecordKey": "0000.0000.RK"
},
"_dataType": "DATE",
"order": {
"_current": -32765
},
"_recordLang": [
{
"_qualification": {
"language": {
"_key": -1,
"_code": "zxx"
}
},
"values": {
"_current": [
"1977-05-28"
]
}
}
]
}
]
},
{
"_qualification": {
"characteristic": {
"_key": {
"_entityId": 8000,
"_internalId": "8",
"_externalId": "\u0027CertDown\u0027"
},
"_code": "CertDown"
},
"recordKey": "0000.0000.RK",
"parentRecordKey": "0000.0000.RK"
},
"_dataType": "LOOKUP",
"order": {
"_current": -32766
},
"_recordLang": [
{
"_qualification": {
"language": {
"_key": -1,
"_code": "zxx"
}
},
"values": {
"_current": [
{
"_entityId": 7300,
"_internalId": "25@6",
"_externalId": "\u0027Other\u0027@\u0027CertDown\u0027"
}
]
}
}
],
"_children": [
{
"_qualification": {
"characteristic": {
"_key": {
"_entityId": 8000,
"_internalId": "11",
"_externalId": "\u0027CertDownExpDate\u0027"
},
"_code": "CertDownExpDate"
},
"recordKey": "0000.0000.RK",
"parentRecordKey": "0000.0000.RK"
},
"_dataType": "DATE",
"order": {
"_current": -32765
},
"_recordLang": [
{
"_qualification": {
"language": {
"_key": -1,
"_code": "zxx"
}
},
"values": {
"_current": [
"1977-05-28"
]
}
}
]
}
]
}
]
}
],
"_children": [
{
"_changeType": "CREATED",
"_qualification": {
"characteristic": {
"_key": {
"_entityId": 8000,
"_internalId": "8",
"_externalId": "\u0027CertDown\u0027"
},
"_code": "CertDown"
},
"recordKey": "0000.0000.RK",
"parentRecordKey": "0000.0000.RK"
},
"_dataType": "LOOKUP",
"order": {
"_current": -32766
},
"_recordLang": [
{
"_qualification": {
"language": {
"_key": -1,
"_code": "zxx"
}
},
"values": {
"_current": [
{
"_entityId": 7300,
"_internalId": "25@6",
"_externalId": "\u0027Other\u0027@\u0027CertDown\u0027"
}
]
}
}
],
"_children": [
{
"_qualification": {
"characteristic": {
"_key": {
"_entityId": 8000,
"_internalId": "11",
"_externalId": "\u0027CertDownExpDate\u0027"
},
"_code": "CertDownExpDate"
},
"recordKey": "0000.0000.RK",
"parentRecordKey": "0000.0000.RK"
},
"_dataType": "DATE",
"order": {
"_current": -32765
},
"_recordLang": [
{
"_qualification": {
"language": {
"_key": -1,
"_code": "zxx"
}
},
"values": {
"_current": [
"1977-05-28"
]
}
}
]
}
]
}
]
}
}
}