An application often requires that an class instance be in a special state that distinguishes it from others. In general, this is solved using explicitly set values. For example, article class has status attribute. This is enough to search and filter, but not enough to use custom views and access control.

Workflow creates a separate structure for managing the state of objects. State element defines the possible state of class instance. Each instance stores _state service attribute that defines the current state. Transition is a state change rule. It allows you to set a condition for changing one state to another.

Create class attributes with the same names to access service attributes. For example, _state, _createdAt, _updateAt, _user. You cannot change service attribute value using a form.

Open comment class and create a _state attribute, String type. Check Read only box. Select Workflow state in the View type field to display a status label, not just a code name.

Open comment class and select Workflow tab. Create a hidden state in the States field. In this state, comments are not displayed in public part of website. Check Read only object mode box to prevent users from changing comment data in this state.

Create a pending state. In this state, comments will be waiting for moderation.

Create a published state. In this state, comments will be published. Check Read-only object mode box to prevent comment changes.

Create a publish transition in the Transitions field. Add hidden and pending states in the Start states field. This defines the object state in which transition will be possible. Select published in the Final state field. This defines transition result as the new object state.

Use verbs as transition code names. This emphasizes transition effect on object state.

Create a hide transition. Add pending and published in the Start states field. Select hidden state in the Final state field.

Create a moderate transition to submit a comment for review. Check Null start state box to make transition available if object does not have any state. Ad hidden in the Start states field. Select pending in the Final state field.

Export metadata and go to Office. Create or open a comment. Transition buttons will appear in the form top panel depending object state.