scriptrunner post function nfeed display value not read

Hi,

I want to update/overwrite the issue summary based on display values of a nfeed custom field in a post function after creating the issue from JSD. I try:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.event.type.EventDispatchOption
 
Object plugin = ComponentAccessor.getPluginAccessor().getPlugin("com.valiantys.jira.plugins.SQLFeed")
Class serviceClass = plugin.getClassLoader().loadClass("com.valiantys.nfeed.api.IFieldDisplayService")
Object fieldDisplayService = ComponentAccessor.getOSGiComponentInstanceOfType(serviceClass)

def issueManager = ComponentAccessor.getIssueManager()
def mutableIssue = issueManager.getIssueObject(issue.id)
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

String displayValue = ""
Object displayResult = fieldDisplayService.getDisplayResultOverrideSecurity(issue.id, "customfield_11000")
if (displayResult != null) {
    if (!displayResult.hasError()) {
        if (displayResult.getDisplay() != null) {
            displayValue = displayResult.getDisplay()
        }
    } else {
       displayValue = displayResult.getError()
    }
}

String res = issue.getSummary() + " - " + displayValue
mutableIssue.setSummary(res.substring(0,254))
issueManager.updateIssue(currentUser, mutableIssue, EventDispatchOption.ISSUE_UPDATED, false)

 Unfortunatly, there seems to be an error when retrieving the displayResult as the summary is set as:

Pricing OE - Errors: {} Error Messages: [The SQL request was either invalid or rejected by the remote database : [SQL0206] ....

 The post function is called after the create issue post function. What am I doing wrong & is there a way to track the generated SQL when accessing the external database?

1 answer

You can read nFeed custom field values in ScriptRunner. I created a nFeed field and was able to display the value using almost the exact code as you.

I am not familiar with nFeeds at all, but the error you're getting just seems like something is wrong with the nFeed field itself, as in the values it's trying to get through the configuration you set up is invalid. Can you see the correct information presented in the nFeed custom field on the view screen (or wherever it is)?

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Apr 30, 2018 in Marketplace Apps

Why moving to Confluence Data Center is only a job half-done

Confluence Data Center is a deployment option that was designed for performance at scale. In other words, Confluence will handle increased traffic much reliably in a clustered environment and yo...

229 views 0 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you