APP-81Recommended
Show who changed a record and when
Show a history of changes on every shared record, such as an invoice or a customer. Each entry says who, what, when and the old and new values. Show only what the viewer may see.
How to do it
When two people edit the same customer, the first question after a mistake is who changed it. Read the history from the audit events the server already writes, never from a second log the browser writes. Those events follow Write an audit event for every sensitive action. Show the newest change first, with the person's name and the time in the viewer's zone. Hide values the viewer may not read, such as a salary, and say that a hidden change happened. Security events for a person's own account belong in Show people their own security log.
Examples
JavaScript example
const history = await api.get(`/customers/${id}/history`);
renderHistory(history.map(event => ({
who: event.actorName,
when: formatDateTime(event.at, user.locale, user.timeZone),
field: event.field,
change: event.redacted ? 'Hidden' : `${event.before} → ${event.after}`,
})));
Python example
def customer_history(customer_id, viewer):
events = audit_events(entity="customer", entity_id=customer_id)
return [
{"who": e.actor_name, "at": e.at, "field": e.field,
"before": e.before if viewer.may_read(e.field) else None,
"after": e.after if viewer.may_read(e.field) else None}
for e in reversed(events)
]
How to check
A test changes a customer's email as one user and opens the history as another. The entry shows the first user, the time, the old and new email. A viewer without access to a hidden field sees the entry without its values.
Related rules
- CMP-26 Write an audit event for every sensitive action in Compliance and governance
- ACC-31 Show people their own security log in Accounts and identity
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/app-ui/sessions-and-permissions/record-history">Agent Wranglers web app interface playbook</a>. In code you write, add a comment next to it with the same link.