Need help on customizing Defect module -Project entitles ALM
Tags:
Question ID: 107855
1
0

Need help on customizing Defect module > Project entitles

I have created two fields

1. Defect type field (List box) – Mandatory field
2. Data Migration Object (List Box) – Optional field

I want to know whether I could make Data Migration Object field becomes Mandatory for one field value of Defect type field and optional for rest of the values

Marked as spam
Posted by (Questions: 17, Answers: 5)
Asked on September 7, 2017 3:41 pm
156 views
Answers (2)
1
Private answer

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

Marked as spam
Posted by (Questions: 2, Answers: 300)
Answered on September 8, 2017 9:45 pm
1
Private answer

To do something like this you would need to create some workflow code, I have created a sample of some code that you could use to do this. I would try
this in a test project first to make sure that it works ok in your environment.

Following is the sample of code that is required in ALM(ALM-Project Customization -Work Flow-Script Editor-Defect Module Script) for Data Migration Object
the field becomes Mandatory for one field value of Defect type field and optional for rest of the values.

One section of code would be placed in the Bug_FieldChange sub routine so that it is triggered when a user changes the value of the defect type. Copy out the nested if statement below between the ''on error resume next'' and the ''on error go to 0'' and paste it in the same Bug_FieldChange sub routine in your environment, you will need to change the names of the fields and values as they will not match up to what you see in your environment, you can find the name of the fields in project entities under customization.

Sub Bug_FieldChange(FieldName)
On Error Resume Next
If Bug_Fields.Field(''BG_USER_01'').IsModified then
if Bug_Fields.Field(''BG_USER_01'').Value=''type 2'' then
Bug_Fields.Field(''BG_USER_02'').IsRequired=True
Else
Bug_Fields.Field(''BG_USER_02'').IsRequired=False
End If
End If
On Error GoTo 0
End Sub

Another section of code would be placed in the Bug_MoveTo sub routine so that it is triggered when a user navigates between defects or opens an already created defect. Copy out the if statement below between the ''on error resume next'' and the ''on error go to 0'' and paste it in the same Bug_MoveTo sub routine in your environment, you will need to change the names of the fields and values as they will not match up to what you see in your environment, you can find the name of the fields in project entities under customization.

Sub Bug_MoveTo
On Error Resume Next
if Bug_Fields.Field(''BG_USER_01'').Value=''type 2'' 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

Marked as spam
Posted by (Questions: 0, Answers: 23)
Answered on September 8, 2017 9:45 pm
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top