Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×Hi,
I've in Jira project insight custom field, including more than 100 assets/values.
also I've 100 Jira projects, each project have same name of one of the existing Jira projects.
EX: Insight field having values (A,B,C,....) , existing Jira projects (A,B,C,...).
So what I need when the user select value "A" from the insight field then the post function in a specific status outcome to create issue "type = task" in the same project "A".
And so on, when the user select from insight field value "B" then post function creates
issue "type = task" in the same project "B".
how can do this?
Regards,
Do you have any plguin that allows scripting, for example Scriptrunner?
I can write an example code and you will need to put the IDs of your objects there.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here we are! :)
import com.atlassian.jira.issue.Issue
import com.riadalabs.jira.plugins.insight.services.model.InsightObject
Issue issue = issue //Issues.getByKey("VK-17")
ArrayList<InsightObject> projectFieldValue = issue.getCustomFieldValue(10121) as ArrayList<InsightObject>
String projectKey = projectFieldValue?.first()?.getString("Project key")
return Issues.create(projectKey, "Task") {
setSummary(issue.getSummary())
setDescription(issue.getDescription())
}
Paste your customfield_id value instead of my "10121" and put your attribute name storing project key instead of my "Project key". Let me know if you occure some problems or accept answer if not.
You can replace line
Issue issue = issue //Issues.getByKey("VK-17")
with
Issue issue = Issues.getByKey("%YOUR_SOURCE_ISSUE_KEY%")
and test this code from Script Console
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your effort.
I've 5 child issues linked to main issue, these childs have "start dev date" and "End dev date" CF.
I need when the main issue moved to specific status then to copy the minimum "start dev date" and the maximum "End dev date" from these childs.
How can I do this?
Regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Does my solution work? Please accept it if it does.
Regarding your second question, have you linked your child issues using the Sub-task or Link function?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Sergey Troshin,
Child issues using Portfolio for Jira add-on that become "Advanced Road map for Jira" using the hierarchy configuration.
Regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try this:
import java.sql.Timestamp
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.link.IssueLink
final Long START_DEV_DATE_CF_ID = 11200 // start dev date
final Long END_DEV_DATE_CF_ID = 12400 // end dev date
//def issue = Issues.getByKey("VK-29")
ArrayList<IssueLink> outWardLinks = issue.getAllOutwardLinks() as ArrayList<IssueLink>
if (outWardLinks && outWardLinks.size()) {
ArrayList<Long> startDevDatesList = new ArrayList<>()
ArrayList<Long> endDevDatesList = new ArrayList<>()
for (IssueLink outWardLink : outWardLinks) {
Issue destinationIssue = outWardLink.getDestinationObject()
Timestamp stardDevDate = destinationIssue.getCustomFieldValue(START_DEV_DATE_CF_ID) as Timestamp
if (stardDevDate) {
startDevDatesList.add(stardDevDate.getTime())
}
Timestamp endDevDate = destinationIssue.getCustomFieldValue(END_DEV_DATE_CF_ID) as Timestamp
if (endDevDate) {
endDevDatesList.add(endDevDate.getTime())
}
}
if (startDevDatesList && endDevDatesList) {
Timestamp minStartDevDate = new Timestamp(startDevDatesList.min())
Timestamp maxEndDevDate = new Timestamp(endDevDatesList.max())
issue.update {
setCustomFieldValue(START_DEV_DATE_CF_ID, minStartDevDate)
setCustomFieldValue(END_DEV_DATE_CF_ID, maxEndDevDate)
}
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.