is possible to add code to custom InfoPath task form. One should just ensure that dll is deployed together with form.
Also it is possible to add comboboxes inside repeating table (all comboboxes have same data source). Rows for repeating table are created on PageLoad and data for it is provided from Workflow by embding it in Form field as XML.
public void InternalStartup()
{
EventManager.FormEvents.Loading += new LoadingEventHandler(FormEvents_Loading);
}
public void FormEvents_Loading(object sender, LoadingEventArgs e)
{
string myNamespace = NamespaceManager.LookupNamespace("my");
XPathNavigator repTable = MainDataSource.CreateNavigator().SelectSingleNode("/my:RoleAssigmentExecution/my:Resources", NamespaceManager);
if (repTable == null)
{
XPathNavigator node = MainDataSource.CreateNavigator().SelectSingleNode("/my:RoleAssigmentExecution", NamespaceManager);
using (XmlWriter writer = node.AppendChild())
{
writer.WriteStartElement("Resources", myNamespace);
writer.WriteEndElement();
writer.Close();
}
}
repTable = MainDataSource.CreateNavigator().SelectSingleNode("/my:RoleAssigmentExecution/my:Resources", NamespaceManager);
if (repTable != null)
{
using (XmlWriter writer = repTable.AppendChild())
{
XPathNavigator inst = MainDataSource.CreateNavigator().SelectSingleNode("/my:RoleAssigmentExecution/my:Instructions", NamespaceManager);
writer.WriteStartElement("ResorceAccounts", myNamespace);
writer.WriteElementString("resource", myNamespace, inst.Value);
writer.WriteElementString("accountCombo", myNamespace, "");
writer.WriteEndElement();
writer.Close();
}
}
else
{
string path = "/my:RoleAssigmentExecution/my:Remarks";
XPathNavigator node = MainDataSource.CreateNavigator().SelectSingleNode(path, NamespaceManager);
node.SetValue("can not access Repeating Table");
}
}