Kasun Jayasinghe
Kasun Jayasinghe

Reputation: 355

Sitecore get command executed for a workflow history record

In Sitecore, when a workflow command is executed it records the command action with old state, new state and comment etc... in the WorkflowHistory table in the Master database. Is there a way to get the command executed for the particular record because it is not stored in the WorkflowHistory table.

Upvotes: 1

Views: 725

Answers (1)

Marek Musielak
Marek Musielak

Reputation: 27132

Sitecore WorkflowHistory table entries are created by the Sitecore.Workflows.HistoryStore class which contains 3 methods only:

  • AddHistory(Item item, string oldState, string newState, string text)
  • ClearHistory(Item item);
  • GetHistory(Item item);

The information which is stored contains:

  • Item
  • user name
  • date of the change of the workflow state
  • old workflow state
  • new workflow state
  • comment (optional)

There is no information about the command which was executed so there is no way of getting this information from the database.

Still you can try to find the command which was executed by looking for all the commands below the old workflow state that change the state of the item to the new workflow state, but there can be multiple paths between them and the states can be changed dynamically from the code without using any of the command.

Upvotes: 2

Related Questions