Jira - Findings&Followups should be filled before review task is closed
Asked by mummareddy supriya:

Jira - Findings\&Followups should be filled before review task is closed

Currently if user does not fill 'Reviews \& FIndings', they can still close the 'Review' Type tikcets.

Need to set condition to check if its filled before closing the review task or it should show error to fill and shouldn't allow to move to CLOSED status.

Option-1: User should choose one of the status 'Corrected','Rejected','Postpone' in REVIEW FINDINGS to move status to CLOSED.

If above option is not feasible, Try the below

Option-2: Only if the status of the checklists in "Review Checklist - Type Specific:" is DONE, user should transition to CLOSE.


Answers:
author: John Funk
body: Hi Mummareddy,

You should add a Field Required validator to the transition going to Closed in your workflow.

comments: author: mummareddy supriya
body: [@John Funk](/t5/user/viewprofilepage/user-id/7148) I configured as below but its not working, may i know that if i need to add anything here please let me know![review.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/333937i9A6FD5A0A70F9E39/image-size/large?v=v2&px=999 "review.PNG")

Thanks in advance


author: John Funk
body: You should have a regular Field Required validator and not have to use a plugin. Can you share a screen shot of the options for Add Validators?

![Screenshot.png](https://community.atlassian.com/t5/image/serverpage/image-id/333941i54E4CA7894E2C703/image-size/large?v=v2&px=999 "Screenshot.png")


author: mummareddy supriya
body: [@John Funk](/t5/user/viewprofilepage/user-id/7148) I need to Achieve this below scenario,Please guide me here how can i do it

Option-1: User should choose one of the status 'Corrected','Rejected','Postpone' in REVIEW FINDINGS to move status to CLOSED.

If above option is not feasible, Try the below

Option-2: Only if the status of the checklists in "Review Checklist - Type Specific:" is DONE, user should transition to CLOSE.

IS it possible to check if we can have a JQL to see if we can filter out the checklists based on the above mentioned statuses and have a NOT condition. If True, error message to appear.![review finding.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/334499i1EB8C5632CC4B15B/image-size/large?v=v2&px=999 "review finding.PNG")

Using with Required field validator unable to set above condition User should choose one of the status 'Corrected','Rejected','Postpone' in REVIEW FINDINGS to move status to CLOSED.![review checklist.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/334500i63F2E046552DA597/image-size/large?v=v2&px=999 "review checklist.PNG")

Thanks in advance


author: John Funk
body: So you probably need two different transitions to Done - one with the Condition where the conditions meet what you have in number 2 above (like what you have with JSU above) and the other one where it does not meet those conditions. Then add a transition screen with the Resolution field in the screen for the second transition.


author: mummareddy supriya
body: [@John Funk](/t5/user/viewprofilepage/user-id/7148) ,In Workflow validator i took custom script runner ,using groovy script i'm trying to Achieve the this point Option-1: User should choose one of the status 'Corrected','Rejected','Postpone' in REVIEW FINDINGS to move status to CLOSED.

The below script i used,i'm able to feth Review findings with ID(example:12345)but unable to fetch the status of review findings values like Corrected','Rejected','Postpone.I'm getting the error as need to fill one of this values corrected and rejected but i filled it in ticket.Script is unable to fetch it may i know reason please.Can you please guide me how can i fetch the status of review find![Item1.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/335159i406F425DD8EB517A/image-size/large?v=v2&px=999 "Item1.PNG")

Script:import com.atlassian.jira.component.ComponentAccessor  
import com.opensymphony.workflow.InvalidInputException  
import org.apache.log4j.Logger  

def customFieldManager = ComponentAccessor.getCustomFieldManager()  
def debugLogger = Logger.getLogger("com.acme.YourPlugin")  

def reviewFindingsField = customFieldManager.getCustomFieldObject(12345) // Use the custom field ID directly  

if (reviewFindingsField == null) {  
throw new InvalidInputException("Error: The custom field with ID 12345does not exist.")  
}  

// Retrieve the custom field value (handle collections)  
def reviewFindingsValues = issue.getCustomFieldValue(reviewFindingsField)  
if (reviewFindingsValues == null \|\| reviewFindingsValues.isEmpty()) {  
throw new InvalidInputException("Error: The REVIEW FINDINGS field is empty.")  
}  

// List of allowed IDs and names  
def allowedValues = \[  
"corrected": "Corrected",  
"rejected": "Rejected",  
"postpone": "Postpone"  
\]  

// Check the type of the reviewFindingsValues to understand its structure  
debugLogger.debug("Review Findings Values Type: " + reviewFindingsValues.getClass().getName())  

// Initialize a list to collect extracted IDs  
def extractedIds = \[\]  

// If reviewFindingsValues is a collection, iterate through each value  
if (reviewFindingsValues instanceof Collection) {  
reviewFindingsValues.each { checklistItem -\>  
def checklistItemId = checklistItem.toString().toLowerCase() // Assuming checklistItem is a string  
extractedIds.add(checklistItemId)  
}  
} else {  
def checklistItemId = reviewFindingsValues.toString().toLowerCase() // Assuming reviewFindingsValues is a single value  
extractedIds.add(checklistItemId)  
}  

// Check if any of the extracted IDs are in the allowed IDs  
if (extractedIds.any { allowedValues.keySet().contains(it) \|\| allowedValues.values().contains(it) }) {  
return true  
} else {  
throw new InvalidInputException("Error: The REVIEW FINDINGS field must be set to 'Corrected', 'Rejected', or 'Postpone' to close this ticket.")  
}

Thanks in Advance


author: John Funk
body: Thanks for sharing, but I am not an expert on ScriptRunner. Why not just add a simple transition screen with that field on it for the transition to Done? And then add a simple built-in Validator to make sure the field is not empty (Field Required Validator)?


author: mummareddy supriya
body: I tried using Field Required Validator , In that we just have option to mention which field should be empty.but not having option to check whether user has filled the status to Done or with some other status.So I through as it wont work for this scenario![type specific.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/335190i96D09939E93AFBF9/image-size/large?v=v2&px=999 "type specific.PNG")


author: John Funk
body: The other way to do that would be to create a self looping transition with the Transition Screen. Include your Field Required Validator to make sure that it is filled in. Then have an automation rule based on the item status/resolution field being updated that will auto transition to the correct workflow status.


author: mummareddy supriya
body: I'm not sure how to do it ,if possible can be little clear on this.If possible please provide me steps how can i dot it please ,a self looping transition with the Transition Screen.

Thanks in advance .


author: John Funk
body: Sorry - You create a new transition that goes from a status back to itself. In other words the to and from statuses are exactly the same. It's known by some as a looping transition.


Tags: cloud

jira-cloud