Copy related attributes

You can set up a window with attributes that are related to each other. When you select an attribute and tab or click away, its related attributes automatically populate with information.

For example, if the end-user, department and location attributes are related on the Incident window, then when you select a particular end-user and change focus off the selection, the relevant department and location details automatically appear.

After the related attributes are populated, you can modify the information within them. For example, you can change the department or location. When you click to save the information, you may no longer have the ability to modify the related attributes.

You configure the copy related attributes using the Copy Rules Configuration dialog.

A simplified version of copy rules is applied if you are using Workspaces. For more information, see Copy rules in Workspaces.

Setting up copy rules

Copy Rules enable you to specify that an attribute's current value is copied to another field when a specific event happens (for example when an attribute changes). You can configure copy rules for the following events:

Value Changed – The default value. The target value updates when you change the source value.

Initialize – Copies the value before the window is first displayed. You use this event type with an Attribute Macro (Current Group or Current User) because when the process is initialized there are no other attributes to copy from.

Create – When you save the record for the first time, copies the value.

Update – When you save the record on subsequent times, copies the value.

If you want to use the Value Changed event in the Console, you need to set the Copy Related property to True on the control(s) on the window. (For Web Access products, these rules will ALWAYS be applied, even if you do not set the Copy Related property to True on a window.)

To set up the Copy Rules Configuration:
  1. In Window Manager, select the required object, then in the Actions list, click Business Object Copy Rules.
    The Copy Rules Configuration dialog appears.

You can also access this dialog from the different module levels and the top Modules level in the Business Objects tree using the Module Copy Rules and All Copy Rules actions respectively. In these instances, the Copy Rules tree is larger, containing all of the objects under the selected level.

  1. Expand the Copy Rules tree and right-click the required object, then click New Rule.
    A new rule is added to the Copy Rules tree, and the Rule Editor changes to enable you to edit the new rule.
  2. Type a Description for the rule.
  3. Click Select Events.
    The Select Events dialog appears.
  4. Use the arrow buttons to move the events that you want to trigger the rule into the right-hand column.
  5. Alongside the Target box, click Select Attribute.
    The Select Attribute Path dialog appears.
  6. Double-click the attribute that you want to use as the target – the value will be copied TO here.
    The name of the attribute appears in the Path box.
  7. Click OK.
    The selected attribute appears in the Target box on the Copy Rules Configuration dialog.
  8. Alongside the Sources box, click Select Attributes.
    The Select Source Attributes dialog appears.
  9. Double-click the Attributes or Attribute Macros that you want to use as the source – the value will be copied FROM here.
    The values appear in the Source Attributes list.

You can select multiple source attributes. However, only one will be used – the attribute nearest the top of the Source Attributes list that contains a value. You can change the order of this list using the Up and Down buttons.

The Current Group and Current User macros are the only options suitable for use with the Initialize event.

  1. Click OK.
    The selected values appear in the Sources box on the Copy Rules Configuration dialog.
  2. Select the Always execute rule check box if you want the rule to be applied whenever any copy rule event on the window is triggered.

The effect of this check box is noticeable only if you have more than one copy rule on a window. For example, add two Value Changed copy rules to a window and trigger both of them. Then manually edit the target value of the second, and change the value of the first again to re-trigger the copy rule.
If you have selected the Always execute rule check box for the second attribute, then changing the first attribute reapplies the copy rule for the second attribute, overwriting your edit.
If you have not selected the Always execute rule check box for the second attribute, then changing the first attribute does not reapply the copy rule for the second attribute, and leaves your edit.

  1. In the Overwrite Policy group, select the required option button to set whether you want the copy rule to Overwrite or Do not overwrite any existing values. If you choose to overwrite any existing values, selecting or clearing the Clear target if source is empty check box enables you to configure whether or not the target attribute is cleared if the changed source attribute is empty.
  2. Click OK.
    The copy rule is configured.

If you are using the Value Changed event, remember to set the Copy Related property to True on the control(s) on the window using Window Manager.

Copy rules in Workspaces

The copy rules used in Workspaces are the same copy rules set up and described above, but are simplified. Copy rules in Workspaces are available only for attributes of data type String (including HTML), Int16, Int32, Decimal, and related objects such as reference lists and categories. Related objects that are targets of copy rules cannot trigger further copy rules, but they will provide related fields and calculations triggered by the target of the copy rule.

Workspaces will not allow recursive chaining of copy rules. If the target of a copy rule has already been used as the source of a previous copy rule in the chain, an error is added to the diagnostic log to identify the cause. However, the previous copy rules in the chain are executed appropriately.