Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

mummareddy supriya
Contributor
July 7, 2024

 

 

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.

1 answer

0 votes
John Funk
Community Champion
July 8, 2024

Hi Mummareddy,

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

mummareddy supriya
Contributor
July 8, 2024

@John Funk I configured as below but its not working, may i know that if i need to add anything here please let me knowreview.PNG

Thanks in advance

Like John Funk likes this
John Funk
Community Champion
July 8, 2024

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

mummareddy supriya
Contributor
July 9, 2024

@John Funk 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

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

Thanks in advance

Like John Funk likes this
John Funk
Community Champion
July 10, 2024

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. 

Like mummareddy supriya likes this
mummareddy supriya
Contributor
July 11, 2024

@John Funk ,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 findItem1.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

Like John Funk likes this
John Funk
Community Champion
July 11, 2024

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)?

mummareddy supriya
Contributor
July 11, 2024

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 scenariotype specific.PNG

John Funk
Community Champion
July 11, 2024

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. 

Like mummareddy supriya likes this
mummareddy supriya
Contributor
July 11, 2024

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 .

John Funk
Community Champion
July 12, 2024

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. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events