Closed ngtquavn closed 1 year ago
Hi,
Use this code:
AFTER SAVE SECTION
@relations = "#".to_s + IssueRelation.where("relation_type = ? AND (issue_to_id = ? OR issue_from_id = ?)","copied_to", self.id, self.id).pluck(:issue_from_id,:issue_to_id).uniq.compact.join(', #').squish.to_s
self.custom_field_values = {'1' => @relations.to_s}
self.save_custom_field_values
The first row collect the issues, with "#" prefix. The last 2 rows just add the result to a custom field, like this:
If you need only an array of issue ids, then use this code:
@relation_array = IssueRelation.where("relation_type = ? AND (issue_to_id = ? OR issue_from_id = ?)","copied_to", self.id, self.id).pluck(:issue_from_id,:issue_to_id)
I hope it helps!
It works for me.
Thanks for your help.
It works for me.
Thanks for your help.
Your welcome! Don’t forget to close this issue!
Hi all,
Please help me get list related issues only including copy_from and copy_to lists.
Thank you in advance.