Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to set a default assignee value null/unassigned on a Transition Screen

Arunajyothi Samala February 10, 2024

When I move from one status to another like "open" to "returned", I have a transition screen with assignee field. I want to make this assignee field null on a transition screen. I have five of such transitions where I am trying to empty the field>

I tried using a postfunction, which was late for the field to be cleared.

We have ScriptRunner and Power Scripts plugins.

2 answers

2 accepted

2 votes
Answer accepted
Neel Mohapatra _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 11, 2024

HI @Arunajyothi Samala ,

You can also achieve the same by making use of live fields in power scripts.

In SIL manager you will have to create a main script.

In main.sil should have a script something similar to the below, and it should be added to the live field.
eg:

if(argv["screen"] == "edit" || argv["screen"] == "create") {
lfSet("assignee", "");
}



in place of edit, create kindly replace it with your transition screen id as shown in the eg here.

let me know if it helped or if you have any questions.

Arunajyothi Samala February 12, 2024

Yes, I tried in Sil. It is working as expected. Thank you.

Arunajyothi Samala February 12, 2024

Do you have any recommendations for learning Groovy/SIl script tutorial for beginners(Who have no idea on how to code)?

Arunajyothi Samala February 12, 2024

Hi, 

through SIL I could be able to clear the feild on the Transition screen. But this required is also required on the transition screen. I could able to make the transition screen without filling any value in it. after transiton , the UI has the previous value only.

Neel Mohapatra _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 14, 2024

Hi @Arunajyothi Samala ,

You can try adding Unassigned as a value. This will restrict the transition without having any value.


eg:

if(argv["screen"] == "edit" || argv["screen"] == "create" || argv["screen"] == "trans_31") {
lfSet("assignee", "Unassigned");
}

 you can find more details about the documentation here:

https://appfire.atlassian.net/wiki/spaces/PSJ/pages/15481931/How+Live+Fields+work

https://appfire.atlassian.net/wiki/spaces/PSJ/pages/15480338/lfSet

It's always easy to refer to some examples and modify the code.

https://appfire.atlassian.net/wiki/spaces/PSJ/pages/107544577/Recipes+by+Script+Type


2 votes
Answer accepted
Martin Bayer _MoroSystems_ s_r_o__
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 11, 2024

Hi @Arunajyothi Samala , I have one question to clarify your issue. You have a value set in Assignee field before the transition screen is displayed and you want to "dynamically" change it to "Unassigned" when the screen is displayed? Is that correct? If so, then you can use Behaviours and the script

import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
import static com.atlassian.jira.issue.IssueFieldConstants.*

@BaseScript FieldBehaviours fieldBehaviours

def assigneeField = getFieldById(ASSIGNEE)
assigneeField.setFormValue("")

More about Bahaviours in Script runner is here: https://docs.adaptavist.com/sr4js/latest/features/behaviours

Just let me know, if you need anything else.

Arunajyothi Samala February 11, 2024

Thank you for the response. Yes, that is exactly what I want. I am new to ScriptRunner Behaviour, kindly suggest how to achieve the same for four such transtions with transition screens to make it null

But I have 4 such transitions with Transition screen to make the assignee field null. Like from Fixed>Ready to deploy transition screen.
Open>Returned etc.

Martin Bayer _MoroSystems_ s_r_o__
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 11, 2024

Hi @Arunajyothi Samala , when you create Behaviours configuration you will

  • create new behaviours
  • set mapping: for what Projects and Issue types you want to execute behaviours
  • you can configure on what Workflow you want to execute behaviours
  • you can select on what field the behaviours should be executed (Assignee in your case)
  • you can select conditions (Workflow step in your case) which will let your function to be executed only on some transitions

There are some useful examples in Adaptavist's documentation. You should definitely check it and play with it a little:

Arunajyothi Samala February 11, 2024

Understood. Thank you.

 

Suggest an answer

Log in or Sign up to answer