Skip to main content

Notifications

Dynamics 365 Community / Forums / Finance forum / Enabling Data Posting ...
Finance forum
Answered

Enabling Data Posting by Modifying ReadOnly Entity

Posted on by 11

Hello Microsoft Dynamics Community,
I am currently working with Dynamics 365 Finance and Operations and facing a challenge related to data posting via the OData API. I am attempting to post data to the `SalesInvoiceJournalHeaderEntity`, but my efforts are hindered by the entity's ReadOnly status, as indicated by the error:
 

```
Write failed for table row of type 'SalesInvoiceJournalHeaderEntity'. Infolog: Error: insert/update/delete not allowed for entity with ReadOnly = Yes.
```
 
This issue has stopped me from automating the creation of Sales Order Invoices, which is critical for streamlining our business processes. Here are the details of my approach and the obstacle I am encountering:
1. Objective: Automate the creation of Sales Order Invoices through data posting using the OData API.
2. Issue: The entity `SalesInvoiceJournalHeaderEntity` I need to post to is marked as ReadOnly, preventing any create, update, or delete operations.
3. Question:
   - Is there a way to modify the ReadOnly status of an entity within Dynamics 365 F&O without extensive customization?
   - Can this change be achieved through configuration or minor adjustments, or does it require a full customization project?
I seek guidance on whether it is possible to adjust the ReadOnly property of this specific entity to allow data posting, and if so, how this can be done ideally with minimal custom development. Any insights, including experiences with similar issues or recommended practices, would be highly appreciated.
Thank you for your assistance!
  • FB-08050748-0 Profile Picture
    FB-08050748-0 11 on at
    Enabling Data Posting by Modifying ReadOnly Entity
    Thank you for your prompt response! This was what I was looking for.
  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 223,370 Super User on at
    Enabling Data Posting by Modifying ReadOnly Entity
    Yes, you can post a sales order - that was actually my own suggestion. But you originally asked for a completely different thing - inserting data through SalesInvoiceJournalHeaderEntity, which would completely skip invoice posting.
     
    One option is utilizing FormletterService.postSalesOrderInvoice() as a custom service. But it may be beneficial to create a custom solution with a simpler interface. For example, on my current project, we use a custom data entity with an OData action calling SalesFormLetter_Invoice.update(). It gets just SalesId and DataAreaId as the parameter and invoice the whole order. The posting framework have many more options, but this is sufficient for our scenario.
  • FB-08050748-0 Profile Picture
    FB-08050748-0 11 on at
    Enabling Data Posting by Modifying ReadOnly Entity
    Thank you @Martin Drab for your response. I think I was not clear on my requirement and objective, what I do is integrate the data from ecommerce to F&O. In this process we have to sync the invoice data coming from ecommerce to F&O as well. For this reason, I wanted to get the invoice post operation done. I have previously worked with BC and it does provide an API endpoint to post sales invoice, so based on that assumption, I thought F&O might have something similar to it.
  • Martin Dráb Profile Picture
    Martin Dráb 223,370 Super User on at
    Enabling Data Posting by Modifying ReadOnly Entity
    The whole idea is wrong. Creating a record in that table wouldn't produce the right result, because invoice posting includes many other steps. Most importantly, it infuelences accounting entries. You'd have an invoicejournal but the sales order wouldn't actually be invoiced, therefore the state of your database wouldn't make sense.
     
    Instead of trying to import data directly to invoice journals, run invoice posting and let F&O do all the necessary steps.

    (Moved from D365 general forum.)

Helpful resources

Quick Links

Upcoming TechTalk: Copilot Capabilities…

Review the Copilot features that are currently available in Dynamics 365 Finance…

Demystifying Copilot: Service Edition with Sundar Raghavan

Sundar answers more questions about Copilot for Service...

Dynamics 365 Business Central vs Finance and SCM

Take a look at the key differences between Business Central and…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,405 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 223,370 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,140

Featured topics

Product updates

Dynamics 365 release plans