Field mapped to a workflow context not found in the provided data row during WF Save step

I’ve a simple WorkFlow, which is updating one field in BusinessPartner entity via UI action. The datastructure for loading data and saving result contains only 4 fields (Id, Name, ReferenceCode, MyCode). I can see in trace, that the update of MyCode field is correct, but the next save step throws an error. Please, what’s wrong?

2022-10-04 17:47:10,785 [Workflow 0725cf83-c9f1-4cd4-96fa-a00b6abb4daf] DEBUG Origam.Workflow.WorkflowEngine - Starting ServiceMethodCallEngineTask: 06_Save
2022-10-04 17:47:11,033 [Workflow 0725cf83-c9f1-4cd4-96fa-a00b6abb4daf] ERROR Origam.Workflow.WorkflowEngine - ServiceMethodCallTask 06_Save failed.
2022-10-04 17:47:11,055 [Workflow 0725cf83-c9f1-4cd4-96fa-a00b6abb4daf] ERROR Origam.Workflow.WorkflowEngine - Field mapped to a workflow context not found in the provided data row. Cannot execute workflow. (Parameter 'Field')
Actual value was UserEmail.
Origam.OrigamException: Field mapped to a workflow context not found in the provided data row. Cannot execute workflow. (Parameter 'Field')
Actual value was UserEmail.
 ---> System.ArgumentOutOfRangeException: Field mapped to a workflow context not found in the provided data row. Cannot execute workflow. (Parameter 'Field')
Actual value was UserEmail.
   at Origam.Workflow.StateMachineService.ExecuteWorkflow(IWorkflow workflow, StateMachineEvent ev, DataRow dataRow, String transactionId) in D:\a\1\s\backend\Origam.Workflow\StateMachineService.cs:line 1041
   at Origam.Workflow.StateMachineService.ExecuteStatelessEvents(Guid entityId, StateMachineServiceStatelessEventType eventType, DataRow dataRow, String transactionId) in D:\a\1\s\backend\Origam.Workflow\StateMachineService.cs:line 683
   at Origam.Workflow.StateMachineService.OnDataChanged(DataSet data, ArrayList changedTables, String transactionId) in D:\a\1\s\backend\Origam.Workflow\StateMachineService.cs:line 256
   at Origam.DA.Service.AbstractSqlDataService.UpdateData(DataStructureQuery query, IPrincipal userProfile, DataSet dataset, String transactionId, Boolean forceBulkInsert) in D:\a\1\s\backend\Origam.DA.Service\AbstractSqlDataService.cs:line 580
   at Origam.Workflow.DataServiceAgent.SaveData(Guid dataStructureId, Guid methodId, Guid sortSetId, IDataDocument data, Boolean forceBulkInsert) in D:\a\1\s\backend\Origam.Workflow\Service Agents\DataServiceAgent.cs:line 240
   at Origam.Workflow.DataServiceAgent.Run() in D:\a\1\s\backend\Origam.Workflow\Service Agents\DataServiceAgent.cs:line 609
   at Origam.Workflow.Tasks.ServiceMethodCallEngineTask.OnExecute() in D:\a\1\s\backend\Origam.Workflow\Tasks\ServiceMethodCallEngineTask.cs:line 214
   at Origam.Workflow.ProfilingTools.<>c__DisplayClass4_0.<ExecuteAndLogDuration>g__FuncToExecute|0() in D:\a\1\s\backend\Origam.Workflow\ProfilingTools.cs:line 68
   at Origam.Workflow.ProfilingTools.ExecuteAndLogDuration(Func`1 funcToExecute, String logEntryType, String path, String id, Func`1 logOnlyIf) in D:\a\1\s\backend\Origam.Workflow\ProfilingTools.cs:line 108
   at Origam.Workflow.ProfilingTools.ExecuteAndLogDuration(Action action, String logEntryType, String path, String id, Func`1 logOnlyIf) in D:\a\1\s\backend\Origam.Workflow\ProfilingTools.cs:line 72
   at Origam.Workflow.Tasks.AbstractWorkflowEngineTask.MeasuredExecution() in D:\a\1\s\backend\Origam.Workflow\Tasks\AbstractWorkflowEngineTask.cs:line 100
   at Origam.Workflow.Tasks.ServiceMethodCallEngineTask.Execute() in D:\a\1\s\backend\Origam.Workflow\Tasks\ServiceMethodCallEngineTask.cs:line 72
   --- End of inner exception stack trace ---

BusinessPartner entity is used in a state machine and there are events on it. State machine events require fields to be present in the saving data structure and one of the fields required is not present. It is the best practice to use all fields when saving. Or you have to know exactly which fields are used in state machines and you have to use them as well.

1 Like

Thank you @tvavrda , you are right, the issue is in State machine!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.