It is common practice to set entity properties (such as IsVisible, IsRequired, and List) when creating or modifying a new entity (New or FieldChanged). When writing ALM workflow scripts, it is also important to set entity properties when the entity comes into focus (meaning, when the user navigates to that entity in the ALM graphical user interface). When an entity comes into focus, the MoveTo event is called.
If entity values are not set in the MoveTo event, the end user experience is unpredictable—for example, incorrect values might be displayed in drop-down lists.
To avoid unpredictable results, such as a drop-down list not containing the most up-to-date set of values:
Make sure that all entity properties are set in the MoveTo event—not just in the New or FieldChanged events.
Isolate entity properties customization code into a separate routine and call that routine from all relevant events.
The following table provides an example of how to make sure that properties of a defect are set appropriately when the defect is in focus—and not just when it is modified or added.
Sub SetupBugFields(Context1, Context2) ' Code for customizing defect properties is entered here, ' such as set IsVisible, IsRequired, IsReadonly, Label, List... If Context1="Focus" Then ' Code for handling the focus event is entered here ElseIf Context1="FieldChange" Then If Context2="RQ_USER_01" Then ' Code for handling the FieldChange event ' is entered here ElseIf Context2="RQ_REQ_STATUS" Then ' ... Enter your code here Else ' ... Enter your code here End If End If End Sub Sub Req_FieldChange(FieldName) If FieldName = "RQ_REQ_STATUS" Then SetupBugFields("FieldChange", FieldName) Else ' ...Enter your code here End If End Sub Sub Req_MoveTo SetupBugFields("Focus") End Sub