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

How to sync value in "Assets Custom Field", when an object changes in issue ?

Alex
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.
Oct 10, 2023

Hi, atlassian community!

I have a code that pulls out the value of an attribute from an object (indicated in the "Softwate" field) with which it is associated (the attribute is indicated in the "line product" field)

My main task now is to synchronize these values ​​in the .

(Make it so that when the field (object) "software" is changed the attribute in cF "line product" also changed (the one associated with this object was substituted)

 

import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.component.ComponentAccessor;


def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_18429");// here replace the ID with ID of your custom field.
def issueKey = "RDY-12917";
def issueManager = ComponentAccessor.getIssueManager()
def issueObject = issueManager.getIssueObject("${issueKey}")
def cfName = "ПО (актив)"
def cfPOactiv = issueObject.getCustomFieldValue("${cfName}").findAll().join("")

 
def regStringPOactive = (cfPOactiv =~ /RFA-\d\w+/).findAll().join("") // Ключ объекта: RFA-195553 , для ПО (актив)

def attrObjLineOfProduct = Assets.getByKey("${regStringPOactive}").getAttributeValues('Линейка продукта')
def regStringLineOfProduct = (attrObjLineOfProduct =~ /\d\w+/).findAll().join("")

def keyAttrLineOfProduct = 'RFA-'+ regStringLineOfProduct
def attrNameLineOfProduct = Assets.getByKey("${keyAttrLineOfProduct}")
def regAttrValueLineOfProduct = (attrNameLineOfProduct =~ /.*\s/).findAll().join("")

 

 

Screenshot_20231010_193230.pngac.pngac2.png

 

Any help is important! Thank you. 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events