Siebel CRM Desktop for Microsoft Outlook Administration Guide > Customizing Siebel CRM Desktop > Validating the Data That Users Enter >

Making Sure Users Enter Unique Values


You can use validation to make sure the value that the user enters in a field is unique.

To make sure the user enters unique values

  1. Make sure the form_validator object is defined.

    For more information, see Preparing to Use Validation.

  2. Add the following code to the forms.js file:

    validator.validate_unique_fields("fields_to_check","fields_to_highlight","string_key",boolean_skip_empty_fields);

    where:

    • fields_to_check is an array of fields. This array must be unique.
    • fields_to_highlight is an array of control identifiers that Siebel CRM Desktop highlights in the client if the validation fails.
    • string_key is the string key in the resource file that contains the text for the message that CRM Desktop displays in the client if the validation fails.
    • skip_empty_fields is an optional parameter that determines if CRM Desktop ignores empty fields when it compares records. You can set it to one of the following values:
      • true. Ignore empty fields.
    • false. do not ignore empty fields.

      For example, the following code makes sure the user enters an opportunity name that is unique for a given account:

    validator.validate_unique_fields(["Name", "AccountId"], ["opportunity","account_id"],"msg_opportunity_unique");

    where:

    • ["Name", "Account Id"] identifies the fields that, when combined, must be unique. In this example, the Name field plus the Account Id field constitutes this unique combination.
    • ["opportunity","account_id"] identifies the form controls that CRM Desktop highlights in the client if the validation fails. In this example, it highlights the control for the opportunity name and the control for the account name.
    • msg_opportunity_unique identifies the string key in the resource file that contains the text for the message that CRM Desktop displays in the client if the validation fails.
  3. Test your changes and then republish the customization package.

    For more information, see Republishing Customization Packages.

Siebel CRM Desktop for Microsoft Outlook Administration Guide Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Legal Notices.