Skip to main content
X++ Development · · 1 min read

Make Document Number Mandatory on Vendor Invoice Journal Lines

Make the Document Number mandatory on Vendor Invoice Journal lines in D365 F&O using X++ validation and form customization.

Ahmad Hassan

Ahmad Hassan

Dynamics 365 F&O Consultant

Share
Make Document Number Mandatory on Vendor Invoice Journal Lines

This form data source extension customizes the LedgerJournalTransVendInvoice form behavior for LedgerJournalTrans.
When the data source becomes active, it sets the DocumentNum field as mandatory.
The standard active() method is executed first, and its return value is preserved.

X++ Code


final class Ed_LedgerJournalTransVendInvoice_Extension
{
    public int active()
    {
        int ret = next active();

        this.object(fieldNum(LedgerJournalTrans, DocumentNum)).mandatory(true);

        return ret;
    }

}

Process Flow

The active() method is triggered when the LedgerJournalTrans data source becomes active.

The standard next active() method executes and its return value is stored in ret.

The DocumentNum field on LedgerJournalTrans is then set as mandatory.

Finally, the original active() return value is returned.

3a3175d3-5440-4c6f-b9ec-301e1ec329d4.png

Figure: Flow of making the Document Number field mandatory on vendor invoice journal transactions.

Found this useful?

Share it with your network

Ahmad Hassan

Written by

Ahmad Hassan

Microsoft Dynamics 365 & Power Platform blogger.

More about me

Related Posts

Comments

Leave a comment