Good morning Atlassian Community,
Here's my problem :
I want to retrieve several different values contained in the same Jira Issue, then put everything together in a textfield customfield (<255 characters).
For that, here is the code I use :
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.security.groups.GroupManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.customfields.manager.OptionsManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.crowd.embedded.api.User
import com.atlassian.crowd.embedded.api.Group
MutableIssue issue = issue
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cf = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'Products'}
def cfValue = issue.getCustomFieldValue(cf)
def cf2 = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'Project Type'}
def cfValue2 = issue.getCustomFieldValue(cf2)
def cf3 = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'Branche Git'}
cf3 = "[" + issue.issueTypeObject.name + "]" + cfValue2 + "-" + cfValue +"-[" + issue.key + "]-["+ issue.dueDate +"]-["+ issue.reporter + "]"
Normally, this code is ok because it works in the Script Runner :

But, when executing it in the workflow, nothing happened (not even an error message in the logs). But, I've tested to put it instead of the summary and / or the issue description and it works :

Can you give me a clue about what I did wrong?
Another thing, when regarding the previous screenshot, I notice that the issue.key is null, which is normal because the script is executed like this :

I'm sure I'm missing, but can't figure out what exactly.
Thanks for your attention.
Cheers.
Fabien.