is it possible to change order of workflow autogenerated column (from last position to 2nd)? I need to do this programatically, not in Library > Modify view.
EDIT: Whole workflow I made in Visual Studio and it is with custom association, initiation an task form.
EDIT2: I figured it out, just reorder view in onWorkflowActivated method:
private void onWorkflowActivated_Invoked(object sender, ExternalDataEventArgs e)
{
string colName = workflowProperties.TemplateName;
SPView defaultView = workflowProperties.List.DefaultView;
if (defaultView.ViewFields.SchemaXml.Contains(colName))
{
System.Collections.Specialized.StringCollection collStrings = defaultView.ViewFields.ToStringCollection();
List<string> fields = new List<string>();
foreach (string field in collStrings)
{
fields.Add(field);
}
if (fields.IndexOf(colName) != 2)
{
defaultView.ViewFields.MoveFieldTo(colName, 2);
defaultView.Update();
}
}
}