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)

InventDim update on form based on batch

(0) ShareShare
ReportReport
Posted on by 282
Hi all
Running AX 2012 R3 CU9.
Having a bit of an issue with a form - I had predicted this might be the case, but no idea how to progress.
The form uses data source SalesLine, and users would like to update the InventBatchId associated with it. The normal process we would use to allow something like this - associate second data source (in this case InventDim), link the two, and display InventBatchId on the form. But in this case, this doesn't work.
I am assuming this is because when you update InventBatchId, what you would like the system to do is: find or create the appropriate InventDimId, and change SalesLine.InventDimId to match that one. But I've got no idea how to tell it to do that on my form.
Is there an officially supported way of doing this? I have been looking for documentation but think I am missing the vocab.
Any help would be much appreciated. Thanks very much in advance.
Cheers
Luke

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Rustem Galiamov Profile Picture
    8,072 on at

    Hi lukbel!

    Take a look at modified() method on InventBatchId field of InventDim data source table of SalesTable form.

  • lukbel Profile Picture
    282 on at

    Hi Rustem

    Thanks for the hint, the fact that the data source won't update though means surely the modified() method isn't being called in this instance?

    Also, I am wary of creating an entire workaround for this. Surely this must be a common use case of the InventDim table, which is supported across the AX system?

    Cheers

    Luke

  • Suggested answer
    Rustem Galiamov Profile Picture
    8,072 on at

    Did you tried to put breakpoint to modified() method?

    I think you should use modifyInventDim() method on SalesLine table in your case as it used in modified() method of InventDim data source fields.

  • lukbel Profile Picture
    282 on at

    Hi Rustem

    Ah modifyInventDim() looks promising - I might try calling that on selectionChanged() on my field and see if that has the desired result

    Thanks very much for your help :) I will report back

  • lukbel Profile Picture
    282 on at

    Hi Rustem,

    Had a look but am running into problems getting the input variables in a way the method will accept. Here is what I'm currently attempting in an example on the Purchase line:

    PurchLine.modifyInventDim(InventDim_inventBatchId.text()),fieldname2id(InventDim,InventBatchId));

    But it won't accept the second variable. Is there a special syntax I am missing?

    Cheers

    Luke

  • Suggested answer
    Rustem Galiamov Profile Picture
    8,072 on at

    The first parameter - inventDim table cursor, the second must be fieldId - fieldNum(InventDim,InventBatchId).

  • lukbel Profile Picture
    282 on at

    Hi Rustem

    That was the first thing I tried - it still gives error saying type mismatch. I can provide screenshot of this once current compile finishes

  • Rustem Galiamov Profile Picture
    8,072 on at

    Yes, please. Screenshots of your form structure and place where you're trying write your code.

  • lukbel Profile Picture
    282 on at

    Hi Rustem

    Pls see attached. Form and method on form I'm writing on highlighted, the variable that's erroring, and error below.

    4705.Capture.PNG

  • Verified answer
    Rustem Galiamov Profile Picture
    8,072 on at

    I think you should put your code on InventBatchId field of InventDim data source table in modified() method.

    Your code should looks like:

    public void modified()
    {
        super();
    
        purchLine.modifyInventDim(inventDim,fieldNum(InventDim,InventBatchId));
    }


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
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Ali Zaidi Profile Picture

Ali Zaidi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans