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 CRM (Archived)

Error while creating invoice from order

(0) ShareShare
ReportReport
Posted on by

Hi,

I was trying to create an invoice from order entity. I checked the error it was showing 10002 is not a valid value for Invoice.Active.  I Googled it and got that status code should be same for. I don't know what is happening. I didn't any system level coding.  The order with status 'New' is not giving any error, but order with status Complete is giving error. I know it is getting error when 10002 (which is the order status code) is setting as Invoice.Active which should be in 1-6. But I don't know how it is changed suddenly.. 

Can you please help on this?

*This post is locked for comments

I have the same question (0)
  • Royal King Profile Picture
    27,686 on at

    Check the invoice entity has same status reason value that exists in the order entity if that value does not exists add that value to invoice status reason option set that should resolve your problem.

    Here list of default status and status reason values. If you see all order status reason has corresponding invoice status reason value. If any of the value in order is missing in invoice thaen you will receive the error message you mentioned.

    Order status and status reason

    StateStatus Reason

    0 : Active

    1 : New

    2 : Pending

    1 : Submitted

    3 : In Progress

    2 : Canceled

    4 : No Money

    3 : Fulfilled

    100001 : Complete

    100002 : Partial

    4 : Invoiced

    100003 : Invoiced

    invoice status and status reason

    StateStatus Reason

    0 : Active

    1 : New

    2 : Partially Shipped

    4 : Billed

    5 : Booked (applies to services)

    6 : Installed (applies to services)

    1 : Closed (deprecated)

    3 : Canceled (deprecated)

    7 : Paid in Full (deprecated)

    2 : Paid

    100001 : Complete

    100002 : Partial

    3 : Canceled

    100003 : Canceled

  • Community Member Profile Picture
    on at

    Thanks Chitrarasan Duraisamy for the  reply.

    But I have not changed any status reason values. I checked it again and everything is default and intact. I have checked my order and its status is fulfilled and status reason is Partial so it will be 3(fulfilled)  and 10002(Partial) respectively . When I try to create invoice its status will be Active(0) and New(1) because it is newly creating( I assume). So definitely it will give an error because it mismatching the values. So is it bug in CRM because it is default value..? Pls help on this

  • Royal King Profile Picture
    27,686 on at

    IT seems to be a bug or misconfiguration of the system. Enable tracing on the server and see how system maps value from order to invoice when it triggers create invoice call.

  • Verified answer
    Gokhan Mentese Profile Picture
    145 on at

    Hi Muhammed,

    Salesorder status must be only Active or Fulfilled.

    if(salesorder.StateCode == SalesOrderState.Active || salesorder.StateCode == SalesOrderState.Fulfilled))

    {

    ConvertSalesOrderToInvoiceRequest convertOrderRequest = new ConvertSalesOrderToInvoiceRequest()

                       {

                           SalesOrderId = salesorder.Id,

                           ColumnSet = new ColumnSet() { AllColumns = true }

                       };

                       ConvertSalesOrderToInvoiceResponse convertOrderResponse = (ConvertSalesOrderToInvoiceResponse)crmService.Execute(convertOrderRequest);

                       Invoice invoice = (Invoice)convertOrderResponse.Entity;

    }

    gokhandynamicscrm.blogspot.com.tr/.../crm-2011-order-dan-invoice-olusturma.html

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 CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans