setCustomfield in post-function is not working depending on user's profile language

Caroline MASSIN
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!
February 7, 2025

Hello everyone, 

I am stuck with a post function groovy script. 

I want to set up the value of a custom field but when the user has a different language in his profile, it doesnt work. 

I am working on a Data Center environment.

My field is used by JSM projects as well as JSW project. 

My groovyscript is executed from a post function but it is stored in a file. 

In a Switch/case statement, I have the following :

case ['010','070','799']: 

     issue.set {

           setCustomFieldValue('Assigned Team', 'text1')

     }

     break

Anyone has an idea how to solve this? 

Thank you :-) 

 

2 answers

1 accepted

0 votes
Answer accepted
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 9, 2025

Hi @Caroline MASSIN

It seems you are trying to use multiple case options to execute the code. This doesn't appear to be correct. Each case should have one option.

Please try modifying your code to an if/else condition instead, i.e. something like:-

def variable

issue.set {

if (variable in ['010', '070', '799']) {
setCustomFieldValue('Assigned Team', 'text1')
}

}

Please note that the sample code able is not 100% exact to your environment. Hence, you must make the required modifications.

Please give it a go and let me know how it goes.

Thank you and Kind regards,
Ram

 

Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 14, 2025

Hi @Caroline MASSIN

Has your question been answered?

If yes, please accept the answer provided.

Thank you and Kind regards,
Ram

0 votes
Caroline MASSIN
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!
February 10, 2025

x

Suggest an answer

Log in or Sign up to answer