Forums

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

Workflow Validator for Required Field

Lindsay Edwards November 14, 2023

I am working on creating a workflow validator when transiting a story to Done. I need to require the custom Story Points field to be filled out. 

if (issueType=="Story") {
if (hasInput("customfield_10106")) {
return true;
} else {
return false, "Required Field: Story Points.";
}

}

 

Using SIL Scripts I was able to get this Validator script to work but it works to well. There is a problem, this screen popup to update required fields before moving to next status, but once these required fields are updated even though after updating these required field whenever again we have to move to that transaction again that screen popup even though those required fields are updated.

 

1 answer

0 votes
Sanjen Bariki
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 14, 2023

Hi @Lindsay Edwards ,

 

Welcome to Atlassian community!

Why you are using script for this, It can be achive by the Jira inbuild function.

Simple you need to add one validator for requried field.

 

Regards,

Sanjen

Lindsay Edwards November 14, 2023

I tired that also:

string errorMsg = "Please input Story Point Value.";
if(!hasInput("customfield_10106")) {
return false, "customfield_10106", errorMsg;
}

}

It gave me the same issue.

Sanjen Bariki
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 14, 2023

Hi @Lindsay Edwards ,

 

Can you please share the screenshot, What was the error you are getting..?

How you are adding..? As per my understanding, you can normally, select the story  point field requried then it will apply in the workflow.

 

Regards,

Sanjen

Lindsay Edwards November 14, 2023

Thankfully I was able to figure it out with some help from a coworker. 

 

if(issueType == "Story"){
if(isNull(%key%.#{Story Points}))
{
return false, "Required field: Story Points";
}
}

Sanjen Bariki
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 14, 2023

Hi @Lindsay Edwards ,

 

Great 👍

It will better if you accept the answer then other people will get the proper solution by the help of your answer.

So Don't forget to hit the answer button.

 

Regards,

Sanjen

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
9.4.8
TAGS
AUG Leaders

Atlassian Community Events