Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

I want to write a job where i have to update E-Invoicing status from None to IRN Generated

Posted on by 86

Hi Experts,

I want to write a job where I have to update E-Invoicing status from None to IRN Generated. I have also tried please let me know where I'm wrong.

Thanks & Regards

static void vtsUpdateEInvoicingStatus()
{
    CustInvoiceJour custInvoiceJour;


    ttsBegin;

    while select forUpdate custInvoiceJour
        where custInvoiceJour.AcxEInvoicingStatus == "None"
    {
        custInvoiceJour.AcxEInvoicingStatus = custInvoiceJour.IRNGenerated();
        custInvoiceJour.update();

    }
    //update_recordSet
    ttsCommit;

    info("DONE");
}

  • GirishS Profile Picture
    GirishS 27,832 Super User 2024 Season 1 on at
    RE: I want to write a job where i have to update E-Invoicing status from None to IRN Generated

    Are you asking about sales id?

    Where will you get a sales id?

    Are you looking to update lines against single sales id?

    Thanks,

    Girish S

  • ax.tech Profile Picture
    ax.tech 86 on at
    RE: I want to write a job where i have to update E-Invoicing status from None to IRN Generated

    Hi Girish,

    Yes status is invoiced but I want to know how can I select or write a particular sales order here?

    Thanks and regards

  • GirishS Profile Picture
    GirishS 27,832 Super User 2024 Season 1 on at
    RE: I want to write a job where i have to update E-Invoicing status from None to IRN Generated

    Hi ax.tech,

    In that case you need to join sales table with "custinvoicejour "table.

    In the sales table you have "SalesStatus" field. First try to print the info log and check whether its returning all the lines with status "Invoiced".

    After confirming add the code for update.

    static void vtsUpdateEInvoicingStatus()
    {
        CustInvoiceJour custInvoiceJour;
        SalesTable      salesTable;
        ttsBegin;
    
        while select forUpdate custInvoiceJour
            where custInvoiceJour.AcxEInvoicingStatus == YourEnumName::None
            join salesTable
            where salesTable.SalesId == custInvoiceJour.SalesId
            && salesTable.SalesStatus == SalesStatus::Invoiced
        {
            custInvoiceJour.AcxEInvoicingStatus = YourEnumName::IRNGenrated;
            custInvoiceJour.doUpdate();
        }
        //update_recordSet
        ttsCommit;
    
        info("DONE");
    }

    Thanks,

    Girish S.

  • ax.tech Profile Picture
    ax.tech 86 on at
    RE: I want to write a job where i have to update E-Invoicing status from None to IRN Generated

    Hi Girish,

    I want to update the status for a particular sales invoice line not for all invoices how can I do it ?

    if i enter a sales invoice number and the status of this invoice is none i want to update its status to irn generated. Please help

  • GirishS Profile Picture
    GirishS 27,832 Super User 2024 Season 1 on at
    RE: I want to write a job where i have to update E-Invoicing status from None to IRN Generated

    Hi ax.tech,

    Above code will update all the lines with status "None".

    If you need additional condition means can you mention the condition here.

    Thanks,

    Girish S.

  • ax.tech Profile Picture
    ax.tech 86 on at
    RE: I want to write a job where i have to update E-Invoicing status from None to IRN Generated

    Hi Girish,

    This job will update all the lines of table but If I want to update only a particular line status which condition to use can you please update the code.

    Thanks and Regards

  • GirishS Profile Picture
    GirishS 27,832 Super User 2024 Season 1 on at
    RE: I want to write a job where i have to update E-Invoicing status from None to IRN Generated

    Hi ax.tech,

    Please mark it as verified( Yes ) if its solved your issue.

    Thanks,

    Girish S.

  • ax.tech Profile Picture
    ax.tech 86 on at
    RE: I want to write a job where i have to update E-Invoicing status from None to IRN Generated

    Hi Girish,

    It is working fine now. Thank you so much for your valuable and support means a lot.

  • GirishS Profile Picture
    GirishS 27,832 Super User 2024 Season 1 on at
    RE: I want to write a job where i have to update E-Invoicing status from None to IRN Generated

    Hi ax.tech,

    Error may be due to some validation written on the "CustInoviceJour" table update method.

    So try to change the code from custInvoiceJour.update() to custInvoiceJour.doUpdate().

    Thanks,

    Girish S.

  • GirishS Profile Picture
    GirishS 27,832 Super User 2024 Season 1 on at
    RE: I want to write a job where i have to update E-Invoicing status from None to IRN Generated

    Can you show me the screenshot of the error?

    Screenshot is not showing if you have attached in the previous replies.

    Thanks,

    Girish S.

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

Product updates

Dynamics 365 release plans