cancel
Showing results for 
Search instead for 
Did you mean: 

How to check if a field is empty on a Unity form?

David_Chatterto
Star Collaborator
Star Collaborator

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));

}

10 REPLIES 10

@George Sialmas it's a custom action event being called on a Unity form.

 

@David Taylor thanks, your suggestion worked.