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

Use scripted field in notification scheme

Stefan Niedermann April 9, 2014

I habe a scripted field that returns a user. I configured the search template to userpicker.

Why can't i see this field in notification scheme if i try to choose a user-customfield?

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Stefan Niedermann April 13, 2014

My current workaround is:

  1. Create a second normal user field. (has the ID "14521" in my example).
  2. Do not only return the value of the scripted field but copy the result to the other custom field
// Import needed classes

// calculate needed user

def userManager = ComponentAccessor.getUserManager();

def componentManager = ComponentManager.getInstance();

def customFieldManager = componentManager.getCustomFieldManager();

def targetField = customFieldManager.getCustomFieldObject("customfield_14521");

targetField.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(targetField), userManager.getUserByName("calculated-user-name"));

return "calculated-user-name";

JamieA
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.
April 14, 2014

It's not really a good idea to update the issue from a script field.

You can watch/vote https://jamieechlin.atlassian.net/browse/GRV-430, it's more or less the same issue.

Stefan Niedermann April 14, 2014

It's not really a good idea to update the issue from a script field.

Why? What could be problems with this solution?

I'm not sure if i can wait for implementing GRV-430 (only one vote :D ) or do you have a priority-list or a approximately date when this could be implmented?

0 votes
Andreas Ebert
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.
April 9, 2014

Custom Field Types have to implement the interface UserCFNotificationTypeAware in order for them to be selectable as a User Custom Field Value in a NotificationScheme. That may not be possible with a scripted field.

Stefan Niedermann April 9, 2014

Are there any known workarounds? I need to send E-Mails on some events to the users of the scripted field.

Andreas Ebert
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.
April 9, 2014

Well, the only workaround I can think of is implementing your own post-function which manually sends the mails to the users in that scripted field.

TAGS
AUG Leaders

Atlassian Community Events