Setting up a Custom Document Layout Table
Document Central can be extended with code that allows to use a different table for the custom document layouts. This is important for partners using an own masterdata level instead of customers and vendors with an own document layout table or simply a standalone own document layout table.
An event is provided that allows the usage of a different table for the document layouts. The following event should be created in an event subscriber codeunit where you set the field numbers that are the equivalent to the fields in the Business Central document layout table. The following code is an example on how to defined a custom document layout table.
The following values are the equivalent of the parameters in the Business Central document layout table.
- The Parameter ParamDocumentLayoutRecordRef is the table of the custom document layout table
- The Parameter ParamDocumentLayoutSourceNoFieldRef is the field which specifies the source no. in the BC standard table
- The Parameter ParamDocumentLayoutReportIDFieldRef is the field which specifies the report id. in the BC standard table
- The Parameter ParamDocumentLayoutSourceTypeFieldRef is the field which specifies the Source Type in the BC standard table
- The Parameter ParamDocumentLayoutReportLayoutCodeFieldRef is the field which specifies the report layout in the BC standard table
It is also possible to define new values for the options field where you define the customer/vendor no. field in the mapping For the Document Layout Table.
In this documentation an event is provided that allows the usage of a new option value for the extension of the option value for the field "Use Report Layout from" in the mapping. It is also explained how to use the event that is provided to set the value of the Option Value.
To add a new Value to the option an enum extension must be created that would look like this:
AL | |
---|---|
In order to use the new value that was added to the field "Use Report Layout from" a new event must be created in an event subscriber codeunit. There you define the table no. that should be filtered in the Document Layout Table that code would look like this:
This Code filters the used document layout table to according to the value of the needed table. In this case the document layout table will be filtered with the layouts that were defined for the table Business Partner.