Administering : Managing business rules and expressions : Business rule definition examples : ChoiceAttributeText example
  
ChoiceAttributeText example
In this example, the ChoiceAttributeText business rule is used to set up a workflow for requirements.The workflow must meet these conditions:
When the status is New, the workflow instructions are as follows:
If the requirement is proven to be a valid request, change
the status to Accepted. If the requirement is not valid, change
the status to either Rejected or Clarify.
When the status is changed to Accepted, the workflow instructions are as follows:
The requirements with the highest priority must be planned to
a release and estimate their costs. Change the status for these
requirements to Planned.
Set up the workflow for the requirements:
1 In the business rule container attribute for an element, enter:
=ChoiceAttributeText('Status',"write_defaults")
The business rule container attribute must be a Text attribute. Name the attribute; for example, Workflow.
2 Display the default XML template in the Description attribute in the top folder by clicking OK. The template XML code is placed in the Description attribute.
3 Click the Settings icon Settings icon and then, from the Configure group, click Attributes. Then, click Requirements.
4 Open the configuration page for Workflow, the business rule container attribute.
5 Enter the following new default value:
=ChoiceAttributeText('Status')
Update all the elements by clicking Copy Default Value to All Elements.
6 Click Modules > Requirements and select the top folder.
7 The Description attribute for the top folder contains the XML template code. Click Edit for the Description attribute, and then write your workflow instructions in the text parameter. For example:
<?xml version="1.0" encoding="UTF-8"?>
<texts>
<item id="47" text="If the requirement has proven to be a valid request, status should be changed to Accepted. If the requirement is not valid, change status to either Rejected or Clarify."/>
<item id="48" text="The requirements with the highest priority should be planned to a release and be estimated with regards to cost. Change status for these requirements to Planned and select a user as responsible for the requirement."/>
<item id="49" text="This requirement is ready for implementation. When implementation is started, change status to Started."/>
<item id="50" text="This requirement is being implemented. When done, change status to Completed."/>
<item id="51" text="This requirement is completed and is ready for test. If the requirements passes the test, change status to Verified."/>
<item id="52" text ="This requirement is ready for delivery."/>
<item id="53" text="This requirement is rejected. Enter a reason for the rejection in the Comments attribute."/> <item id="54" text="This requirement needs to be clarified."/>
</texts>
The item IDs in the XML code are the database IDs for the choice items. In this example, 47 corresponds to the New status and 48 corresponds to the Accepted status.
8 Save the workflow instructions by clicking OK.
An example of the workflow instructions for a New requirement.
Note For the workflow instructions to be displayed in the business rule container attribute, the status must be updated.
See also
ChoiceAttributeText business rule
Business rule definition examples