Computed (AutoName) Attributes - tsgrp/HPI GitHub Wiki

Overview

Computed attributes are attributes that are comprised of other attributes for the object and other hard-coded characters/tokens. This is something that is useful when a client wants to something like auto-name a document name based on some attributes on the document.

How-To

  1. In the OTC in admin, select your object type and the attribute you want to be an autoname attribute.

  2. From the 'Control' dropdown, select 'Computed'. You will see a text box called 'Pattern' appear and a dropdown with a list of all the attributes for the object type and a 'Add To Pattern' button.

  3. In the 'Pattern' text box will be where you will construct how the attribute will look. You have two options to add attributes to the pattern. First, you can select the attribute from the dropdown and click 'Add To Pattern', which will append the attribute in the pattern format (with a '$' on either side of the ocName) to the end of the pattern. You can also just type in the attribute in the correct format ('$'attr_oc_name'$').

  4. You can add delimiters and other such things into the pattern (hyphens, underscore, etc) as needed.

Here are a few examples of patterns and what they would look like as attributes:

  • $subject$_$title$ --> Elephants_Extinction Report
  • $site$-$department$-$subject$ --> Greencastle-Balloons-Helium Storage
  • The Hartford - $subject$ --> The Hartford - Quarterly Financial Review
  • $objectName$$location$$objectName$_$status$ --> Back_Streets_Back_Alright

A Few Notes:

  • Do not make a computed attribute depend on a repeating attribute, it will have unsavory results
  • If an attribute that the computed attribute depends on doesn't have a value, the token in the pattern will be replaced by an empty string ($subject$$title$ --> 'Elephants' if title is blank). Therefore, if you don't want the computed saved as an 'incomplete' value, make sure the attributes it depends on are required.
  • A computed attribute is not editable by the user (kinda defeats the purpose!), the input is grayed out like a non-repo editable attribute.
  • You can use an attribute more than once in the same pattern, if that's something that you need for some reason