cancel
Showing results for 
Search instead for 
Did you mean: 

Get Unity Form fields using Unity Script

Ari_Alves_Ribei
Champ in-the-making
Champ in-the-making

Hi team,

I created a form that contains a Unity multiline text field.
This field is named "txtMensagem" and is not associated with any keyword
This form is in a workflow where through unity script, I need to retrieve the value of this field.
I am using the following commands:

                    // Carrega as informações do documento
                    Document objDoc = args.Document ;
                    if ( objDoc == null )
                    {
                        throw new Exception("eMail Resposta não encontrado.");
                    }
                    else
                    {
                        app.Diagnostics.Write( string.Format("eMail Resposta id=<{0}>" , objDoc.ID.ToString() ) );
                    }

                    // Texto do eMail
                       Hyland.Unity.UnityForm.Form objForm = objDoc.DefaultRenditionOfLatestRevision.UnityForm;
                    app.Diagnostics.Write("objForm com sucesso");
                    
                    // Accessing Unity Form fields and repeaters
                    Hyland.Unity.UnityForm.FieldList objFormFields = objForm.Fields;
                    app.Diagnostics.Write(string.Format(  "formFields com sucesso=<{0}>" , objFormFields.Count.ToString() )  );

                    foreach ( Hyland.Unity.UnityForm.Field objField in objFormFields )
                    {
                        app.Diagnostics.Write( string.Format ("Field <{0}> = <{1}>", objField.ToString() , objField.Value.ToString() ) ) ;    
                    }

The problem is that the object objFormFields with this property with objFormFields.Count = 0




2 REPLIES 2

Not applicable

In this case, the field should be available in your fields list. Do you have any other configurations on the field or form that may be securing this field or making it not part of the form? Does this happen with all of your documents of this type, even new ones?

Ari_Alves_Ribei
Champ in-the-making
Champ in-the-making

Hello Alicia,


After some testing, I noticed that when creating a field of type text (field) form the unity without being tied to a keyword, the interface suggests a name for himself as an example: fieldtext9.
I was changing its name to a name more suggestive, in my case txtMensagem.
For some reason, the interface was not saving eForm that I changed the name, and for this reason could not find the field.
As I used the original name "fieldtext9", the application started to work.

Thanks for your suggestions