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...
Answered

Returning a selected value to Field

(1) ShareShare
ReportReport
Posted on by 107
Hi Guys,

I am new to BC AL and have been struggling with a field in a new table for a few days now.

What i want to do is to have a drop down list of all categories that corresponds with the previous field values, this does work but when i select my option it always returns the 1st value and not the one that I have selected.

Please see an example below:
1. Here I am entering all the details, based on the QA Questionnaire selection /FOOD/ i get 2 options in the last field /ASH/ and /BEST Before/. My problem is even if i select best before it still returns the 1st value (ASH)

This is the code in my table:
       field(50006; APTRRC_QAQuestionCategory; Code[100])
        {
            Caption = 'QA Question Category';
            DataClassification = ToBeClassified;
            // TableRelation = /QA Questionnaire Line/./QA Question Category Code/ Where(/QA Questionnaire Code/ = field(APTRRC_QAQuestionnaire));
            TableRelation = /QA Questionnaire Line/ Where(/QA Questionnaire Code/ = field(APTRRC_QAQuestionnaire));
            trigger OnValidate()
            var
                QACode: Record /QA Questionnaire Line/;
            begin
                QACode.Reset();
                QACode.SetRange(QACode./QA Questionnaire Code/, APTRRC_QAQuestionnaire);
                //if QACode.FindFirst() then begin
                if QACode.FindSet() then begin
                    APTRRC_QAQuestionCategory := QACode./QA Question Category Code/;
                    Modify()
                end;
            end;
        }
 
Now when I change the table relation to the following it seems to want to return the correct value that I have selected but then I get the following error below the code:
 
TableRelation = /QA Questionnaire Line/./QA Question Category Code/ Where(/QA Questionnaire Code/ = field(APTRRC_QAQuestionnaire));
 
 

I cannot change the primary key as this table is locked for editing.

In my new page for the table the code is as below:


How can get the correct value that I am selecting?

Thanks for the assistance in advance
 
 
I have the same question (0)
  • Verified answer
    YUN ZHU Profile Picture
    99,090 Super User 2026 Season 1 on at
    Hi, you can use Page.RunModal() = Action::LookupOK
    For example,
     
     
    Hope this helps.
    Thanks.
    ZHU

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,949 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,064 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 559 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans