Forums

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

Jira Customer Portal shows different fields everytime I refresh the page

zalim786
Contributor
March 9, 2020

Hi,

I am still very new to Jira and right now I am playing with the Scriptrunner, I tried to script behaviours in Jira Script Runner and something very wrong is going on here.

 

1st try:3.jpg

 

Refreshed the same page:

4.jpg

 

Refreshed it again and now I see different field!

5.jpg

 

 

here is the Behavious Script:

Initialiser:

import com.onresolve.jira.groovy.user.FieldBehaviours
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.ModifiedValue

def owner = getFieldById ("customfield_12116")
def itsysteme = getFieldById("customfield_12110")
def itsysmenu = getFieldById("customfield_12111")
def app = getFieldById("customfield_12112")

itsysmenu.setHidden(true)
app.setHidden(true)
owner.setHidden(true)

 

IT-Systeme:

import com.onresolve.jira.groovy.user.FieldBehaviours
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.component.ComponentAccessor

import com.atlassian.jira.issue.ModifiedValue
def owner = getFieldById ("customfield_12116")
def itsysteme = getFieldById("customfield_12110")
def itsysmenu = getFieldById("customfield_12111")
def app = getFieldById("customfield_12112")


if (itsysteme.getValue() == "None"){

itsysmenu.setHidden(true)
itsysmenu.setRequired(false)

app.setHidden(true)
app.setRequired(false)

owner.setHidden(true)
owner.setRequired(false)


}
else if (itsysteme.getValue() == "Navision"){

itsysmenu.setHidden(false)
itsysmenu.setRequired(true)

app.setHidden(true)
app.setRequired(true)

owner.setHidden(true)
owner.setRequired(false)

} else {

itsysmenu.setHidden(true)
itsysmenu.setRequired(false)

app.setHidden(true)
app.setRequired(false)

}

Menu:

import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.CustomFieldManager


def owner = getFieldById ("customfield_12116")
def itsysteme = getFieldById("customfield_12110")
def itsysmenu = getFieldById("customfield_12111")
def app = getFieldById("customfield_12112")


if (itsysmenu.getValue() == "sys1" || "sys2" || "sys3" || "sys4"){

app.setHidden(false)
app.setRequired(true)

owner.setHidden(true)
owner.setRequired(false)


} else {
app.setHidden(true)
app.setRequired(false)
owner.setHidden(true)
owner.setRequired(false)
}

Application:

import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.CustomFieldManager
def itsysteme = getFieldById("customfield_12110")
def itsysmenu = getFieldById("customfield_12111")
def app = getFieldById("customfield_12112")
def owner = getFieldById ("customfield_12116")

if (itsysmenu.getValue() == "sys1" || "sys2" || "sys3" || "sys4") && app.getValue() == "All Application") {

owner.setHidden(false)
owner.setRequired(true)

} else {

owner.setHidden(true)
owner.setRequired(false)
}

 

Its suppose to look like this.

Customer selects an Option from IT-Systeme

Menu Fields shows up (it was hidden before). Then Customer selects Menu (sys1,sys2 etc)

Application field shows up and after "all application option is selected" owner fields shows up and I am also not sure how to take owner from Owner field and fill the Approver (user picker field) with that information. What am I doing here wrong? remember I am very new, and testing jira right now. 

 

2 answers

0 votes
JP _AC Bielefeld Leader_
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.
March 10, 2020

Hi,

just found out that you might not speak German... Sorry about that.

If you're very new to Jira, why are you starting with the most complex stuff? You use ScriptRunner Behaviours. I would check for better, easier to implement, addons to achieve your aims. I'm pretty sure there's an addon Externsions for Service Desk which allow most of the stuff you're coding. Another option might be Connect Elements from the marketplace.

Best

JP

zalim786
Contributor
March 10, 2020

Hi,

Ich bin aus Deutschland und spreche auch Deutsch :D. Danke für die Rückmeldung :-).

I actually know alot about JIRA itself I am only new to Jira Service Desk and Scriptrunner. What we are trying to achieve is actually very complicated, I have already tried different addons and apps and unfortunately none of them worked. I saw how you can do quite alot with Scriptrunner and allow jira Service Desk to perfom very complicated task with that. I will check with Adaptivist as you said.


Thanks once again for the reply.

Regards

I.F

0 votes
JP _AC Bielefeld Leader_
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.
March 10, 2020

Hi,

ich kann auch auf Deutsch antworten. Warum nicht erst einmal Jira ohne ScriptRunner Behaviours ausprobieren? Zu dieser sehr spezifischen Frage wirst Du wahrscheinlich wenig Feedback bekommen. Eventuell kann Adaptavist (Hersteller von ScriptRunner) weiterhelfen. Ich würde dort einen Support Call aufmachen.

Grüße

JP

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events