web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Filter in business central

(0) ShareShare
ReportReport
Posted on by 25

I have two table 

Table1 customercontract  fields customerstatecode with code[20]

Table2 Documentcontract field documentstatecode with code[20]

I want to set the condition if  (CustomerContract.CustomerStateCode = Documentcontract.documentstatecode)  then assing the lookup filter in the customercontract page in the customerstatecode field

  • Suggested answer
    Robert B. Profile Picture
    257 on at

    Hi Rizwan,

       If I understand this, what you need is to select a certain document contract in a certain field in your customer contract table.

       This should open a list of document contracts where the document state code is the same as in your contract table?

       If this is correct, then I'd suggest using this approach:

       - on the Customer Contract page, on lookup event of the field you want to contain your document contract number write something like this:

    DocumentContractRecord.RESET();

    DocumentContractRecord.SETRANGE(StateCode,CustomerContractRecord.StateCode);

    IF Page.RUNMODAL(0,DocumentContractRecord) = Action::LookupOK Then

    BEGIN

      CustomerContractRecord.DocumentContractCode := DocumentContractRecord.Code;

      ...

    END;

    Where CustomerContractRecord can be your Rec variable on the page, but I wrote it that way so it is clear what it is.

    Cheers,

    Robert

    If this helps in resolving your issue, please verify my answer!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 631 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 409 Super User 2026 Season 2

#3
Grigorios Mavrogeorgis Profile Picture

Grigorios Mavrogeorgis 222 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans