Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM forum
Unanswered

Attribute 'ordernumber' cannot be null

Posted on by 18

After upgrading CRM from 2016 to 365 on premise, I now get the error "Attribute 'ordernumber' cannot be null" (on the last line) when creating an order using the following code.

public static Entity PersistOrder(IOrganizationService service, Entity order, List<Entity> orderProducts, List<Entity> orderProductsNotInvoice)
{
Relationship orderRelashionship = new Relationship("order_details");
EntityCollection orderProductsCollection = new EntityCollection(orderProducts);
order.RelatedEntities.Add(orderRelashionship, orderProductsCollection);

ExecuteTransactionRequest request = new ExecuteTransactionRequest()
{
Requests = new OrganizationRequestCollection()
};
CreateRequest createRequest = new CreateRequest() { Target = order };
request.Requests.Add(createRequest);
var response = (ExecuteTransactionResponse)service.Execute(request);

Auto numbering is working fine when an order is created in CRM itself. As a test I created an OrganizationServiceProxy using hard coded credentials and it also successfully created the order. Even if I use service.Create(order) I still get the error. Any ideas why auto numbering no longer works with IOrganizationService after the upgrade?

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,552 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,552 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans