Automatically fill custom field based on user data

l May 3, 2016

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

0 votes
l May 8, 2016

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

 

 

 

 

 

 

 

Fidel Castro
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.
May 8, 2016

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.

l May 10, 2016

Thanks for the update.

How to get field code of current user?

 

Fidel Castro
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.
May 10, 2016

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

0 votes
Fidel Castro
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.
May 4, 2016

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

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events