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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

How can I add a find method on my custom table

(0) ShareShare
ReportReport
Posted on by 5

I’m new to Development in D365FO. I’m following the post https://community.dynamics.com/ax/b/axinthefield/posts/using-azure-application-insights-to-monitor-license-usage-in-d365-finance-and-operations

But I’m getting compile errors below.

Severity

Code

Description

Project

File

Line

Suppression State

Error

 

Table 'AppInsightsParameters' does not contain the static method 'find'.

FinanceOperations1 (USR) [TestModel]

C:\AOSService\PackagesLocalDirectory\Bin\XppSource\TestModel\AxClass_CPR_VendEditInvoice_Form_Extension.xpp

11

 

 

This is obvious that I don’t have find method because it is a custom table. But I’m not sure how do I add a find method? Can anyone help me please?

I have the same question (0)
  • Arunraj Rajasekar Profile Picture
    1,743 on at

    Hi Jacky Sam,

    Most out-of-the-box tables include a find method, which you can use as a reference to create your own. The link you are referencing is for completely different requirement.

    thanks,

    Arun  

  • Suggested answer
    Komi Siabi Profile Picture
    13,107 Most Valuable Professional on at

    Here is a sample: Table name is PayrollPeriod

    static PayrollPeriod find(RecId _recId,
    boolean _forUpdate = false)
    {
    PayrollPeriod payrollPeriod;
    
    if (_recId)
    {
    payrollPeriod.selectForUpdate(_forUpdate);
    
    select firstonly payrollPeriod
    where payrollPeriod.RecId == _recId;
    }
    return payrollPeriod;
    }

  • Jacky_Sam Profile Picture
    5 on at

    Thanks Komi, i followed your suggestion and i was able to add a find method based on Recid. I didn't create any unique index on my table, i'm just passing recid as parameter in find method. is it fine?

  • ergun sahin Profile Picture
    8,826 Moderator on at

    For a common table its Ok, but do you have RecId on hand (When you called find method).

    If I m not wrong you are trying create a parameter table. This tables generaly has only a row data so find method a little different (You dont need RecId)

    public static  ParameterTable find(boolean _update = false)
    {
        ParameterTable parameter;
    
        parameter.selectForUpdate(_update);
    
        select firstonly parameter
            index KeyIdx
            where parameter.Key == 0;
    
    
        if (! parameter && ! parameter.isTmp())
        {
            Company::createParameter(parameter);
        }
    
        return parameter;
    }

  • Martin Dráb Profile Picture
    237,908 Most Valuable Professional on at

    By the way, you can learn more about parameter tables in Parameter System Design Pattern.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 544 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 450 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans