Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

script behavior

Hi Mates, 

sharing below script to autofill custom fields based on specific role defined, this does throw any error but when i am filling the specific field other custom fields does get auto fill.

kindly suggest

 

import com.atlassian.jira.component.ComponentAccessor

def cfSpecificRole = getFieldById("customfield_23606")
def cfStandardizedrole = getFieldById("customfield_23605")
def cfNextLevelCategory = getFieldById("customfield_24654")
def cfBroaderCategory = getFieldById("customfield_24652")

def optionsManager = ComponentAccessor.getOptionsManager()

if(cfSpecificRole.getValue()=="Developer-MS")  {cfStandardizedrole.setFormValue("MS/API BE Developer")} {cfNextLevelCategory.setFormValue("Developers")} {cfBroaderCategory.setFormValue("Development")}
else if(cfSpecificRole.getValue()=="Developer-Apigee")  {cfStandardizedrole.setFormValue("MS/API BE Developer")} {cfNextLevelCategory.setFormValue("Developers")} {cfBroaderCategory.setFormValue("Development")}


1 answer

0 votes
Fabio Racobaldo _Herzum_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Mar 12, 2023

Hi @M ,

please specify type of your custom fields. Method getValue return different objects depending of cf types.

Take a look here for more information about getValue https://docs.adaptavist.com/sr4js/latest/features/behaviours/api-quick-reference

Moreover, also setFormValue is impacted by types.

Fabio

@Fabio Racobaldo _Herzum_ hi, custom fileds are text type has list of options which contains types of job roles. 

I have done this automate role pickers in custom fields by breaking the script. 

 

Earlier I was trying to achieve by writing one line. For example if I select Say role Developer-BE (in custom field - Specific role) then it would update Standarized role, next level catergory and broader category. 

And that did not work. 

 

Now what I did, if Specific role is Developer-BE then it would update standardized role

 

And if Standardized role is MS/BI developer then it woud update next level category and similarly so on. 

 

And it worked and updating roles in other custom fields if specific role is updates. 

 

Do you other way to do this? 

To be precise. 

If I fill custom field 1 then based on inputs in custom field 1, custom field 2 , custom field 3 will pick up their values. 

 

Thnks

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events