Scriptrunner No custom field with the name '<field>' is associated with this issue content
Asked by Ismael Jimoh:

I have a few fields that are associated with a project and when creating an issue from the UI, I can successfully create the issue with the issue type and project but when I attempt creating an issue using scriptrunner post function, I get the error:  

```
2024-05-18 10:30:29,259 INFO [runner.ScriptBindingsManager]: Current Issue NOPM-1 
2024-05-18 10:30:29,259 INFO [runner.ScriptBindingsManager]: Current Issue NOPM-1 
2024-05-18 10:30:29,259 INFO [runner.ScriptBindingsManager]: Current Issue's issue type: Epic 
2024-05-18 10:30:29,259 INFO [runner.ScriptBindingsManager]: Current Issue's issue type: Epic 
2024-05-18 10:30:29,259 INFO [runner.ScriptBindingsManager]: Value from the Product Line Field: [Identity, Cards] 
2024-05-18 10:30:29,259 INFO [runner.ScriptBindingsManager]: Value from the Product Line Field: [Identity, Cards] 
2024-05-18 10:30:29,259 DEBUG [runner.ScriptBindingsManager]: Contains Others? false 
2024-05-18 10:30:29,259 DEBUG [runner.ScriptBindingsManager]: Contains Others? false 
2024-05-18 10:30:29,259 DEBUG [runner.ScriptBindingsManager]: Contains identity? true 
2024-05-18 10:30:29,259 DEBUG [runner.ScriptBindingsManager]: Contains identity? true 
2024-05-18 10:30:29,259 DEBUG [runner.ScriptBindingsManager]: Another way of checking value: false 
2024-05-18 10:30:29,259 DEBUG [runner.ScriptBindingsManager]: Another way of checking value: false 
2024-05-18 10:30:29,269 ERROR [workflow.AbstractScriptWorkflowFunction]: Workflow script has failed on issue NOPM-1 for user 'ismael.jimoh'. View here: https://jira.solarisbank.de/secure/admin/workflows/ViewWorkflowTransition.jspa?workflowMode=live&workflowName=New+PO%3A+Partner+Onboarding+Project&descriptorTab=postfunctions&workflowTransition=231&highlight=1 
com.adaptavist.hapi.jira.issues.exceptions.NoSuchCustomFieldInContextException: No custom field with the name 'Teams (OPM)' is associated with this issue context  at com.adaptavist.hapi.jira.issues.delegate.AbstractIssuesDelegate.getCustomFieldFromName(AbstractIssuesDelegate.groovy:561)  
at com.adaptavist.hapi.jira.issues.delegate.AbstractIssuesDelegate.setCustomFieldValue(AbstractIssuesDelegate.groovy:573)  
at de.xxxx.plugins.jira.groovy.scriptrunner.workflow.postfunctions.opmHandOverCheckTasks$_run_closure1.doCall(opmHandOverCheckTasks.groovy:33)  
at de.xxxx.plugins.jira.groovy.scriptrunner.workflow.postfunctions.opmHandOverCheckTasks$_run_closure1.doCall(opmHandOverCheckTasks.groovy)  at com.onresolve.fixture.groovy.ClosureUtil.callWithDelegateFirstAndReturnFromClosure(ClosureUtil.groovy:22)  
at com.onresolve.fixture.groovy.ClosureUtil$callWithDelegateFirstAndReturnFromClosure$0.callStatic(Unknown Source)  
at com.onresolve.fixture.groovy.ClosureUtil$callWithDelegateFirstAndReturnFromClosure$0.callStatic(Unknown Source)
```

The problem is I had the same configuration on our test instance (same JIRA version, etc) and this worked correctly however I do the same with the production after copying my configuration using Configuration manager and it keeps throwing the above error.

As mentioned, I can create the issue from the UI with the same issue type and project and it works but doing the same with Scriptrunner isn't.


Answers:
author: Ismael Jimoh
body: Sorry, please ignore.  

When I imported the project with CMJ, I had created a new project but with a different key.  

I really just dawned on me as I was pasting this.  

<br />


Tags: custom-field

field-configuration

scriptrunner