How do I read the content of FormData within a custom WorkflowGen application?


#1

Question

How do I read form data content within a custom WorkflowGen application?

Background

For basic web service development, see the Web services API section in the WorkflowGen Integration Guide.

Solution

if (this.MyContextParametersWorkflowGen.Contains("FORM_DATA"))
{
 DataSetformData = new DataSet();
 // --- load formData from FORM_DATA fileReference ---
 ContextFileReference cfrWfgFormData =
 MyContextParametersWorkflowGen["FORM_DATA"].Value as ContextFileReference;
 FileStreamfsWfgFormData = new FileStream(cfrWfgFormData.Path, FileMode.Open);
  formData.ReadXml(fsWfgFormData);
}

#2

This does not work. When I convert the cfrWfgFormData is null.

Here is the object in the immediate window:

{WorkflowGen.My.Data.ContextParameter}
Direction: InOut
HasValue: ‘param.HasValue’ threw an exception of type ‘System.InvalidCastException’
Name: “FORM_DATA”
Type: {Name = “ContextFileReference” FullName = “WorkflowGen.My.Data.ContextFileReference”}
Value: “WorkflowGen.My.Data.ContextFileReference”

I am not sure what I am doing wrong but you would think this is straight forward


#3

Hi Colin,

Kindly open a ticket in our Helpdesk site so we can investigate this issue further.

Regards,
Eddy.