mrob
var invoice = Nrecord.transform({ fromType: salesOrder.type, fromId: salesOrder.id, toType: Nrecord.Type.INVOICE, isDynamic: true });