I am trying to prompt the user for a screen that takes in a few nFeed fields and filters them down. I would like to pre-populate a nFeed but have been unable to get it to work. Through all my googling I have not found anything yet. I am able to retrieve data from it, but not get that data back into the field. Below is the snippit of code I have been working with
import com.atlassian.jira.component.ComponentAccessor
def issueManager = ComponentAccessor.getIssueManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cField = customFieldManager.getCustomFieldObject("customfield_18615")
def contextIssue = issueManager.getIssueObject(getContextIssueId())
def cFieldValue = contextIssue.getCustomFieldValue(cField)
import com.atlassian.jira.component.ComponentAccessor
//def pluginAccessor = ComponentAccessor.getPluginAccessor();
//def plugin = pluginAccessor.getPlugin("com.valiantys.jira.plugins.SQLFeed");
//def serviceClass = plugin.getClassLoader().loadClass("com.valiantys.nfeed.api.IFieldValueService");
//def fieldValueService = ComponentAccessor.getOSGiComponentInstanceOfType(serviceClass);
//def issueKey = contextIssue.getKey();
//def customFieldId = "customfield_18615";
//def nFeedKeyValue = contextIssue.getCustomFieldValue(cField);
//fieldValueService.setFieldValue(issueKey, customFieldId, nFeedKeyValue);
import com.onresolve.jira.groovy.user.FormField;
FormField descriptionField = getFieldById("description")
FormField nFeedField = getFieldById("customfield_18615")
String[] nFeedFieldValue = (String[]) nFeedField.getFormValue()
if (getBehaviourContextId() == "x23") {
getFieldById("project-field").setReadOnly(true)
getFieldById("issuetype-field").setReadOnly(true)
getFieldById("project-field").setHidden(true)
getFieldById("issuetype-field").setHidden(true)
//getFieldByName("ETM Component Type").setFormValue("Frame");
//getFieldById("description").setFormValue(contextIssue.getCustomFieldValue(cField))
getFieldById("description").setFormValue(nFeedField.getFormValue())
//fieldValueService.setFieldValue(issueKey, customFieldId, nFeedKeyValue);
//nFeedField.setFormValue();
getFieldById("summary").setFormValue(contextIssue.getAssignee().getUsername()).setReadOnly(true)
getFieldById("customfield_18615").setFormValue(contextIssue.getCustomFieldValue(cField))
//getFieldById("summary").setHidden(true)
getFieldById("issuelinks-linktype").setFormValue("blocks").setReadOnly(true)
getFieldById("issuelinks-issues").setFormValue(contextIssue.key).setReadOnly(true)
//contextIssue.getCustomFieldValue(cField)
//contextIssue.getAssignee().getUsername();
}
Hi @Jordan Berry , have you seen the Resources feature in ScriptRunner? you might be able to achieve the same result by using Resources with the Database Picker .
Best,
Andra
ScriptRunner Marketing
i have not tried this yet. Does this store the selections as plain text? And when using behaviors, can I then set them the same way I would set a normal text field?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.