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)

Code to change the field value and revert it back after completing the process.

(0) ShareShare
ReportReport
Posted on by 1,260

Hi,

I have a requirements in AX 2012 R3 -

I have two forms:

1. BOMCalcDialog

2. InventItemOrderSetup

I have created a custom editable field in the InventItemItemp table name "MultipleQty" and showed this field in the form "BOMCalcDialog".

My requirement is - when a user enters a value in the "MultipleQty" field (ex - 10,000) it should update the field InventItemInventSetup.StandardQty to 10,000 (i.e. equal to the value of MultipleQty).

SQL code:

UPDATE [dbo].[INVENTITEMINVENTSETUP]
SET STANDARDQTY = '10,000

After completing the BOM calculation process, it should than revert the InventItemInventSetup.StandardQty to "0" again.

SQL code:

UPDATE [dbo].[INVENTITEMINVENTSETUP]
SET STANDARDQTY = '0'

Ho can I achieve this in AX?

*This post is locked for comments

I have the same question (0)
  • Mea_ Profile Picture
    60,284 on at

    Hi D_Meethu R,

    You can have multiple users\processes doing some calculation base on a StandardQty  of an item and updating it could affect these processes as well. I think you need to change the code behind BOMCalcDialog to use new value from dialog instead of playing with data.

  • Daljit Kaur Rahsi Profile Picture
    1,260 on at

    Ievgen,

    The BOM calculation is using the Standard Qty or Minimum Qty for performing the Calculation over multiple items. How can I make the change safely to consider the new field for calculation i.e. "MultipleQty"?

    I tried different way but it won't work -

    Tried to change the seriesize value to 10000 in BOMCalcJob_All and BOMCalcJob_Item classes for the seriesize().

    This works fine when I don't run the job in batch but when I run the job in batch it doesn't pick the seriesize value.

    Can you please suggest where it will be safe to add the 10,000 value for multiple items (at once) BOM calculation with batch and without? Please please please.....

    **Also, we avoid doing BOM calculation during business hours as it slows down the AX - so just taught this will be safe** But please suggest me where it will be safe to call 10,000 value and perform the calculation based on 10,000 in specific with and without batch. Please!!!!

  • Verified answer
    Mea_ Profile Picture
    60,284 on at

    This works fine when I don't run the job in batch but when I run the job in batch it doesn't pick the seriesize value.

    If it works without batch and does not work in a batch you just need to rebuild CIL, no need to change approach.

  • Daljit Kaur Rahsi Profile Picture
    1,260 on at

    But don't I have add any code change in the batch class which uses BOM calculation?

    Also, performed full CIL and restarted the services but still batch job doesn't pick the seriesize value......

  • Daljit Kaur Rahsi Profile Picture
    1,260 on at

    Sorry, my bad it is working now.

    The difference I saw is if item number is not entered then it doesn't work with/without batch job. Is there any way this restriction can be removed?

    Because the client doesn't want to select any item number just want to perform the BOM calculation for all the items in that company.

    Can you let me know where this condition is added ?

  • Verified answer
    Daljit Kaur Rahsi Profile Picture
    1,260 on at

    I guess I found it -

    In the BOMCalcJob class there is method calculateAll().

    I changed the code to this -

    boolean calculateAll()
    {
        //return false;
        return true;
    }


    Thanks Ievegen, for providing with clues to use the existing logic, CIL compile helped a lot...

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