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 :
Microsoft Dynamics AX (Archived)

Defaulting Combo Box field to specific Enum data type Value

(0) ShareShare
ReportReport
Posted on by 160

Hello,

I'm relatively inexperienced in AX dev and I'm struggling with a specific issue on AX 2012 R2 that I can't seem to find any answers for.  I'm trying to default the SpecQty combobox in the PurchEditLines Form to the value of "Receive now Qty".

Now from what I've investigated I can safely say the the object is initialized by default to show "Receive Ordered Qty" and if the user has selected another option it actually saves the previous selection and defaults through to the last selection if the same form is opened up again.

The problem I'm having is when I change the SpecQty combobox to uneditable.  When doing this "Receive Ordered Qty" is always defaulted through with no regard to previous user choices.

I've also tried coding the value to default through by overriding the init() method on the PurchEditLines form but I'm unable to get the code to actually do something. 

The SpecQty field is linked by the PurchParmUpdate Data source that links to the PurchParmUpdate Table\SpecQty Field that links to the PurchUpdate Enum Type  that contains the following 5 values:

0. Receive Now

1. All

2. Recorded

3. Packing Slip etc.

I'm most likely missing something basic but I'm humbly asking any experts for advice?

*This post is locked for comments

I have the same question (0)
  • dolee Profile Picture
    11,279 on at

    Hmm,

    I didn't really do this for AX2012 so far, so what written below is not thoroughly tested:

    - Find the correct subclass of purchFormLetter  (for example, if we are talking packing slip, then the correct class will be purchFormLetter_packingSlip). Then override the prePromptModfiyData method. Assign the desired specQty using purchFormLetter.specQty() method.

    - Add code in the run method in PurchEditLines form to update the specQty value according to purchFormLetter.specQty()

    (Preferably somewhere above the pdsFormCtrl.specQtyChanged() method call)

    Again, you should try this in a DEV/TEST and see if there's any undesirable side effect. Good luck.

  • Verified answer
    Brendon Breedt Profile Picture
    160 on at

    I was approaching the problem from the wrong angle.

    The solution I found was simply writing a display method in the applicable data source that returns the desired value and linking it to the combobox in the form.

    Regards

    Brendon

  • ObiOne Profile Picture
    on at

    Hi Brendon,

    I have the exact same issue. Standard AX functionality always seems to default to ordered quantity unless you have the checked the checkbox to remember your last selection.

    I want the form to default to receive now quantity - every time.

    It seems from your response you were able to achieve this.

    Can you please let me know how you were able to achieve a default value.

    Kind Regards,

    ObiOne

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans