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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

SIL Update Custom field based on value of another Custom field

Hello! I am trying to write a custom SIL post-function script to update the value of a custom single-select field I have based on the values selected in two other custom single select field. 

Here is the scenario. When a user creates a bug, they must select an Urgency and an Impact level (options are High, Medium, and Low). I want to use their selection here to determine the Severity Level of the bug (options are S1, S2, S3, S4). 

EX: User selects Impact = "High" and Urgency = "High" then the Severity Level should be "S1". 

The Severity Level field should be updated based on the selection on the two dropdowns as a Post Function on the Create Transition of the issue. 

Here is my code I started with just to see if I could get this simple case to work first:

if(customfield_10864 == "High" and customfield_10863 == "High")
{
customfield_10865 = "S4";
}

 When I create a bug and select High and High, the Severity level is not getting set to anything- its just null. Code checks out and I have it listed as the last post function in the list. "S4" is the text of the option for the Severity Level dropdown.

What am I doing wrong? Why is the severity level dropdown not updating to the "S4" option?

2 answers

1 accepted

0 votes
Answer accepted

Turns out that the post function was working correctly, it just took a minute before I was able to see the value returned in the dropdown on the issue. It is working now. 

0 votes

Hello!

Could write your script like this:

if(customfield_10864 == "High" and customfield_10863 == "High")
{
runnerLog("inside the if");
customfield_10865
= "S4";

runnerLog(customfield_10865);
}

Then run this script in the SIL Manger. Before running the script, please provide the issue context in the Run Configuration menu. As the issue context you should insert the issue key on which you think this post function should work.

Then have a look at the output of the script.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

🤺 Atlympic Event: Partnerships

Hello Community!  Quick disclaimer: We are running a contest on Community (The Atlympics!) from July 23rd - August 8th of 2021. If you are interested in participating in this contest (prizes! ...

199 views 3 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you