01-29-2023 09:26 PM
The below works, it outputs an empty value to the diagnostic console. However if I try to check if the siteManager field is empty, I get an error.
// Returns the current FormInstance
CustomActionForm thisForm = args.FormInstance;
// Initialize a new form modifier for changing a field.
FormModifier formModifier = thisForm.CreateUnityFormModifier();
// Return the name of the form
string formName = thisForm.FormTemplate.Name;
if (formName == "Trainee Development Review")
{
ValueField fieldValue = thisForm.AllFields.ValueFields.Find("sitemanager");
app.Diagnostics.WriteIf(Diagnostics.DiagnosticsLevel.Verbose,
String.Format("SiteManager is empty? = {0}", fieldValue));
}
01-29-2023 09:38 PM
if (fieldValue.IsEmpty)
Good luck,
GS
01-29-2023 09:48 PM
Even when I write to diagnostics, if the field is not empty, I see the value in the diagnostic console. If it IS empty, I see an error.
01-29-2023 10:03 PM
In any case, can you try something for me? Instead of the code you mentioned in your initial post
string fieldValue = thisForm.AllFields.ValueFields.Find("fieldname").Value;
Can you replace it with the following? Use the ValueField class
ValueField fieldValue = args.FormInstance.AllFields.ValueFields.Find("fieldname");
Then use the following to evaluate if the property fieldValue is null.
if ((string.IsNullOrWhiteSpace(fieldValue ) || (fieldValue.IsEmpty))
Good luck,
GS
01-29-2023 10:41 PM
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.