Hello @Manideep. I have entered the workflow script below, that will perform the functions that you are looking for. To access the workflow, you will need to go into Customize, then select 'Workflow' in the left-side menu. In the 'Workflow' menu, you will select 'Script Editor'. Once in the 'Script Editor', you will need to expand the 'Defects module script' section. After you enter the workflow that I have listed below, save your changes, select 'Return', then 'Major Change'.
First, I would like for you to enter the following script into Sub Bug New:
''FieldCust_AddDefect''
Example below:
Sub Bug_New
On Error Resume Next
FieldCust_AddDefect
On Error GoTo 0
End Sub
Next, you will enter the following script Into Sub Bug_FieldChange(FieldName). You will need to edit the field names, and the values within the if statement to meet your needs:
If Bug_Fields.Field(''BG_USER_01'').Value = ''Defect_Type_A'' Then
Bug_Fields.Field(''BG_USER_02'').IsRequired = True
Else
Bug_Fields.Field(''BG_USER_02'').IsRequired = False
End If
Example below:
Sub Bug_FieldChange(FieldName)
On Error Resume Next
If Bug_Fields.Field(''BG_USER_01'').Value = ''Defect_Type_A'' Then
Bug_Fields.Field(''BG_USER_02'').IsRequired = True
Else
Bug_Fields.Field(''BG_USER_02'').IsRequired = False
End If
On Error GoTo 0
End Sub
Lastly, you will need to enter the following script to set the placement of the defect fields in the specified order. I used this, because the Data Migration Object field would move when it was set to required, and then move back to its original location when it was set back to optional. This prevents the field from moving.
You can add or remove fields from this last block to fit your need. Scroll to end of the defects module script, and enter this script after the final 'End Sub' statement. The first true / false determines if the field is displayed / not displayed, and the second true / false determines if the field is required / optional.
Example below:
Sub FieldCust_AddDefect
On Error Resume Next
' Initialize the fields of the defect
For i= 0 To Bug_Fields.Count -1
SetFieldApp Bug_Fields.FieldByID(i).FieldName, _
False, False, 100, 0
Next
ViewNum = 0
PageNum = 0
' Set fields that are in common for all new defects
SetFieldApp ''BG_USER_01'', True, True, PageNum, ViewNum
ViewNum = ViewNum + 1
SetFieldApp ''BG_USER_02'', True, False, PageNum, ViewNum
ViewNum = ViewNum + 1
SetFieldApp ''BG_BUG_ID'', True, True, PageNum, ViewNum
ViewNum = ViewNum + 1
SetFieldApp ''BG_DESCRIPTION'', True, False, PageNum, ViewNum
ViewNum = ViewNum + 1
SetFieldApp ''BG_SUMMARY'', True, True, PageNum, ViewNum
ViewNum = ViewNum + 1
SetFieldApp ''BG_DETECTED_BY'', True, True, PageNum, ViewNum
ViewNum = ViewNum + 1
SetFieldApp ''BG_DETECTION_DATE'', True, True, PageNum, ViewNum
ViewNum = ViewNum + 1
SetFieldApp ''BG_DETECTION_VERSION'', True, True, PageNum, ViewNum
ViewNum = ViewNum + 1
SetFieldApp ''BG_SEVERITY'', True, True, PageNum, ViewNum
ViewNum = ViewNum + 1
SetFieldApp ''BG_PRIORITY'', True, True, PageNum, ViewNum
ViewNum = ViewNum + 1
SetFieldApp ''BG_PROJECT'', True, False, PageNum, ViewNum
ViewNum = ViewNum + 1
SetFieldApp ''BG_REPRODUCIBLE'', True, False, PageNum, ViewNum
ViewNum = ViewNum + 1
SetFieldApp ''BG_STATUS'', True, False, PageNum, ViewNum
ViewNum = ViewNum + 1
PrintError ''FieldCust_AddDefect''
On Error GoTo 0
End Sub
I hope