Depending on how complicated the layout change is, you could just make two copies of the report and selectively run either A or B copy depending on whatever layout you want to use in the code. Would probably be the easiest / fastest way without over thinking / complicating it.
To use this, the report has to go through Report Selection table.
Change the report id in Report Selection table (77), for examble Invoice.
Create you extra layouts in table 9651.
In tabel 9657 you can set layout per customer, there is an action on Customer Card for this. Here you can also specific an alternative email address for this report, so if the customer wants Invoices sent to a different email, than the one on the customer card, it will use that in Document Send function.
If you need it from C/AL then you use the SetTempLayoutSelected function in table 9651.
You set the layout before run, and then set it back afterwards.
ReportLayoutSelection.SetTempLayoutSelected("Custom Report Layout Code");
REPORT.RUNMODAL("Report ID",IsGUI,FALSE,RecordVariant)
ReportLayoutSelection.SetTempLayoutSelected('');
This i use on 2017, but should work in 2016 as well.
Answers
Change the report id in Report Selection table (77), for examble Invoice.
Create you extra layouts in table 9651.
In tabel 9657 you can set layout per customer, there is an action on Customer Card for this. Here you can also specific an alternative email address for this report, so if the customer wants Invoices sent to a different email, than the one on the customer card, it will use that in Document Send function.
If you need it from C/AL then you use the SetTempLayoutSelected function in table 9651.
You set the layout before run, and then set it back afterwards.
ReportLayoutSelection.SetTempLayoutSelected("Custom Report Layout Code");
REPORT.RUNMODAL("Report ID",IsGUI,FALSE,RecordVariant)
ReportLayoutSelection.SetTempLayoutSelected('');
This i use on 2017, but should work in 2016 as well.