I managed to move an issue programmatically (groovy script using Script Runner, running as escalation service) from one project to another, migrating the workflow using migrateIssueToWorkflow of WorkflowManager. My special configuration allows for a specialized case, so that this is working. I also managed to enter change history entries that look similar to entries of a manual move using UI.
So far so good.
But I'm still missing the transition history entry that Jira issues if I move the issue manualli using UI. migrateIssueToWorkflow does not issue such an entry. How can I add this to my script? What methods in what objects do I need to use?