Forums

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

Make Priority (System Field) a Dynamic Form (Deviniti)

Alvin
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.
September 26, 2018

Hi Community, Just want to ask if I can make System Fields such as Priority to be a dynamic form. 

I do have backup , which is literally scriptrunner , but I want to make it easier if its possible

 

Scenario is we have 4 Levels of Priority and the default value is Priority 4, when an agent is editing an issue in Edit Screen, if the agent change the value of Priority 4 to Priority 1 or Priority 2, related fields must be filled-up , if Priority 3 or 4 , nothing will be filled up

I have this script on my behavior as a backup but I think it is not working as what I've expect because it still requires me to fill up related  fields even if the Priority is 3 or 4

 

import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField

def samplefield = getFieldById("customfield_xxxxx")
def priority = getFieldByName("xxxxx")

if(priority.getValue()==("Priority 1") || ("Priority 2"))
{
samplefield.setRequired(true)
} else if(priority.getValue()==("Priority 3" || ("Priority 4") {

samplefield.setRequired(false) }

 

 

Can you help me guys out of this problem? Thank you!

 

2 answers

0 votes
Romy T. September 26, 2018

you need to setup a validator on the workflow when create.

 

string errorMsg = "Mandatory"

if (priority== "3" || priority == "4") {

         return false, relatedField, errorMsg;

}

 

 

https://confluence.cprime.io/display/TR/Validators#Validators-Validationbasedonregularexpression

Alvin
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.
September 26, 2018

Hi @Romy T. , I am referring to the edit screen, let's say if the issue is already created. Then the agent wants to Edit the Priority Field on Edit Screen, if the agents selects Priority 1 or 2 , related fields must come up

Romy T. September 26, 2018

Hi @Alvin 

you need to create two file.

main.sil

if(argv["screen"] == "edit"){
lfInstantHook({
"project",
"related-field","relatedField"
}, "/edit.sil");

lfWatch("priority", {"priority","relatedField"}, "/showRelatedField.sil", {"change"});
}

 

edit.sil

if(argv["priority"] == "1" || argv["priority"] == "2") {
lfShow("relatedField");
}
else{
lfHide("relatedField");
}

 

read this.

https://confluence.cprime.io/display/JJUPIN/Live+Fields

Alvin
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.
September 27, 2018

Hi @Romy T. , will take a look at this one, but I need to get Scriptrunner opinions first, because I already have scriptrunner installed. Thank you!

Arion Marcondes da Silva
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 27, 2018

Fudeu fdo

0 votes
Romy T. September 26, 2018

i use Power Script for JIRA - Live Fields to control Dynamic Form. 

 

Disclaimer:
just a user, not a seller.

Alvin
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.
September 26, 2018

Hi @Romy T. ,Thank you for a quick-turn around, can you show me examples on how you do it? or how about Scriptrunner? 

Suggest an answer

Log in or Sign up to answer