Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

InventDim update on form based on batch

Posted on by 280
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

  • lukbel Profile Picture
    lukbel 280 on at
    RE: InventDim update on form based on batch

    Hi Rustem

    Still troubleshooting an issue with the updating on the form - but it looks like it's unrelated to the InventDim update, as I rebuilt the datasource from scratch and it's still happening.

    As far as I know the InventDim update is working - so I'll mark it as fixed and make a new post if it still doesn't work

    Cheers

    Luke

  • Rustem Galiamov Profile Picture
    Rustem Galiamov 8,072 on at
    RE: InventDim update on form based on batch

    Hi lukbel!

    Did you solve the issue?

  • Suggested answer
    Rustem Galiamov Profile Picture
    Rustem Galiamov 8,072 on at
    RE: InventDim update on form based on batch

    Check join properties on each data source table. Do the same setup as in PurchTable form.

    Then check what you have punchLine and inventDim records before updating field.

  • lukbel Profile Picture
    lukbel 280 on at
    RE: InventDim update on form based on batch

    Hi Rustem

    It fails on lines it's meant to fail on (open quality order), or on lines it shouldn't work on (invoiced lines) it simply doesn't write - this is good, and I'll probably lock the datasource to prevent someone even trying to enter a value

    But on lines it's supposed to write to, it just hangs until you kill process. I ran a full CIL build to check it wasn't code caches, and it still does it

    Do you have any suggestions what might be causing the hang?

  • Suggested answer
    Rustem Galiamov Profile Picture
    Rustem Galiamov 8,072 on at
    RE: InventDim update on form based on batch

    Just copy and paste this

    purchLine.modifyInventDim(inventDim,fieldNum(InventDim,InventBatchId));

    Screenshot-2018_2D00_11_2D00_22-at-14.46.20.png

    and don't comment super().

  • lukbel Profile Picture
    lukbel 280 on at
    RE: InventDim update on form based on batch

    Hi Rustem

    6242.Capture.PNG

    As you can see, same error. It is probably better to put it here - but given the error is related to input variables, I would imagine this is a problem with syntax rather than where the method is being called.

    Can you suggest any improvements?

  • Suggested answer
    Rustem Galiamov Profile Picture
    Rustem Galiamov 8,072 on at
    RE: InventDim update on form based on batch

    Not on data source methods, on data source field method.

    Screenshot-2018_2D00_11_2D00_22-at-13.58.31.png

  • lukbel Profile Picture
    lukbel 280 on at
    RE: InventDim update on form based on batch

    Hi Rustem

    I think you are mistaken? modified() does not seem to be a method on the data source of the form, rather it's a method on the AOT table?

    8080.Capture.PNG

    Unless I have misunderstood

  • Verified answer
    Rustem Galiamov Profile Picture
    Rustem Galiamov 8,072 on at
    RE: InventDim update on form based on batch

    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));
    }


  • lukbel Profile Picture
    lukbel 280 on at
    RE: InventDim update on form based on batch

    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

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!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans