Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Grid of BOM line form do not show real time data after performing modifiedfield in inventtablemodule

Posted on by Microsoft Employee

I created modified field in inventtablemodule, the purpose is if I change a value in a field, it will update a field in BOM table. However, the data display in form not display the real data that already change in inventtablemodule. But when I debug, after finish debug, the field value can change. But if i am not doing debug, the value not show the real time data in the form of BOM as datasource.

public void modifiedField(fieldId _fieldId)

{

   super(_fieldId);

   if(this.isFormDataSource())

   {

       switch(_fieldId)

       {

           case fieldnum(InventTableModule,UnitId):

           this.PopulateInventUnit();

           this.updateBOMID();

           break;

       }

   }

}---------------------

void updateBOMID()

{

   BOM                     tblBOM;

   InventItemInventSetup   inventItemInventSetup;

   inventDimId             inventDimBlank;

   InventTableModule       inventTableModule,inventTableModule2,inventTableModule3;

   InventTable             inventTBL;

   str id,id2,id3;

   ;

  if(this.UnitId!='STOP')

  {

       ttsbegin;

       select forupdate tblBOM

       where tblBOM.ItemId == this.ItemId ;

       {

       Select inventTableModule

       where inventTableModule.ModuleType == ModuleInventPurchSales::Invent && inventTableModule.ItemId == this.ItemId;

           {

           tblBOM.UnitId = inventTableModule.UnitId;

           tblBOM.doupdate();

           }

       }

       ttscommit;

    }

}

Can anyone help me.Thanks

*This post is locked for comments

  • Suggested answer
    Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Grid of BOM line form do not show real time data after performing modifiedfield in inventtablemodule

    First of all, never update data in DB on modified field. User should be able to click Esc and cancel changes he did, how is it going to work in your case? So it's better to move you code to record save.

    Talking about refresh issue, you need to call reread() and refresh() on the datasource  to get updated data from the DB after you updated it, like:

    formDataSource.reread()

    formDataSource.refresh()

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans