02-22-2022 01:07 AM
I'm stumped at trying to make the following code work to set the default values on editable repeater items. I have the following EditableRepeaterItem overload method that always returns null for the vfDefault object, even though the unity form's field definition for the repeater item fields have default values set. Any help would be appreciated.
Basically, I'm trying to use the AddRepeaterItem and UpdateRepeaterItem methods to add and update repeater item field values to their Unity Form's default values via Unity Script.
public static void SetDefaultValues (this EditableRepeaterItem itemEdit)
{
foreach (ValueField vf in itemEdit.AllFields.ValueFields)
{
ValueField vfDefault = vf.FieldDefinition.CreateFieldWithDefaultValue();
if (vfDefault == null)
itemEdit.ClearFieldValue(vf);
else
itemEdit.SetFieldValue(vfDefault);
} // foreach
} // function - SetDefaultValues
The overload method is invoked as follows in the OnCustomActionExecuteAction event handler:
form = args.FormInstance;
fMod = form.CreateUnityFormModifier();
RepeaterItem activeItem = form.ActiveRepeaterItem;
EditableRepeaterItem activeItemEdit = activeItem.CreateEditableRepeaterItem();
activeItemEdit.SetDefaultValues();
fMod.UpdateRepeaterItem(activeItemEdit);
fMod.ApplyChange();
Steve Perucca
UCCS Senior IT Professional
OnBase System Administrator (certified)
03-30-2022 01:23 PM
Hi
If you are still trying to get CreateFieldWithDefaultValue() method with Repeater Item value fields to work, you can reach out to OnBase API Support.
To receive direct support from the Hyland API Support team, you or a member of your organization needs to have completed the OnBase API Certification Course (OCAPI). This requirement is in place to ensure that code troubleshooting be done with a person that is familiar with the OnBase APIs.
Thanks!
~Alan
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.