AddHistory Use Examples
Basic AddHistory Use
In this example, we call AddHistory in the workflow CompleteStatus process. Since we use it in a workflow process, all required fields are pre-populated for you. The only thing you might want to change is the comment field. The default value comes from ExecuteWorkflow service, since it is inside a CompleteStatus process. If you use AddHistory in StatusArrival and StatusExit, you will need to specify the comment field.
In the log, it only shows the start time and end time of the service.
In EP_Workflow_Request_History table, you’ll see this history entry. CreatedBy, CreatedOn, UpdatedBy and UpdatedOn will be populated automatically with the UserId and current date time. You can then build a page or web part for request history and display any information you need.
If you call AddHistory in other process, you will need to enter all required fields to meet your audit design. Please note that all required fields cannot be blank, otherwise, you will not be able to the save the service. The following is a sample input calling from button process.
AddHistory with custom data
This is an example that we write a history record to the request in previous example with all custom data fields typed in.
In the EP_Workflow_Request_History table, you will see the history record is populated with all CustomData columns filled out.