| Docs Help
  AppSource  
Docs  /  App  /  NAVAX Extension Base  /  Information for Developers

 XML Schemas


2025/09/16 • 5 min. to read

Note

The following instructions use the NAVAX extension E-Document - ebInterface as an example.

Define your own XML schema type

NAVAX XML Schemas can be used by various extensions. In order for an extension to have its own XML Schemas available, a new XML Schema Type must first be added via an enumextension:
enumextension 70714601 "NVXEB NCEX XML Schema Type" extends "NCEX XML Schema Type"
{
    value(70714600; "NVXEB ebInterface")
    {
        Caption = 'ebInterface', Comment = 'DEU="ebInterface"';
    }
}

Set root record rule

The OnGetMultipleRootRecordsAllowed event in the "NCEX XML Schema Mgt." codeunit determines whether the schemas of the extension are based on a single root record or whether multiple records are allowed. With ebInterface, for example, only one posted document per XML file is allowed. The root data record must therefore be unique for ebInterface schemas and must not contain multiple posted documents. For more information, see XML Schemas, Root Line Settings.
[EventSubscriber(ObjectType::Codeunit, Codeunit::"NCEX XML Schema Mgt.", 'OnGetMultipleRootRecordsAllowed', '', false, false)]
local procedure OnGetMultipleRootRecordsAllowed(SchemaType: Enum "NCEX XML Schema Type"; var MultipleRootRecordsAllowed: Boolean)
begin
    if (SchemaType = SchemaType::"NVXEB ebInterface") then
        MultipleRootRecordsAllowed := false;
end;

Important

if (SchemaType = SchemaType::"NVXEB ebInterface") then
This if condition determines for which XML schema type the code should be executed and must not be omitted under any circumstances. The value must match the added value from the enumextension.

Open XML Schemas

The page for the XML Schemas can be opened via the codeunit "NCEX XML Schema Mgt.". To do this, it is best to add an action on the extension setup page:
action(NVXEBXMLSchemasAction)
{
    ApplicationArea = All;
    Caption = 'XML Schemas', Comment = 'DEU="XML-Schemata"';
    ToolTip = 'View or set up the ebInterface XML Schemas.', Comment = 'DEU="Zeigt die Einstellungen der ebInterface XML-Schemata an, oder richtet sie ein."';
    Image = XMLSetup;

    trigger OnAction()
    var
        NCEXXMLSchemaMgt: Codeunit "NCEX XML Schema Mgt.";
    begin
        NCEXXMLSchemaMgt.OpenXMLSchemas("NCEX XML Schema Type"::"NVXEB ebInterface");
    end;
}

Create/check XML file

The XML file can be created or checked via the CreateXMLFile method in codeunit "NCEX XML Schema Mgt.".

Note

A check is always performed when creating the XML file.
procedure CreateXMLFile(SchemaType: Enum "NCEX XML Schema Type"; SchemaCode: Code[20]; RootRecordRef: RecordRef; var TempBlob: Codeunit "Temp Blob"; NCEXXMLExecuteAction: enum "NCEX XML Execute Action"): Boolean

Parameters

TypeNameDescription
NCEX XML Schema TypeSchemaTypeSpecifies the schema type.
CodeSchemaCodeSpecifies the schema code.
RecordRefRootRecordRefSpecifies the table and the record(s) for the root line of the schema.
Temp BlobTempBlobThe Temp Blob in which the created file is returned.
NCEX XML Execute ActionNCEXXMLExecuteActionSpecifies which action should be performed.

Returns

TypeDescription
BooleanTrue if the file was created or checked.

Execute Action

  • Check Checks whether the XML file can be created with the specified RecordRef. In other words, whether all mandatory data has been specified, etc.
  • Create Checks and creates the XML file with the specified RecordRef. The created file is returned in the TempBlob.
  • Create and Download Checks and creates the XML file with the specified RecordRef. The created file is then downloaded.
  • Real Data Preview Displays a preview of the XML file in a new page.

Add reserved variables

The event OnGetAdditionalVariables in codeunit "NCEX XML Schema Mgt." can be used to add your own reserved variables, i.e., variables that are permanently available in all schemas of the extension. For more information, see XML Schemas, Variables.
[EventSubscriber(ObjectType::Codeunit, Codeunit::"NCEX XML Schema Mgt.", 'OnGetAdditionalVariables', '', false, false)]
local procedure OnGetAdditionalVariables(SchemaType: Enum "NCEX XML Schema Type"; var TempNCEXXMLSchemaVariable: Record "NCEX XML Schema Variable" temporary)
var
    NCEXXMLSchemaMgt: Codeunit "NCEX XML Schema Mgt.";
    NextPositionNo: Integer;
    DETAILS_HEADERTxt: Label 'Optional pretext for all details.', Comment = 'DEU="Optionaler Vortext für alle Details."';
    DETAILS_FOOTERTxt: Label 'Optional posttext for all details.', Comment = 'DEU="Optionaler Nachtext für alle Details."';
begin
    if (SchemaType <> SchemaType::"NVXEB ebInterface") then
        exit;

    NCEXXMLSchemaMgt.AddAdditionalVariable(TempNCEXXMLSchemaVariable, NextPositionNo, '[DETAILS_HEADER]', DETAILS_HEADERTxt, false);
    NCEXXMLSchemaMgt.AddAdditionalVariable(TempNCEXXMLSchemaVariable, NextPositionNo, '[DETAILS_FOOTER]', DETAILS_FOOTERTxt, false);
end;

Fill reserved variables

The event OnGetAdditionalVariableValue in codeunit "NCEX XML Schema Mgt." is used to fill your own reserved variables with values.

Important

The parameter SetVariable must be set to true in order for the value of the variable to be changed or applied. However, SetVariable must not be set generally, as otherwise all variables will be reset. SetVariable should only be set if the condition for filling the variable is met.
[EventSubscriber(ObjectType::Codeunit, Codeunit::"NCEX XML Schema Mgt.", 'OnGetAdditionalVariableValue', '', false, false)]
local procedure OnGetAdditionalVariableValue(SchemaType: Enum "NCEX XML Schema Type"; Variable: Code[20]; var VariableValue: Text; CurrentRecordRef: RecordRef; var SetVariable: Boolean)
var
    SalesInvoiceHeader: Record "Sales Invoice Header";
    CRLF: Text[2];
begin
    if (SchemaType <> SchemaType::"NVXEB ebInterface") then
        exit;

    case Variable of
        '[DETAILS_HEADER]':
            case CurrentRecordRef.Number of
                Database::"Sales Invoice Header":
                    begin
                        SetVariable := true;
                        CurrentRecordRef.SetTable(SalesInvoiceHeader);
                        CRLF[1] := 13;
                        CRLF[2] := 10;                        
                        VariableValue := 'Hello Header!' + CRLF + SalesInvoiceHeader."Posting Description";
                    end;
            end;
        '[DETAILS_FOOTER]':
            case CurrentRecordRef.Number of
                Database::"Sales Invoice Header":
                    begin
                        SetVariable := true;
                        CurrentRecordRef.SetTable(SalesInvoiceHeader);
                        VariableValue := 'Hello Footer!'
                    end;
            end;
    end;
end;

Permission Sets

The following permissions are required for the NAVAX XML Schemas:
tabledataUse permissionSetup permission
"NCEX XML Schema"RRIMD
"NCEX XML Schema Comment"RRIMD
"NCEX XML Schema Change Log"RRIMD
"NCEX XML Schema Line"RRIMD
"NCEX XML Schema Line Filter"RRIMD

Related information




Submit feedback for
DE|EN Imprint