I have done some further testing and thanks to the help of Marwan Al Jeburi found that because we are using a table other than the “incident” table, then the above won’t work.
In the end, the following was implemented on the ServiceNow Incoming configuration to get it to work with the custom table:
entity.comments = ({
cmt ->
def result = []
result.addAll(cmt)
result })(entity.comments)
entity.comments = commentHelper.mergeComments(entity, replica, {it.internal = true})