Previous Topic: How to Pre-Populate Text Fields in CA Workflow Forms

Next Topic: How to Create Groups and Tabs in CA Workflow Forms


Define Attributes for Pre-Populated Text Fields

In CA Workflow, you can create text fields on forms as needed. To pre-populate text fields, you must follow the steps in this section. These steps include adding several new attributes required for the key field, the field used to capture the data used to pre-populate other text fields. This topic continues the Employee ID example started in How to Pre-Populate Text Fields in Forms.

To define attributes for pre-populated text fields

  1. Ensure that you have selected the form you want to use and that the fields you want to pre-populate are already created. If you need to create any of these fields, do so now, as explained in Modify a Form to Include New Text Fields.
  2. Ensure that the id of each pre-populated text field matches exactly (including case) the corresponding database field in the query for the report data object, as explained in How to Pre-Populate Text Fields in Forms.

    To continue the Employee ID example started in that section, ensure that the following text fields are created, and that their id attributes on the form exactly match the corresponding field names in the database: First Name, Last Name, Phone Number, Email Address, and Physical Address.

    If necessary, follow the steps in Modify a Form to Include New Text Fields to create these fields and specify their attributes.

  3. Open the form that you want to edit. For details, if necessary, see Modify a Form to Include New Text Fields.
  4. On the form, select the key input field.

    To continue the Employee ID example, open the Employee Termination form and select the Employee ID field.

    The existing attributes for that field appear in the field attribute table on the bottom part of the screen: The Name and Value columns display the names and values of each attribute for the selected field. The names of the default attributes for the Employee ID field are id, label, required, and value. Your screen appears similar to the following:

    The CA Workflow form designer shows all existing fields, with the names and values of their attributes.

  5. To create a new attribute for the selected field (Employee ID), click the green plus (+) sign icon next to the Name column of the field attribute table.
  6. In the row for the new attribute, click the drop-down list in the Name column and select the name of any option, such as hint.

    That name appears as the new entry in the Name column.

  7. Double-click that name to select it.

    Both the name and value blocks are highlighted.

  8. Keeping your cursor in the Name block, type over the existing name and enter the new name: icon.

    Double-click inside the value column and enter the path name to the custom image (such as a magnifying glass) to use as a search icon on the form.

    The default value is custom/images/icon.gif, without additional drive or directory specifications.

    To use an alternative image file (filename.gif), copy it to the custom/images folder and specify custom/images/filename.gif in the value column.

    Note: When users click this icon on the form, an action occurs. This action is specified by the icon_action attribute, which is described in a later step.

  9. Save your changes by clicking OK to close the form.
  10. Open the form again to continue defining attributes.
  11. Select the Employee ID field again, and specify the following new attributes, using the previous steps as a model:
    Name=icon_action

    icon_action is the fixed attribute name.

    Value=pre-supplied or custom function

    Specifies the JavaScript function to run when the end user completing the form clicks the icon specified by the previous attribute (icon). The JavaScript function is either the ca_PopupVariableWindow(customMain) function or a custom function, as follows:

    Value=ca_PopupVariableWindow(customMain)

    The ca_PopupVariableWindow(customMain) function prompts the user to enter a value for the key input field. Using that value, the function runs the query for pre-populating the text fields.

    In the Employee ID example, the function prompts the user to enter the user ID, and then uses that user ID to run the query for pre-populating the text fields with related personnel data such as first and last names, email address, and so forth.

    Value=customCallback(custom function)

    Specifies the name of the custom JavaScript function to run.

    You must use the customCallback function to call your custom function. The customCallback function is included in the custom_form_example.js file.

    Specify custom functions in the custom_form_lib.js file or custom_form_example.js file, as explained in JavaScript Functions for Reuse, Customization, and Troubleshooting.

    Name=icon_tooltip

    icon_tooltip is the fixed attribute name.

    Value=tooltip

    Specifies a text string that provides the tool tip text for the icon. When users mouse-over the icon, this text displays above the icon to explain its function.

    Name=prefill

    prefill is the fixed attribute name.

    Value=report data object

    Specifies the id of the report data object that retrieves the data used to pre-fill the text fields on the form.

    Example: $report_data.78870b102af20c13425451163b2d2370-7ff41195054288150$

    Note: The field attributes named icon, icon_attribute, and icon_tooltip are specific to the CA Service Catalog implementation of CA Workflow and therefore may not be supported in another CA product's implementation of CA Workflow.

  12. Click OK to close the form and save your changes.
  13. Save the process definition through which you accessed the form (USM_Forms_Container).
  14. Customize and test the form, as explained in JavaScript Functions for Reuse, Customization, and Troubleshooting.

    If necessary, refine the form, export it again, and test it until it works successfully.

  15. Finalize the form so that you can test it in actual requests; for details, see Finalize the Form.

Finalize the Form

To finalize the form, preview it and adjust it as needed, and then export it.

To finalize the form

  1. Click Preview to see how your form appear to users. Make any necessary adjustments.
  2. Click Export.

    The browse dialog appears.

  3. Browse to the USM_HOME\filestore\forms folder and save the form with a new file name, such as Personnel Data for Emp Term.xml.

    Important! Ensure that you use a different file name, to prevent your changes from being accidentally overwritten by a default form included in a later patch or upgrade. Keeping the original form intact is also helpful in case you need to verify the default contents of the form later for any reason.

  4. Click OK on the Form Designer.
  5. Check the Form Designer and verify that your form appears and functions as you intended.

    Note: For troubleshooting help with pre-population and JavaScript functions, see JavaScript Functions for Reuse, Customization, and Troubleshooting.

  6. If necessary, refine the form, export it again, and verify that it meets your requirements.

    Note: Remember that the Employee ID example, is not intended as an end product to "plug into" your system as-is but rather as an illustration to demonstrate how you can modify the default forms to match your organization's unique resources and needs.

    You are ready to include this form in a service or service option group, so that you can test it in an actual Catalog request.