Default description is overwriting the text when change the issue type/ custom field values

Lakshmi S
Contributor
December 3, 2024

Hello,

I managed to retain the updated description when I changed the issue types.

Example 1: The default description displays if I select the project and issue type in the create form. After updating the description, if we change the issue type again, the updated value stays the same in the form.

However, I've encountered an issue with the field level, where the updated description is not retained.

Example 2: The default description displays If I select the field values 'Network Expansion' OR 'DNI' OR 'Mid-Market - NetSuite' OR 'Mid-Market - Partner,' but when I change the issue type, it overwrites the description and displays the template. 

How can I maintain the same description in Example 2?

Here is my code on field behavior:

field.png

 

import com.onresolve.jira.groovy.user.FieldBehaviours

import groovy.transform.BaseScript

@BaseScript FieldBehaviours behaviours

def desc = getFieldById("description")

def rdField = getFieldById(fieldChanged)

def rdValue = rdField.value?.toString()

def defaultValue = """  

 This is the default text for any issue except the 'Requester Dept.' NOT in (DNI, "Mid-Market - NetSuite", "Mid-Market - Partner") values

    """

def requesterdeptValue = """

This is the default text for values of the field 'Requester Dept.' in (DNI, "Mid-Market - NetSuite", "Mid-Market - Partner")

If the user selects any one of these values. it should display this text.

    """

if(rdValue == ("Network Expansion") || rdValue == ("DNI") || rdValue == ("Mid-Market - NetSuite") || rdValue == ("Mid-Market - Partner"))

 {

   

desc.setFormValue(requesterdeptValue)

 }

else if(!desc.formValue)

 {

  desc.setFormValue(defaultValue)

 }

1 answer

0 votes
Jeroen Poismans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 4, 2024

Hi,

I suspect this has something to do with the mapping of the behaviour. Issuetype is part of the mapping and by selecting another Issuetype, depending on the type of the fields,  my best bet is that some other triggers are also firing causing your description to be overwritten.

Can you share your entire rule? Also the case that does doe what you want (example 1)

Regards,

Jeroen

Lakshmi S
Contributor
December 5, 2024

Hi @Jeroen Poismans,

Here is the entire behaviour.

jira beh.png


Jeroen Poismans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 10, 2024

What type of field is Requester Dept? Is this an Asset field by chance? These fields On Change trigger at other moments too, not only when you change literally change them.

Lakshmi S
Contributor
December 10, 2024

Hi @Jeroen Poismans ,

Single selection list.

Suggest an answer

Log in or Sign up to answer