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)

The state of the source document or source document line could not be updated

(0) ShareShare
ReportReport
Posted on by

Hi all,

I have a piece of code to create free text invoice and post it, it works perfectly fine when I run it from job, but when I try doing it from a class I am getting an error "The state of the source document or source document line could not be updated." . I have already generate full CIL , tried to untick cil check box. restarted AOS and cleared sys last value. None of these seems to work.

Wondering if someone has come across a similar issue and have been able to fix it.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at

    There seems to be some logic issue with the scenario in which you are processing Free text invoice.

    with error message it seems you are trying to update the free text invoice once it is posted.

    OR

    May be the status of Free text journal is as such which is not allowing free text invoice to get posted.

    Do you have Wrkflow enabled for Free Text Invoice funcationality?

    (may be your case is something like Journal is in draft status and you are forcing it to get invoiced before getting approved)

    Please verify and update with your findings,

    have good luck

    appreciated if you share your piece of code.

  • Verified answer
    Kumar Gaurav @ MS Profile Picture
    on at

    Hi Nitesh,

    Thanks for responding, it was a problem with parent rec id not flowing correctly to invoice lines and hence causing the failure to determine parent rec id at source document level.

    It's working now as expected.

    Here is a quick dirty job for what I am doing

    static void FreeTextInvoice(Args _args)

    {

       CustInvoiceTable         custInvoiceTable;

       CustInvoiceLine         custInvoiceLine;

       CustTable               custTable;

       CustPostInvoice         custPostInvoice;

       LineNum                 lineNum;

       int                     i;

       container               acctPattern;

       ;

       acctPattern = [strFmt("%1-Disp","main ac no"),"main ac no",1,"CostCentre","cost centre value"];

       ttsbegin;

       custTable = CustTable::find("cust id");

       custInvoiceTable.initFromCustTable(custTable);

       custInvoiceTable.insert();

       ttscommit;

       for(i=1; i<=3; i++)

       {

           ttsbegin;

           custInvoiceLine.clear();

           custInvoiceLine.initValue();

           custInvoiceLine.initFromCustInvoiceTable(custInvoiceTable);

           custInvoiceLine.AmountCur = 10.00;

           custInvoiceLine.Description = "FreeTxIv" + int2str(i);

           custInvoiceLine.TaxItemGroup = "GST";

           custInvoiceLine.ParentRecId = custInvoiceTable.RecId;

           custInvoiceLine.LedgerDimension = AxdDimensionUtil::getLedgerAccountId(acctPattern);

           if(!lineNum)

           {

               lineNum = CustInvoiceLine::lastLineNum_W(custInvoiceLine.ParentRecId);

           }

           lineNum += 1;

           custInvoiceLine.LineNum = lineNum;

           custInvoiceLine.insert();

           ttscommit;

       }

       custPostInvoice = new CustPostInvoice(custInvoiceTable);

       custPostInvoice.run();

    }

  • Community Member Profile Picture
    on at

    Kumar,

    I had setup the first customer and trying to create a FTI. I have not modified any code and still have the issue with R3. Is there a setup that need to looked into or need a code change to resolve this issue?

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