RSS

The field with ID = X is not found on the page

18 Dec

This is an error message that I got when I was working with Business Central test pages using BCPT (Business Central Performance Toolkit). This post will explain how to find which field it is and in what page and what reason could be for the error message.

Problem: Error
This error tells you that it can’t find the field on the page when you use it as test page. I found three reasons why it won’t find it.

  • The field is not visible. Check if it has visible = false or if it has dynamic visible
  • Another extension has extended the page and removed or hid the field
  • It is there but randomly doesn’t find the field and perhaps worked the other day. This seems to be a bug in BC ~22.5

Later I will show a stable workaround for testing scenarios when you know which field it can’t find.

Dynamic Visibility
As for dynamics visibility, very often document no. is dynamic visible.

field("No."; Rec."No.")
                {
                    ApplicationArea = All;
                    ToolTip = 'Specifies the number of the involved entry or record, according to the specified number series.';
                    Visible = DocNoVisible;  #<---  Dynamic Visibility

                    trigger OnAssistEdit()
                    begin
                        if AssistEdit(xRec) then
                            CurrPage.Update();
                    end;
                }

To solve this, either change the setting so it becomes visible. Even better solution if it is your test app, is to make it visible in your installation codeunit of your test app. This is ok because you run it in a test environment, right?

Another Extension Hides The field
If you are really keen on finding which extension that is potentially hiding your field you can do it with help of AL Explorer. In this example we will look for a page that extends the customer card page.

Press CTRL + SHIFT +P, write al explorer. The prerequisite is that you have all the symbols in the repository that is installed on the server were you try to run it.

Then write the table name you want to filter on in the search filed (2) and pick that it should group by type (3). Then look at the PageExtension group in combination with related table to see which pageextension that extends the table (4). If you are lucky the naming of the extension object gives away that it extens your object of interest.

Problem: Which Field?
From the start it is a little bit annoying since the id in my case was 9 digits and you quickly realise that this is not a standard Business Central id. It is more of a compiled version of the object were all the page fields are given an integer id.
So how do find which page field the id corresponds to? Out of the box I didn’t know so I asked X-Twitter and luckily it delivered.

And thankfully handle @kemanav gave me an answer.

What the person is referring to is the the system table Page Control Field that has a column ControlId that contains the ID from our error message. This means that we can filter on the Id there!

How to access the system table
It doesn’t work to access the table like this:
http://<DockerContainer>/BC/&table=2000000192
http://<ServerURL>/<InstanceName>/&table=2000000192

You need to add the company name first:
http://<DockerContainer>/BC/?company=<COMPANY_NAME>&table=2000000192
http://<ServerURL>/<InstanceName>/?company=<COMPANY_NAME>&table=2000000192

In my case with a Swedish Cronus it would be:
http://<DockerContainer>/BC/?company=CRONUS%20Sverige%20AB&table=2000000192
http://<ServerURL>/<InstanceName>/?company=CRONUS%20Sverige%20AB&table=2000000192

Once you have managed to opened the page it would look like this:

Before you make a filter on ControlID, remember that maybe it doesn’t exist a key/index on that field in the table which will make the filter operation REALLY SLOW since it contains all the page fields in the database.
One quick look at the indexes/keys for that table gives this (BC22.5):

So if you are not ready to wait a couple of minutes, don’t forget to add the PageNo id filter before you add the ControlId filter.

For the record it seems that test pages are buggy ~BC 22.5 😒It can’t find fields that are actually there.

Workaround
A workaround is that you create a new page extension that has the field you “can’t find”. This works best if the page field doesn’t have any validation code but merely points to the table field.

Summary
This error usually arise from that the field has dynamic visibility and it is current hidden or that another extension has hidden/removed it. If you are unlucky it is bug which I had in BC ~22.5

To find out which field it can’t find you can use the system table 2000000192 Page Control Field. In my example it existed there, but in your example it might not be. Try to reinstall the app again with a newer version or use the workaround to create a new page extension that refers to the same field and use that one instead.

 
Leave a comment

Posted by on 2023-12-18 in Okategoriserade

 

Tags: , , ,

Leave a comment

 
Kauffmann @ Dynamics 365 Business Central

A good programmer makes all the right mistakes.

The BC Docs Librarian

Tips and news for AL programmers

Stefan Maroń

Dynamics 365 Business Central

James Pearson

Thoughts about Dynamics 365 Business Central, Git, Azure DevOps, PowerShell, Automated Testing, Visual Studio Code...and maybe some other stuff

Roberto Stefanetti BLOG

MVP & MCT Microsoft Dynamics 365 Business Central, Powershell, Azure, SQL Server

JoeBrown

DevOps starts with culture!

Comments for DevOps ABCs Blog

Reflections from the ERP field

DevOps ABCs Blog

Reflections from the ERP field

Dynamics 365 Business Central for Partners

Reflections from the ERP field

Freddys blog

Learn something new... - then Teach someone!

Stefano Demiliani Technical Blog

Reflections from the ERP field

David Worthington's NAV Performance Blog

Micosoft Dynamics NAV Performance Testing & Optimization

Freddys Blog

Reflections from the ERP field

Marije Brummel Blog | Business Central, Azure and more...

Design Patterns, Performance, Clean Code

Vjeko.com

Ideas in the cloud

Goprowe AB

Reflections from the ERP field

ArcherPoint

Reflections from the ERP field

The NAV Viking´s Blog

- Sharing my experience in the Dynamics NAV world

Comments for

Reflections from the ERP field