The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

Validations cleares decription by resting customfield value

Paweł
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!
March 26, 2020

Hi,

Is it possible to lock descripiton field when we push "create" button on JSD request type?

I've created JSD request type with one very simple behavoiur code on one coustomfield. Depending on what the requester chooses in this field, the description will be filled with various questions. The requester should fill his answer below them (in description) and fill other custom fields.

But if the requester skips one other required field and attempts to create a ticket, the validator notify Him that He skipped this field and re-sets my custom field to the previously selected value. This clears the description and inserts only questions there. 

Requester must refill His answers what's litte annying.

Can You help me with solution How to avoid this? I really would like to avoid creating dozens of new customfields for all the questions...

 

My code:

import com.atlassian.jira.component.ComponentAccessor
def optionsManager = ComponentAccessor.getOptionsManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()

def type = getFieldById("customfield_11032")
def desc = getFieldById("description")
def attach = getFieldById("attach-max-size")

if (type.value=="Letter"){
desc.setFormValue("""
System name: \n\n
ID: \n\n
Error description: \n\n
How it should be:
""")
attach.setDescription("""<span style="color:blue">Attach:<br>
- Screen<br>
- Report X</span>
""")
}
else if (type.value=="SMS" || type.value== "Email"){
desc.setFormValue("""
What is Error type?: \n\n
Error decription: \n\n
How it should be::
""")
attach.setDescription("""<span style="color:blue">Attach:<br>
- Screen<br></span>
""")
}

 

0 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question