Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Create New Prospect - Set Default Delivery Terms if Country/Region GBR

Posted on by Microsoft Employee

We are looking at changing the form so we can set the Delivery terms to a certain value if the Country/Region is GBR. The problem I have is that the form DirPartyQuickCreateForm details group of fields are not on the from in the AOT. I think they are created by QuickCreate methods. I have never encountered these so I am lost on how to set the Delivery Terms field as it doesn't appear in the Design on the form. Selecting Personalise on the field and looking at the system name for that field in the form it is called quickCreateDetails_DlvTerm
smmBusRelTable(DirPartyEntity).DlvTerm. Looking at the code it uses the smmBusRelTable and uses a field group called QuickCreateDetails which populates the form with these fields.  But I don't know how to reference these in the methods on the form.

5140.Untitled.jpg

7115.Untitled.jpg

*This post is locked for comments

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Create New Prospect - Set Default Delivery Terms if Country/Region GBR

    We found the answer. We could change the field on the quickcreate part of the form using this code:

    DirPartyEntity.setFieldValue("DlvTerm","EXW");

    element.redraw();

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Create New Prospect - Set Default Delivery Terms if Country/Region GBR

    Still stuck on this...cannot find a solution

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Create New Prospect - Set Default Delivery Terms if Country/Region GBR

    no tables added. Searched for smmBusRelTable in the form and no hits. We are on AX2012 R2 and adding a Prospect type which I believe is the link to the smmBusRelTable.

  • 5400 Profile Picture
    5400 7,160 on at
    RE: Create New Prospect - Set Default Delivery Terms if Country/Region GBR

    how are you getting 'smmBusRelTable' table, did you add any data source. I did not find any 'smmBusRelTable' table as data source in DirPartyQuickCreateForm. It is working fine in my environment.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Create New Prospect - Set Default Delivery Terms if Country/Region GBR

    We tried something similar as below but get this error everytime:

    (Thanks for the help)

    Error executing code: The field with ID '0' does not exist in table 'smmBusRelTable'.

    Stack trace

    (C)\Forms\DirPartyQuickCreateForm\Data Sources\LogisticsPostalAddress\Fields\CountryRegionId\Methods\modified - line 7

    (C)\Classes\FormStringControl\modified

    public void modified()

    {  

           if (LogisticsPostalAddress.countryregionid=="GBR" && SysCountryRegionCode::isLegalEntityInCountryRegion([#isoGB]))

           {        

               dirpartyentity.dlvterm="EXW";

           }

       super();

       element.updateControlBasedOnCountry();

       prevCountryRegionId = logisticsPostalAddress.CountryRegionId;

    }

  • 5400 Profile Picture
    5400 7,160 on at
    RE: Create New Prospect - Set Default Delivery Terms if Country/Region GBR

    \Forms\DirPartyQuickCreateForm\Data Sources\LogisticsPostalAddress\Fields\CountryRegionId\Methods\modified

    public void modified()
    {
        super();
        element.updateControlBasedOnCountry();
        prevCountryRegionId = logisticsPostalAddress.CountryRegionId;
        if (logisticsPostalAddress.CountryRegionId == 'GBR')
        {
            DirPartyEntity.DlvTerm = 'dlv';
        }
    }


  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,219 Super User 2024 Season 2 on at
    RE: Create New Prospect - Set Default Delivery Terms if Country/Region GBR

    Hi Paul,

    You don't have to reference form controls. You need to set the datasource field values.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,219 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,056 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans