03-08-2023 09:06 PM
Hi,
I'm trying to copy all the values in a repeater from a previous form to a new form. Can someone advise if I'm on the right track?
Rendition rendition = document.DefaultRenditionOfLatestRevision;// Loop thru the repeater on the previous formforeach (RepeaterItem repeaterItem in rendition.UnityForm.AllFields.RepeaterFields.Find("internaltraining").RepeaterItems){ RepeaterItem repeaterItem2 = args.FormInstance.AllFields.RepeaterFields.Find("internaltraining").RepeaterItems; EditableRepeaterItem editableRepeaterItem = repeaterItem2.CreateEditableRepeaterItem();
03-09-2023 01:52 AM
Hi David,
It's been a long time but this is what I used to add a single value, it's coming from the SDK examples. In your case it looks you are on the right track, you just need to add the rest of the stuff (create a form modifier, then in the loop SetFieldValue and AddRepeaterItem), and at the end commit the changes with ApplyChanges.
Hyland.Unity.UnityForm.FormModifier formModifier = args.Document.UnityForm.CreateUnityFormModifier(); // Find the repeater definition for the repeater section we want to add a row toRepeaterDefinition contactRepeaterDefinition = args.Document.UnityForm.FormTemplate.AllFieldDefinitions.RepeaterDefinitions.Find(REPEATING_SECTION);// Create a repeater item ( a virtual new row) EditableRepeaterItem repeaterItem1 = ContactRepeaterDefinition.CreateEditableRepeaterItem();// set the fields in the new row (repeater item)repeaterItem1.SetFieldValue(COMMENT_FIELD, comment);//add the item we created to the repeating sectionformModifier.AddRepeaterItem(repeaterItem1); //commit changes to the form modifierformModifier.ApplyChanges();
03-09-2023 01:52 AM
Hi David,
It's been a long time but this is what I used to add a single value, it's coming from the SDK examples. In your case it looks you are on the right track, you just need to add the rest of the stuff (create a form modifier, then in the loop SetFieldValue and AddRepeaterItem), and at the end commit the changes with ApplyChanges.
Hyland.Unity.UnityForm.FormModifier formModifier = args.Document.UnityForm.CreateUnityFormModifier(); // Find the repeater definition for the repeater section we want to add a row toRepeaterDefinition contactRepeaterDefinition = args.Document.UnityForm.FormTemplate.AllFieldDefinitions.RepeaterDefinitions.Find(REPEATING_SECTION);// Create a repeater item ( a virtual new row) EditableRepeaterItem repeaterItem1 = ContactRepeaterDefinition.CreateEditableRepeaterItem();// set the fields in the new row (repeater item)repeaterItem1.SetFieldValue(COMMENT_FIELD, comment);//add the item we created to the repeating sectionformModifier.AddRepeaterItem(repeaterItem1); //commit changes to the form modifierformModifier.ApplyChanges();
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.