How to access form fields in Server Side Script v9 - SET/GET

The example i've seen says to declare an object using the Form name, which shows me the list of fields in the designer, but gives me an error when I try to compile (Namespace name ''  could not be found)

 

if my Form name  == Payments

 

public static object ShowPayments (Payments.Declarations.Local FormFields)

{

FormFields.Fields.Fieldname = "Value";

}

 

Can someone give me a proper example?

Tagged:

Comments

  • Hi, you can access the underlying variables of formfields in a server side script by creating an instance of your process.. For example:

     

    namespace Metastorm.Runtime.Models.MyBPMProject

      {

        public class MyScripts

          {

            public static void MyTest()

              {

                MyProcess mp = new MyProcess();

                mp.MyProcessData.txtTest1 = "Hello";

              }

          }

      }

     

    ...where MyBPMProject is the name of the Project, MyProcess is the name of your process and txtTest1 is the name of a variable under the process (this variable is also the business object that feeds a Textfield on the form). You wouldn't be acting directly on the form's controls in this example, rather the variables which should be tied to those controls on the form.

  • Yes, thank you, I am sorry I must be more specific.

     

    The form in question is part of a library and has been assigned Local variables.

     

  • I see the same issue when working with admin forms and Local variables.

     

    In the Designer User Guide it states:

     

    31.3.5 Passing Form Local and Process Business ObjectsThe same technique works for Process Business Objects and Forms' Local Business Objects. However, forthese types of Business Object we have to identify the Business Object type using a slightly differentformat. The Business Object type cannot be identified by its name alone. In this case we use .Declarations.Local to identify a form's Local Business Object. We use .Declarations.Data to identify a process's Business Object.

     

    But when I try to acces the fields by creating an object it shows me the fields in the member list but the designer stil saus that the formname could not be found. 

     

    so the question is

     

    How do I access form that are not directly related to a process, like Admin forms and Library forms in server side scritps?