Previous Topic: How to Hide, Enable, or Disable an Entire Form Under Specified ConditionsNext Topic: How to Populate Fields Based on User Input to a Report Data Object


How to Use JavaScript Functions in Fields

CA Service Catalog provides several options for performing automated tasks in form fields, including report data objects, JavaScript expressions, and JavaScript functions. This topic provides an overview of how you may use JavaScript functions for this purpose.

  1. If you have not already done so, review the information in How to Perform Automated Tasks for Fields to help decide whether to use a JavaScript expression or a JavaScript function to perform an automated task for one or fields on a form. If you decide to use a JavaScript function, continue following this topic.
  2. Review the pre-defined JavaScript functions and review how to validate the format of commonly requested data to determine how to meet your requirements. Where applicable, review the examples in these topics and optionally use them as models.
  3. If none of the pre-defined functions meets your goals, then write your own custom function:
  4. As needed, specify JavaScript functions to link fields in two forms for simultaneous updates, so that when a user updates a field in one form, the linked field is automatically updated with the same change.
  5. Using all applicable from the previous steps, construct and test the JavaScript function to accomplish your goals for the fields on the form.
  6. As a best practice, ensure that you test the function in a form used with a service in a test environment before you use the form and the service in a production environment.