Forums

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

Scriptrunner Behavior not taking effect in CreateIssueDetails!init.jspa page all of a sudden

Ian Balas August 18, 2021

Hi all,

One of my teams has their user base navigate to a direct HTML link to create issues in a certain project.

The link (https://jira.XYZco.com/secure/CreateIssueDetails!init.jspa?pid=11807&issuetype=10100&components=71415) leads to the intake form for a 'Support Request' issue for that project with a component value of General Inquiry pre-set.

 

Along with this, I have a Scriptrunner behavior that hides certain fields from the form if the General Inquiry component value is selected:

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.bc.project.component.ProjectComponent
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript

@BaseScript FieldBehaviours behaviours

def hostnamesField = getFieldById('customfield_13159')
def commandField = getFieldById('customfield_20100')
def srcDetailsField = getFieldById('customfield_17700')
def destinationField = getFieldById('customfield_19918')
def portProtocolField = getFieldById('customfield_19919')
def testResultsField = getFieldById('customfield_13921')
def telnetTestResultsField = getFieldById('customfield_19921')
def tracerouteField = getFieldById('customfield_19920')
def srcURLField = getFieldById('customfield_15129')
def desc = getFieldById("description")
def sprint = getFieldByName("Sprint")
def attachment = getFieldById("attachment")
def issueLinks = getFieldById('issuelinks')
def relatedCMR = getFieldById("customfield_19500")
def requestType = getFieldById("customfield_13340")
def propertyField = getFieldById("customfield_16801")
def securityZone = getFieldById("customfield_20302")
def siteName = getFieldById("customfield_20001")
def backplane = getFieldById("customfield_20303")
def publicPrivateField = getFieldById("customfield_20304")
def ipv4ipv6Field = getFieldById("customfield_20305")
def growthExpected = getFieldById("customfield_20306")
def cm3Field = getFieldById("customfield_20308")
def existingSubnet = getFieldById("customfield_20309")
def distField = getFieldById("customfield_20310")
def backupFilers = getFieldById("customfield_20311")
def otherField = getFieldById("customfield_13105")
def externalIssueURL = getFieldById("customfield_14402")
def natReqField = getFieldById("customfield_20307")
def sizeTxtField = getFieldById("customfield_20312")
def removeACLsField = getFieldById("customfield_20802")
def ipv4SubnetField = getFieldById("customfield_20800")
def ipv6SubnetField = getFieldById("customfield_20801")
def idField = getFieldById("customfield_13832")
def affectedURLsField = getFieldById("customfield_10620")
def requestedDueDate = getFieldById("customfield_15032")
def currentDomain = getFieldById("customfield_20804")
def newDomain = getFieldById("customfield_20805")
def entityId = getFieldById("customfield_20806")
def projectName = getFieldById("customfield_13354")
def projectDeadline = getFieldById("customfield_20807")
def meetingType = getFieldById("customfield_14011")
def nameField = getFieldById("customfield_13715")
def locationField = getFieldById("customfield_20905")
def numUsersField = getFieldById("customfield_13506")
def userShortIDsField = getFieldById("customfield_20808")
def additionalDetailsField = getFieldById("customfield_16653")
def siteColoField = getFieldById("customfield_22300")


if (components.any {it.name.contains("General Inquiry")}) {
sprint.setHidden(true)
externalIssueURL.setHidden(true)
srcURLField.setHidden(true)
relatedCMR.setHidden(true)
issueLinks.setHidden(true)
nameField.setHidden(true)
nameField.setRequired(false)
locationField.setHidden(true)
locationField.setRequired(false)
numUsersField.setHidden(true)
numUsersField.setRequired(false)
userShortIDsField.setHidden(true)
userShortIDsField.setRequired(false)
srcDetailsField.setHidden(true)
destinationField.setHidden(true)
portProtocolField.setHidden(true)
idField.setHidden(true)
idField.setRequired(false)

} else {
sprint.setHidden(false)
externalIssueURL.setHidden(false)
srcURLField.setHidden(false)
relatedCMR.setHidden(false)
issueLinks.setHidden(false)
nameField.setHidden(false)
nameField.setRequired(true)
locationField.setHidden(false)
locationField.setRequired(true)
numUsersField.setHidden(false)
numUsersField.setRequired(true)
userShortIDsField.setHidden(false)
userShortIDsField.setRequired(true)
srcDetailsField.setHidden(false)
destinationField.setHidden(false)
portProtocolField.setHidden(false)
idField.setHidden(false)
idField.setRequired(true)
}


This worked completely fine until now.

If you pull up the same form in Jira's internal UI, it still works as expected, restricting the fields on the form as follows:

Screen Shot 2021-08-18 at 4.57.44 PM.png

But if you navigate to the direct link which has the component value pre-set, here's what results:

Screen Shot 2021-08-18 at 5.00.43 PM.png

 

All the fields below 'Description' are not supposed to appear, but they do, and in doing so, completely disregarding the behavior code.

Is this a known issue? Whether or not it is, is there another way/different format that I could use to create a direct HTML link, with fields preset, that will render scriptrunner behavior code effective?

 

_________

 

Update (8/19/21): There was a bug report in the SR for Jira - Development portal: https://productsupport.adaptavist.com/browse/SRJIRA-5387, so it looks like I'm not the only one experiencing this issue.

1 answer

1 vote
Fitch_Ku February 17, 2022

Hi @Ian Balas 

Has your problem been resolved?

Our ScriptRunner version is 6.40.1 and still have this problem.

Thanks.

Suggest an answer

Log in or Sign up to answer