SudiptaS Absent Member.
Absent Member.

Make a defect field conditional manadatory when another defect field value changes

Make a defect field conditional manadatory when another defect field value changes

We have a defect workflow like below:

New-> Assigned-> Fix In Progress-> Fixed-> Ready to retest in SIT-> Ready to restest in target env-> Retest Passed-> Closed as passed and so on.

I have requirement to make a defect field named 'Target Resolution Date' to become manadatory when the defect status changes from Assigned to Fix In Progress and remain mandatory fo remainder of defect lifecycle.

What i have tried is mentioned below.

1) Made Target Resolution Date as mandatory from Project Entity.

2) Then wrote code in Bug New, Bug MoveTo, Bug Field Change to made it non manadatory when defect is in either status New or Assigned.

3) Then wrote code in Bug Field Can Change section to display a massage box 'You need to fill Target Resolution Date in order to move the status to Fix In Progress from Assigned.' and restrict someone from changing the status from Assigned to Fix In Progress without providing Target Resolution Date.

Now i can see Target Resolution Date is not mandatory when defect is in status New or Assigned. All, existing defects raised previously and are not in status New or Assigned have Target Resolution Date as manadatory sign (Red sign). And filter set as mentioned in step 3 working correctly. So far so good.

Now coming to the real problems. I am facing below problems.

1) If i change any defect field value be it status or priority or severity or target resolution date, of any existing defects with Target Resolution Date set as manadatory, and click submit then Target Resolution Date becomes non mandatory from mandatory. This happens for each defect with status beyond Assigned (Fix In Progress or Fixed or Ready to retest in SIT etc)

2) If i open any existing defect with target resolution date set as mandatory and having no value in target resolution date and click on submit without making any modification then the system doesn't promt user to fill the target resolution date.

3) After i set target resolution date when making the status change from Assigned to Fix In Progress, Target resolution remains non mandatory and remain non mandatory when the defect flows from Fix In Progress to Fixed and so on.

Can anybody of you help me to fix these three problems as i need to implement this change in 1-2 days.





2 Replies
Damodar-Reddy Acclaimed Contributor.
Acclaimed Contributor.

Re: Make a defect field conditional manadatory when another defect field value changes

Remove the First step, Uncheck the Mandatory field option in that customization.

& Remember, if you make any changes to the customization in any module the existing data wont be disturbed unless and untill if you try to open it. in your case, the changes will be applicable as soon as you open the existing defects & you may not be able to come out unless you filled the form completely with all the mandatory options. this is common for any module in ALM.

Share your entire code here once.

(If this helped, accept as solution )
(Posts and opinions made here are my own and do not reflect the opinions of my employer)
cmt8455 Absent Member.
Absent Member.

Re: Make a defect field conditional manadatory when another defect field value changes

Hi Sudipta. Try this (replace the user field name with yours):

Place in Bug_New:
Bug_Fields.Field("BG_USER_01").IsRequired = False

Place in Bug_MoveTo:
If Bug_Fields.Field("BG_STATUS").Value = "Ready to retest in SIT" Or Bug_Fields.Field("BG_STATUS").Value = "Retest" Or _
<enter lines for other status values after Fix in Progress> Then
         Bug_Fields.Field("BG_USER_01").IsRequired = True
  End If

Place in Bug_FieldCanChange:
Bug_FieldCanChange = True
If FieldName = "BG_STATUS" And Bug_Fields.Field("BG_STATUS").Value = "Assigned" _
       And NewValue = "Fix In Progress" Then
         Bug_Fields.Field("BG_USER_01").IsRequired = True
    End If

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.