Calling all dashboard experts!!
I am trying to create a dashboard that is going to effectively display metrics related to production bugs opened up in our jira projects across our various product areas.
Does anyone know what widget I would need to create the views I've included screenshots of? I can't find them, but I feel like they must exist?
We should have the fields populated at the bug issue type level to tell us this info. We have it segmented by priority (critical, high, medium, low) with a custom product area field to tell us where it belongs.
Any help is appreciated. Thank you!
Hello @Dan27
You are using issue.setCustomFieldValue
But in the docs it's not the recommended way
void setCustomFieldValue(CustomField customField, Object value)
Sets a custom field value on this Issue Object, but does not write it to the database. This is highly misleading.
To actually set a custom field value, use OrderableField.updateIssue(com.atlassian.jira.issue.fields.layout.field.FieldLayoutItem, MutableIssue, java.util.Map)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Tarun Sapra , thanks for the quick answer,
I try the code with update Value too, and it return an error :
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.util.ImportUtils;
import com.atlassian.jira.user.util.UserManager;
import com.atlassian.crowd.embedded.api.User;
import com.atlassian.jira.issue.ModifiedValue;
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder;
import com.atlassian.jira.issue.util.IssueChangeHolder;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.security.groups.GroupManager;
import com.atlassian.jira.issue.IssueImpl;
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.util.IssueChangeHolder
import com.atlassian.jira.issue.IssueInputParameters
def customFieldManager = ComponentAccessor.getCustomFieldManager();
def issue = event.issue as MutableIssue
def issueManager = ComponentAccessor.getIssueManager();
log.warn issue.getIssueType().name
//Condition if QVR
if (issue.getIssueType().name=='QVR')
{
log.warn 2
//Get Assigned QA Team value
def Team = issue.getCustomFieldValue(customFieldManager.getCustomFieldObjectByName("Assigned QA Team"));
def val = Team.toString();
CustomField wbl = customFieldManager.getCustomFieldObjectByName("WBL Agile Team");
def value = ComponentAccessor.optionsManager.getAllOptions()?.find { it.toString() == 'Unassigned Team' };
log.warn value;
if (val==null)
{
IssueChangeHolder changeHolder = new DefaultIssueChangeHolder();
//issue.setCustomFieldValue(wbl, value)
wbl.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(wbl), value), changeHolder);
}
else
{
IssueChangeHolder changeHolder = new DefaultIssueChangeHolder();
//issue.setCustomFieldValue(wbl, val)
wbl.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(wbl), val), changeHolder);
}
issue.store();
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What's the type of your custom field?
Also, could oyu please use code macro to paste your code as that makes it more easily readable.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use this and if it doesn't work, please share the exact error which you are getting
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.util.ImportUtils;
import com.atlassian.jira.user.util.UserManager;
import com.atlassian.crowd.embedded.api.User;
import com.atlassian.jira.issue.ModifiedValue;
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder;
import com.atlassian.jira.issue.util.IssueChangeHolder;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.security.groups.GroupManager;
import com.atlassian.jira.issue.IssueImpl;
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.util.IssueChangeHolder
import com.atlassian.jira.issue.IssueInputParameters
def customFieldManager = ComponentAccessor.getCustomFieldManager();
def issue = event.issue as MutableIssue
def issueManager = ComponentAccessor.getIssueManager();
log.warn issue.getIssueType().name
if (issue.getIssueType().name=='QVR') {
log.warn 2
//Get Assigned QA Team value
def team = issue.getCustomFieldValue(customFieldManager.getCustomFieldObjectByName("Assigned QA Team"));
CustomField wbl = customFieldManager.getCustomFieldObjectByName("WBL Agile Team");
def value = ComponentAccessor.optionsManager.getAllOptions()?.find { it.getValue() == 'Unassigned Team' };
log.warn value;
if (!team) {
IssueChangeHolder changeHolder = new DefaultIssueChangeHolder();
wbl.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(wbl), value), changeHolder);
}
else {
IssueChangeHolder changeHolder = new DefaultIssueChangeHolder();
wbl.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(wbl), team), changeHolder);
}
}
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.
Glad to know @Dan27 that it worked! :)
Please accept/upvote the answer so that others are helped as well! Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Dan27
Please see this article on how to update jira fields via api.
And remember that method
wbl.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(wbl), value), changeHolder);
not saving changes in History of issue.
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.