We need to save the issue id in a custom field before we move the ticket over. So i added a script to save the issue id when a ticket gets created. Here is my script.
import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def custom_ticket_id = issue.getKey()
def cticketCf = customFieldManager.getCustomFieldObjectByName("Custom Ticket ID")
issue.setCustomFieldValue(cticketCf, "${custom_ticket_id}")For some reason this does not populate the custom field. The script seems to run without errors. Is there something wrong with my script ?