05-30-2019 10:42 AM
Hi everyone,
I have a Unity API that I want to fill in fields in a repeating section on a unity form. The API will select radio buttons within the repeating section. For instance the value of 1 is "Yes" and the value of 2 is "No". For some reason it works fine with one of the radio buttons but does not work for any other radio buttons.
Hyland.Unity.UnityForm.Form form2 = doc.UnityForm;
Hyland.Unity.UnityForm.FormModifier formMod = form2.CreateUnityFormModifier();
RepeaterDefinition repeaterDef = form2.FormTemplate.AllFieldDefinitions.RepeaterDefinitions.Find("repeatingsection111");
EditableRepeaterItem erd = repeaterDef.CreateEditableRepeaterItem();
erd.SetFieldValue("radiobuttongroup488", "2");
erd.SetFieldValue("radiobuttongroup150", "1");
formMod.AddRepeaterItem(erd);
formMod.ApplyChanges();
radiobuttongroup488 has "No" selected just fine but for radiobuttongroup150 nothing is selected when it should have "Yes" selected. There are no errors or exceptions, the code completes with no issue, its just not doing what is meant to be done.
Any and all advice is greatly appreciated!
05-31-2019 06:26 AM
Using the following code, I was able to set the values of all of the radio button groups.
var uftemp = app.Core.UnityFormTemplates.Find("RadioButtonTest");
StoreNewUnityFormProperties uFormProps = app.Core.Storage.CreateStoreNewUnityFormProperties(uftemp);
uFormProps.AddKeyword("Description", "Radio Button Test");
RepeaterDefinition repdef = uftemp.AllFieldDefinitions.RepeaterDefinitions.Find("repeater");
EditableRepeaterItem eri1 = repdef.CreateEditableRepeaterItem();
eri1.SetFieldValue("rbg1", "1");
eri1.SetFieldValue("rbg2", "0");
eri1.SetFieldValue("rbg3", "1");
eri1.SetFieldValue("textbox", args.Document.Name);
uFormProps.AddRepeaterItem(eri1);
Document newUnityForm = app.Core.Storage.StoreNewUnityForm(uFormProps);
Console.WriteLine(string.Format("Form Created: docid={0}.",newUnityForm.ID));
05-31-2019 06:26 AM
Using the following code, I was able to set the values of all of the radio button groups.
var uftemp = app.Core.UnityFormTemplates.Find("RadioButtonTest");
StoreNewUnityFormProperties uFormProps = app.Core.Storage.CreateStoreNewUnityFormProperties(uftemp);
uFormProps.AddKeyword("Description", "Radio Button Test");
RepeaterDefinition repdef = uftemp.AllFieldDefinitions.RepeaterDefinitions.Find("repeater");
EditableRepeaterItem eri1 = repdef.CreateEditableRepeaterItem();
eri1.SetFieldValue("rbg1", "1");
eri1.SetFieldValue("rbg2", "0");
eri1.SetFieldValue("rbg3", "1");
eri1.SetFieldValue("textbox", args.Document.Name);
uFormProps.AddRepeaterItem(eri1);
Document newUnityForm = app.Core.Storage.StoreNewUnityForm(uFormProps);
Console.WriteLine(string.Format("Form Created: docid={0}.",newUnityForm.ID));
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.