web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

not getting data in tables

(0) ShareShare
ReportReport
Posted on by 1,836

I have crated table "sales order" which having relation with sales table 

ie     salesorder.RefRecid == salestable .Recid

i have created another table that is "salesorderLines" having relation with sales line

  

salesorderlines.RefRecid == salesLines.Recid

when i create new Sales order some records   is  inserted in table "sales order" and

like "buyer" , "Exporter"  , "RefRecId" , "InvoiceId" and "InvoiceDate"

when sales order is invoiced  ,here  "InvoiceId" and "InvoiceDate" will be blank till sales order is invoice 

and here table "salesorderLine" contain HSN code which will get inserted if lines are added in line tab of salesOrder.

so these tables populate same as if records are inserted in salestable and salesline as per relation.

but in  my when sales order is created a row is inserted in   table "salesorder"  and when salesorder is invoiced another row is inserted in table "salesorder" .so i am getting 2 records for one sales order that must not happen. can anyone suggest how can solve this issue.

I have the same question (0)
  • Martin Dráb Profile Picture
    236,879 Most Valuable Professional on at
    RE: not getting data in tables

    It seems that you have a problem with code that should update your table when the order is invoiced, but we can't point out to the bug, because you've told us nothing about your code.

    If you have no idea about what's going on in your code, put a breakpoint to insert() method of salesorder and debug the process. It'll tell you what creates the extra record.

    By the way, do you realize that a single order may have several invoices? You want to have just a single salesorder for SalesTable, therefore you'll be able to track invoice ID and date just for one of the several invoices.

  • Dineshkarlekar Profile Picture
    1,836 on at
    RE: not getting data in tables

    hi martin, 

    thanks for reply ,

    i have written code for insert and update 

    insert is working as expected but when i add line in my sales order and

     i want to hsn code should get into my "SalesOrderEximLines" table as i am having relation of "SalesOrderEximLines" with table "salesline"  but its not happening can you suggest anything about it 

    the code is below

    [ExtensionOf(tableStr(SalesTable))]
    
    final  class EximSalesTable_Extension
    {
       
    
     public  void insert(boolean _skipMarkup )
        {
    
            SalesOrderExim                       salesOrderExim;
            SalesOrderEximLines                  salesOrderEximLines;
            CustInvoiceJour                      custInvoiceJour;
            SalesLine                            salesline;
            TaxInformationLegalEntity_IN         taxInformationLegalEntity_IN;
            TaxInformation_IN                    taxInformation_IN;
            str                                   IECNUMBER;
    
    
    
          
    
            select * from salesOrderExim
                where salesOrderExim.RefrenceRecId == this.RecId;
    
    
    
            select PANNumber from taxInformationLegalEntity_IN
                where taxInformationLegalEntity_IN.LegalEntity == companyInfo::find().RecId;
    
            taxInformation_IN   = TaxInformation_IN::findDefaultbyLocation(LogisticsPostalAddress::findByLocation(companyInfo::find().PrimaryAddressLocation).Location);
    
              IECNUMBER = TaxRegistrationNumbers_IN::find(taxInformation_IN.IECRegistrationNumberTable).RegistrationNumber;
    
    
            ttsbegin;
          
           
            if(custInvoiceJour.InvoiceId)
            {
                select InvoiceId,InvoiceDate  from custInvoiceJour
                    where custInvoiceJour.SalesId == this.SalesId;
    
                salesOrderExim.InvoiceId              = custInvoiceJour.InvoiceId;
                salesOrderExim.FromDate               = custInvoiceJour.InvoiceDate;
                salesOrderExim.insert();
            }
            else
            {
               
                salesOrderExim.Buyer                  = this.SalesName;
                salesOrderExim.Exporter               = companyinfo::find().Name;
                salesOrderExim.PANNumber              = taxInformationLegalEntity_IN.PANNumber;
                salesOrderExim.IECNumber              = IECNUMBER;
                salesOrderExim.State                  = companyInfo::find().postalAddress().State;
                salesOrderExim.Payment                =  this.Payment;
                salesOrderExim.TermsOfDelivery        =  this.DlvTerm;
                salesOrderExim.InvoiceId              = "";
                salesOrderExim.FromDate               = dateNull();
                salesOrderExim.insert();
            }
    
            ttscommit;
               next insert(_skipMarkup);
          
    
        }
        
          public void update()     
        {
            SalesOrderExim                       salesOrderExim;
            SalesOrderEximLines                  salesOrderEximLines;
            CustInvoiceJour                      custInvoiceJour;
            SalesLine                            salesline;
            TaxInformationLegalEntity_IN         taxInformationLegalEntity_IN;
            TaxInformation_IN                    taxInformation_IN;
            str                                   IECNUMBER;  
        
    
            select PANNumber from taxInformationLegalEntity_IN
                where taxInformationLegalEntity_IN.LegalEntity == companyInfo::find().RecId;
    
            taxInformation_IN   = TaxInformation_IN::findDefaultbyLocation(LogisticsPostalAddress::findByLocation(companyInfo::find().PrimaryAddressLocation).Location);
    
            IECNUMBER = TaxRegistrationNumbers_IN::find(taxInformation_IN.IECRegistrationNumberTable).RegistrationNumber;
    
      
            select forupdate  salesOrderExim
                where   salesOrderExim.RefrenceRecId == this.RecId;
                     
    
          ttsbegin;
            if(this.SalesStatus==SalesStatus::Invoiced && salesOrderExim.InvoiceId == "")
            {
                select InvoiceId,InvoiceDate  from custInvoiceJour
                    where custInvoiceJour.SalesId == this.SalesId;
    
             
                salesOrderExim.InvoiceId              = custInvoiceJour.InvoiceId;
                salesOrderExim.FromDate               = custInvoiceJour.InvoiceDate;
                salesOrderExim.Buyer                  = this.SalesName;
                salesOrderExim.Exporter               = companyinfo::find().Name;
                salesOrderExim.PANNumber              = taxInformationLegalEntity_IN.PANNumber;
                salesOrderExim.IECNumber              = IECNUMBER;
                salesOrderExim.State                  = companyInfo::find().postalAddress().State;
                salesOrderExim.Payment                =  this.Payment;
                salesOrderExim.TermsOfDelivery        =  this.DlvTerm;
                salesOrderExim.update();
            }
            ttscommit;
               
            
            while select forupdate salesOrderEximLines
                 join salesline
                        where salesline.RecId  == salesOrderEximLines.RefRecId
                              && salesline.SalesId == this.SalesId
          
    
                    {
                        ttsbegin;
                        if(salesline.ItemId != "" )
                        {
                            salesOrderEximLines.HSNCode            =   HSNCodeTable_IN::find(InventTable::find(salesLine.ItemId).HSNCodeTable_IN).Code;
                            salesOrderEximLines.update();
                        }
                        else
                        {
                            salesOrderEximLines.HSNCode = "";
                            salesOrderEximLines.update();
                        }
                        ttscommit;
                    }
    
    
            next update();
        }
        
       }
        
    }

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 684 Super User 2025 Season 2

#2
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 588

#3
Martin Dráb Profile Picture

Martin Dráb 542 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans