Validations cleares decription by resting customfield value

Paweł 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

Suggest an answer

Log in or Sign up to answer