Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Jira Behaviors - copying date field and formatting issue using script runner behaviors

Hello.

i am trying to copy value from Epic To Story when the user click on the issues in epic button using the jira script runner Behaviours .

i manage to copy custom field select list field , due date and assignee.

 

i have a problem copy links issue field created by the easy links add-on.

the links are created on the single / multiple links custom field as Issues.

the closest solution i found is to use this method : 

// Get a pointer to the Linked Issues Text Area
def linkedIssuesCF = getFieldById("issuelinks")

// Get a pointer to the Issue Links Field
def issueLinksCF = getFieldById("issuelinks-linktype")

//Set the field to the Relateted Test Object link type
issueLinksCF.setFormValue("Related Test Object") 

its copy the value of the 1 issue links to the issue links system field,

this solution is not good for me because i need to copy multiple field , and this solution is copying only 1 field , another problem is the links issues system field cant be present in the story create screen.

 

i use this code :

the parent issue is the issue listed in the story epic link.

 

CustomField customFieldTeamResponsible = customFieldManager.getCustomFieldObjectByName("Team Responsible")

        String customFieldValueTeamResponsible = parentIssue.getCustomFieldValue(customFieldTeamResponsible)

//getting the field i cant to set the value on the story

def FormField cu = getFieldById(customfield_12321);

                cu.setFormValue(customFieldValueTeamResponsible );

 

i also tried to use 

Issue customFieldValueTeamResponsible = parentIssue.getCustomFieldValue(customFieldTeamResponsible)

in order to get the value as Issue , but no success.

i can see the at the log that the customFieldValueTeamResponsible  value is an issue key from the custom field on the Epic.  

Thanks

Oz

1 answer

Suggest an answer

Log in or Sign up to answer
1 vote
Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jul 03, 2019

The following will output the date picker date for the current date using the preference for the current user.


import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.datetime.DateTimeFormatterFactory
import com.atlassian.jira.datetime.DateTimeStyle

def formatterFactory = ComponentAccessor.getComponent(DateTimeFormatterFactory.class)
def localDatePickerFormatter = formatterFactory.formatter().forLoggedInUser().withStyle(DateTimeStyle.DATE_PICKER)
localDatePickerFormatter.format(new Date())
TAGS
AUG Leaders

Atlassian Community Events