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, ...
Answered

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

(0) ShareShare
ReportReport
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");
}

I have the same question (0)
  • GirishS Profile Picture
    27,825 Moderator 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,

    Is AcxEInvoicingStatus is your custom field?

    What is the data type for that field?

    Thanks,

    Girish S.

  • ax.tech Profile Picture
    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,

    Thanks for replying. Yes it is a custom field with type enum.

  • GirishS Profile Picture
    27,825 Moderator on at
    RE: I want to write a job where i have to update E-Invoicing status from None to IRN Generated

    Try the below code.

    What is the logic added in this method custInvoiceJour.IRNGenerated()?

    Thanks,

    Girish S.

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

    I think this is where I'm wrong can you please help and correct this ?

    Thanks in advance

  • Verified answer
    GirishS Profile Picture
    27,825 Moderator on at
    RE: I want to write a job where i have to update E-Invoicing status from None to IRN Generated

    So you want to update all the record which are having none status to IR Genrated.

    Try the below code. Replace "YourEnumName" with your custom enum name.

    static void vtsUpdateEInvoicingStatus()
    {
        CustInvoiceJour custInvoiceJour;
    
        ttsBegin;
    
        while select forUpdate custInvoiceJour
            where custInvoiceJour.AcxEInvoicingStatus == YourEnumName::None
        {
            custInvoiceJour.AcxEInvoicingStatus = YourEnumName::IRNGenrated;
            custInvoiceJour.update();
        }
        //update_recordSet
        ttsCommit;
    
        info("DONE");
    }

    Thanks,

    Girish S.

  • ax.tech Profile Picture
    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,

    Getting this error.

  • GirishS Profile Picture
    27,825 Moderator 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.

  • GirishS Profile Picture
    27,825 Moderator 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.

  • ax.tech Profile Picture
    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
    27,825 Moderator 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.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,157

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 674 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans