Automatically fill custom field based on user data

user want fill the custom fields(select list) automatically based on user's location/city.

So JIRA will store user's Business line, city, and country details and when the logged in user create an issue, the custom fields- business line, country, in create issue screen should be automatically filled based on user's location.
Please let me know if this is possible to configure.

 

we have used this postfunction 'Set field value from User Property value Function' and this worked for a single text field, to set value based on the user proprerty

2 answers

You can do it using "Set field as a function of other fields" post-function provided by JIRA Workflow Toolbox add-on. To do it you should use the following configuration:

  • Field to be checked...: this parameter doesn't matter since we are going to check a user property.
  • Target field: select one of the Select List custom fields you want to set Business line, City, or Country.
  • Setting rules: use a setting rule per location similar to these ones:
[userProperty("Location", %{00020}) = "Paris"]France
[userProperty("Location", %{00020}) = "London"]UK
[userProperty("Location", %{00020}) = "Madrid"]Spain
[userProperty("user_property_name", %{00020}) = "expected_value_for_property"]value_for_target_field

In the example we are setting "Country" custom field based on the value of a user property called "Location".

Note that %{00020} is field code for "Current user".

 

You can see it in a screenshot:

Captura de pantalla 2016-05-04 a las 15.44.09.png

 

Thank you for the update.

 

We have installed the workflow toolbox plugin in JIRA test instance with evaluation license.

PFB the followed steps:

 

Added custom field of single select list type "Our Location" with fiels id - 28992

Added user property "country" PFA

Added postfunction in the create issue - PFA

 

This is not working as expected. Please correct if anything is wrong there in the configuration.

Regards,

Anila

 

 

 

 

 

 

 

You should use field code %{00020} in function userProperty(property_name, user_name), since %{00020} is field code for Current user.

The problem you are experiencing is due to the fact that you are using %{28992}, which is field code of "Our Location" custom field. That is incorrect usage of the function.

Thanks for the update.

How to get field code of current user?

 

Field code for Current User doesn't depend of the JIRA instance, and it's always %{00020}. Anyway, you have a dropdown list below the setting rules textarea for injecting field codes, as shown in the screenshot:

Screenshot at may 10 13-18-07.png

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

86 views 0 5
Read article

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