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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Initvalue PurchRFQCaseTable

(0) ShareShare
ReportReport
Posted on by 1,435

Hello everyone,

I am working on setting some default values for the Purchase RFQ form (PurchRFQCaseTable Form. (Ax2012))

What I did is override the initValue Method of the PurchRFQCaseTable data source:

public void initValue()

{

   super();

   PurchRFQCaseTable.DlvMode="Sea";

   PurchRFQCaseTable.DlvTerm="FOB";

   PurchRFQCaseTable.CurrencyCode="CNY";

   PurchRFQCaseTable.Payment="30D";

   PurchRFQCaseTable.PaymMode="CLIEOP";

}

When I open the form, none of these values have been set.

What am I missing here?

Thank you for your help.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Brandon Wiese Profile Picture
    17,788 on at
    RE: Initvalue PurchRFQCaseTable

    I suggested that you should use the system built-in parameters for default values.

    Go to Procurement and soucring, Setup, Procurement and sourcing parameters, and then focus on Request for quotation.  You should find 3 of the 4 fields you want to default already there.  If you need to add the 4th (PaymMode), I would follow their lead and add that field to the PurchRFQParameters table and modify the class PurchRFQCaseTableType\initValue() method to include your new 4th field.

    Please mark as answered if this helped you or if you think this conversation will help others with the same problem.

    Hope this helps and good luck!

  • Wvduren Profile Picture
    1,435 on at
    RE: Initvalue PurchRFQCaseTable

    Hi Brandon. Thank you for your detailed reply.

    I checked, and indeed you are right: in AX 2012 (CU5) the code is similar. The class overrides the forms' initvalue method.

    Now I am not sure how to proceed. I could edit the class, but that does not seem like a safe option. What would be the best approach to set these default values? Or are you saying it is actually not possible to solve this in an easy way?

    Kind regards,

    Willem.

  • Verified answer
    Brandon Wiese Profile Picture
    17,788 on at
    RE: Initvalue PurchRFQCaseTable

    I only have access to AX 2012 R2 right now, so hopefully this is helpful though it may not be correct for AX 2012.

    You indicated that you created an override initValue() method on the data source.

    The initValue() method on the underlying PurchRFQCaseTable table looks like this.

    void  initValue()

    {

       PurchRFQCaseTableType  purchRFQCaseTableType;

       ;

       super();

       purchRFQCaseTableType = this.type();

       purchRFQCaseTableType.initValue();

    }

    Drilling down into Classes\PurchRFQCaseTableType.initValue() we see that those fields are all set automatically from other places.  Most notably the DlvMode, DlvTerm, and Payment fields apparently come directly from the PurchRFQParameters table, which means Microsoft has already created a place on the parameters form to provide these default values.

    void  initValue()

    {

       PurchRFQParameters  params          = PurchRFQParameters::find();

       CompanyInfo         companyInfo     = CompanyInfo::find();

       ..

       purchRFQCaseTable.CurrencyCode      = Ledger::accountingCurrency(companyInfo.RecId);

       ..

       purchRFQCaseTable.DlvMode           = params.DlvMode;

       purchRFQCaseTable.DlvTerm           = params.DlvTerm;

       purchRFQCaseTable.Payment           = params.Payment;

       ..

    }

    You could enable a breakpoint on your code to see if it ever gets executed, but I suspect that the standard default values are simply being copied over your default values after your code executes.  The form PurchRFQCaseTable is unusual like the forms SalesTable and PurchTable in that creating a new record within actually launches another form altogether, i.e. PurchCreateRFQCase, which does the actual work of creating a fresh record to be copied back to the original PurchRFQCreateTable form later.  This could also explain why your data source based initValue() method is not being called, either at all or at the expected time.

    Hope this helps, and good luck!

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

#1
Guy Terry Profile Picture

Guy Terry 2 Moderator

#1
Rahul Shah Profile Picture

Rahul Shah 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans