Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / How can I add a find m...
Finance forum
Answered

How can I add a find method on my custom table

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?

  • Martin Dráb Profile Picture
    Martin Dráb 228,089 Super User 2024 Season 2 on at
    RE: How can I add a find method on my custom table

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

  • ergun sahin Profile Picture
    ergun sahin 8,812 Moderator on at
    RE: How can I add a find method on my custom table

    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;
    }

  • Jacky_Sam Profile Picture
    Jacky_Sam 5 on at
    RE: How can I add a find method on my custom table

    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?

  • Verified answer
    Komi Siabi Profile Picture
    Komi Siabi 12,431 Super User 2024 Season 2 on at
    RE: How can I add a find method on my custom table

    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;
    }

  • Arunraj Rajasekar Profile Picture
    Arunraj Rajasekar 1,729 on at
    RE: How can I add a find method on my custom table

    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  

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,252 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,089 Super User 2024 Season 2

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans