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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Added a new method the IventItemPurchSetup table and it can't find it.

(0) ShareShare
ReportReport
Posted on by 535

So I created a code extension to the InventItemPurchSetup table and created a mirror method of finding the lowest Qty to use in the ReqTranspo form inside a grid control(gridreqpo) I have rebuilt and it still doesn't recognize it. Is there something else special I need for it to access this method that I am not knowing about?

pastedimage1678818927238v1.png

pastedimage1678818944658v2.png

I have the same question (0)
  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at

    Once you rebuild, did you find only build successful or application pool recycling? If it is only build, there might some error. Can you check the error log?

    If application pool recycle, then close and open the visual studio, then try referencing that method in form.

  • Suggested answer
    GirishS Profile Picture
    27,829 Moderator on at

    Hi Keith,

    On the data method property try adding like InvenItemSetUpPurch_GrouPODEV_Extension::editMoQQty (ClassName::methodName).

    If that doesn't work add the method on form DataSource extension class instead of table extension.

    Thanks,

    Girish S.

  • Suggested answer
    Mohit Rampal Profile Picture
    12,565 Moderator on at

    Hi, As Girish mentioned, you are not setting edit method correctly in form design. For methods added in extension have different way to setup.

    Check this thread (screenshots) for reference

    community.dynamics.com/.../678121

  • KeithM Profile Picture
    535 on at

    So I adjusted the DataMethod to add the extension(InventItemPurchSetup_GROUPODEV_Extension::getMOQQty).

    I'm atleast getting an error on the site.  Do I need to add this to the datasource extension now?  Why would it now see this method?

    1. Error executing code: InventItemPurchSetup_GROUPODEV_Extension object does not have method 'editMOQQty'.
     pastedimage1678892944488v1.png

    pastedimage1678892960844v2.png

  • KeithM Profile Picture
    535 on at

    "If that doesn't work add the method on form DataSource extension class instead of table extension."

    I don't get an option to add a method to the form datasource extension class.

    pastedimage1678893553311v1.png

  • Suggested answer
    Mohit Rampal Profile Picture
    12,565 Moderator on at

    For that, You have to create a new extension class for Form DataSource.

    check this article

    dynamics365musings.com/.../

    You mentioned 'I'm atleast getting an error on the site. '

    What's the error?

  • KeithM Profile Picture
    535 on at

    pastedimage1678968982261v1.png

  • KeithM Profile Picture
    535 on at

    Ok, so I think I got this added semi correctly.. I need to get the lowest qty from InventItemPurchSetup based on the ReqPo line itemid.  It doesn't like the this variable.

    [ExtensionOf(formDataSourceStr(ReqTransPo,InventItemPurchSetup))]
    final class ReqTransPO_IPSetup_Extension
    {
        display public QtyLowest getMOQQty(ReqPO  _reqpo)
        {
            InventItemPurchSetup    inventItemPurchSetupDefault;
    
            if (this.ItemId)
            {
                inventItemPurchSetupDefault = InventItemPurchSetup::findDefault(this.ItemId);
    
                if (inventItemPurchSetupDefault.RecId != this.RecId)
                {
                    return inventItemPurchSetupDefault.LowestQty;
                }
            }
    
            return 0;
        }
    }

    pastedimage1678971885978v1.png

    pastedimage1678972030344v2.png

  • GirishS Profile Picture
    27,829 Moderator on at

    Use DatasourceName.ItemId instead of this keyword.

    Thanks,

    Girish S.

  • GirishS Profile Picture
    27,829 Moderator on at

    If the Datasource name doesn't work, try like below to get current cursor.

    [ExtensionOf(formDataSourceStr(ReqTransPo,InventItemPurchSetup))]
    final class ReqTransPO_IPSetup_Extension
    {
        display public QtyLowest getMOQQty(ReqPO  _reqpo)
        {
            InventItemPurchSetup    inventItemPurchSetupDefault;
            //get the formrun
            FormRun frun = this.formRun();
            //get the form datasource
            FormDataSource fds = frun.datasource("DataSourceName");
            //get the current buffer
            TableName name = fds.cursor();
            return 0;
        }
    }

    Thanks,

    Girish S.

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…

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 663 Super User 2026 Season 1

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 289 Super User 2026 Season 1

#3
Martin Dráb Profile Picture

Martin Dráb 232 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans