Hi,
I'm trying to fetch the Form data attributes values to display and update the attribute using CWS. But the attribute value is null and hence unable to assign the value.
Below is the code. Request for any suggestion. Thanks in advance.
****************************************************
int workflowmapID = 300892;
int[] wfalreadylivelinkattchments = { };
int[] wfrolebasedif = { };
ProcessDefinition wfpd = new ProcessDefinition();
wfpd.ObjectID = workflowmapID;
ProcessInstance wfpi = wc.CreateProcess(ref wfOTAuth, wfpd, "test map", wfalreadylivelinkattchments, wfrolebasedif);
Console.WriteLine("WF ID Initiated Process ID---- " + wfpi.ProcessID + "---sub Process is " + wfpi.SubProcessID);
ApplicationData[] GetProcessDataResult = wc.GetProcessData(ref wfOTAuth, wfpi.ProcessID, wfpi.SubProcessID);/
FormData fd = new FormData();
fd = ((FormData)(GetProcessDataResult[2]));
FormDataInstance[] fdList = fd.Forms;
foreach (FormDataInstance f in fdList)
{
AttributeGroupDefinition agd = new AttributeGroupDefinition();
agd = f.Data;
for (int i = 0; i <= agd.Attributes.Length; i++)
{
if (agd.Attributes[i].Type == "String")
{
StringAttribute sAttr = (StringAttribute)agd.Attributes[i];
if (sAttr.Values != null)
{
Console.WriteLine("Attribute: " + sAttr.Values[0]);
}
sAttr.Values[0] = "Test Engagement"; //Error here as value is null.
}
Console.WriteLine("Attributes:");
Console.WriteLine(agd.Attributes[i].DisplayName + " - " + agd.Attributes[i].GetType());
}
}
****************************************************