Forums

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

Copy User Picker Field to Summary

Martin Müller September 19, 2019

Hello,

I need help to copy a user picker value via post function to the summary field. 

I tried several snippets from here, but cant get it working. I want something like "Onboarding" + "UserPickerField"

Best regards,

Martin

 

1 answer

1 vote
Ravi Sagar _Sparxsys_
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.
September 19, 2019

Hi @Martin 

Try this.

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cField = customFieldManager.getCustomFieldObjectsByName("User Picker Field")
def cFieldValue = issue.getCustomFieldValue(cField[0]) as ApplicationUser

if (cFieldValue) {
issue.summary = issue.summary + ": " + cFieldValue.displayName }

I hope it helps.

Ravi 

Martin Müller September 19, 2019

Hi @Ravi Sagar _Sparxsys_ ,

 

thanks for your help! I really appreciate it.

It works pretty well for my tasks which i create with post functions, but my "main task" where i put this script in a postfunction, does not rename the preset name of the summary field. 

 

Do you have any solution for this? 

As you can see in the picture, the task HR-187 didnt get a summary change. 

onboarding.PNG

The Post Function Order is

 

  1. Erstellt erstmals einen Vorgang. 
  2. Indiziert einen Vorgang neu, um die Indizes mit der Datenbank zu synchronisieren. 
  3. Startet ein Ereignis Vorgang erstellt, das von Listenern bearbeitet werden kann.
  4. Customscript Summary Change

 

I tried the Script at position 2 and 4, doesnt work for the main task.

 

Do you have any advice for me?

 

Best regards

Martin

Ravi Sagar _Sparxsys_
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.
September 19, 2019

Do you need to do this for parent and subtask both? Do you have same workflow for both of them?

Martin Müller September 19, 2019

I create Tasks out of Tasks, because i need to show them on the Customer Portal. SubTask arent show on the Portal right? 

 

I have a workflow for "Onboarding" - on creation 14 post functions get triggered to create other tasks after point 4 where we rename the summary with your script. this is working for the "tasks which are created out of the parenttask" but it doesnt rename the parenttask.

 

the "tasks which are created out of the parenttask" do have different workflows.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events