How do you set default field values based on user?

As a user - I would like to have specific field values be set for me (not everyone) based on my common usage (or by settings). Is there a way to do this?

EXAMPLE: When I click "CREATE ISSUE" I would like "BUG" to be set as the issue type (for only me) and I would like my custom field "TEAM" to be set to my team's value.

2 answers

1 accepted

the following script can use to set default value for you

<script type="text/javascript">
jQuery(document).ready(function($) {
    JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) {
        setDefaultValues();
    });
        setDefaultValues();
     
function setDefaultValues(){
		var currentUser=getCurrentUserName();
		if(currentUser=='Prasad'){
			$("#customfield_11329").val(currentUser);
		}else{
			$("#customfield_11329").val('');
		}
}
     
function getCurrentUserName()
{
var user;
     AJS.$.ajax({
        url: "/rest/gadget/1.0/currentUser",
        type: 'get',
        dataType: 'json',
        async: false,
        success: function(data) {
            user = data.username;
        }
     });
     return user;
}
 
});
</script>

for reference

https://answers.atlassian.com/questions/196399/js-to-set-custom-field-based-on-a-project?page=1#comment-197895

1 votes

That's not something Jira supports. Defaults for custom fields are set by field contexts and are hence the same for every user. System fields mostly don't have defaults, but when they do, the normal behaviour there is to use the last value you used, not any particular default

I think the behaviours plugin would let you do this to some extent, but I don't think it will store indiviudal user preferences.

I was really hoping there was something that I was missing. Thanks though

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,937 views 12 18
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot