Index: src/main/groovy/com/lemans/builders/CommercialInvoiceBuilder.groovy =================================================================== diff -u -r1164d860e869fa4099c484eb000c300192f58813 -rdce8b83a8ae877b5d6b5b616c287b875e1fe7a4b --- src/main/groovy/com/lemans/builders/CommercialInvoiceBuilder.groovy (.../CommercialInvoiceBuilder.groovy) (revision 1164d860e869fa4099c484eb000c300192f58813) +++ src/main/groovy/com/lemans/builders/CommercialInvoiceBuilder.groovy (.../CommercialInvoiceBuilder.groovy) (revision dce8b83a8ae877b5d6b5b616c287b875e1fe7a4b) @@ -272,7 +272,7 @@ cell.setHorizontalAlignment(Element.ALIGN_RIGHT) invoiceTable.addCell(cell) //invoiceTable.addCell(new Phrase('PROFORMA', new Font(Font.FontFamily.HELVETICA, 8, Font.NORMAL))) - if (header.groupId) { + if (header?.groupId) { cell = disableBorders(new PdfPCell().with { addElement(new Paragraph("Invoice# / Order#", new Font(Font.FontFamily.HELVETICA, 8, Font.NORMAL))) addElement(new Paragraph("${header?.salesOrderNumber} /", new Font(Font.FontFamily.HELVETICA, 8, Font.NORMAL))) Index: src/main/groovy/com/lemans/services/document/DocumentManagerService.groovy =================================================================== diff -u -r1164d860e869fa4099c484eb000c300192f58813 -rdce8b83a8ae877b5d6b5b616c287b875e1fe7a4b --- src/main/groovy/com/lemans/services/document/DocumentManagerService.groovy (.../DocumentManagerService.groovy) (revision 1164d860e869fa4099c484eb000c300192f58813) +++ src/main/groovy/com/lemans/services/document/DocumentManagerService.groovy (.../DocumentManagerService.groovy) (revision dce8b83a8ae877b5d6b5b616c287b875e1fe7a4b) @@ -135,7 +135,7 @@ switch (classificationName) { case 'Commercial Invoice': CommercialInvoiceBuilder invoiceBuilder = new CommercialInvoiceBuilder() - if (entityClass == 'group') { data.header[0].groupId = entityId } + data.header[0].groupId = (entityClass == 'group' ? entityId : null) file = invoiceBuilder.invoicePdf(data, false, userDetails, errors) break case 'Packing List':