Testing custom artifacts

You can validate the values of custom artifact types when they are created.

The following example shows how to do this with rules and scripts. For this example, the Object Type is Artifact, the custom artifact type is Corporate User, and the script name is Corporate User ID.

  1. Create a script that validates the value of an artifact value.
    import re 
    if not artifact.value.startswith('cu'):
      helper.fail("The artifact value for a Corporate User [" + artifact.value + "] must start with CU")
  2. Create a rule that executes when the custom artifact type is created. The surrounding text describes this graphic, which is a snap shot of the user interface.
  3. As a user, create an instance of a custom artifact type that does not meet this rule and verify that you see the message configured in the script.