Forecloud Technologies Pvt. Ltd. - How to Modify Fields on a Posted Sales Invoice Page in Dynamics 365 Business Central

Solving the error "Sorry, the current permissions prevented the action. (TableData 112 Sales Invoice Header Modify: ALProject7)"

 · 2 min read

Introduction:

When working with posted sales invoices in Dynamics 365 Business Central, users often need to update field values. However, while attempting to modify these values, you might encounter an error message that reads:

"Sorry, the current permissions prevented the action. (TableData 112 Sales Invoice Header Modify: ALProject7)"



The error occurs when a user tries to modify a field value on a posted sales invoice page but lacks the appropriate permissions. Even if the user has a Super Permission set.



Even with a Super Permission set, the system might restrict direct modifications to the posted sales invoice because the underlying data is locked for integrity reasons. The “Sales Invoice Header” table, which contains the header data for posted invoices, requires additional permission settings to allow modifications.


So, what's the solution? Let’s walk through a step-by-step process to resolve this issue.


Solution: Creating a Codeunit and Granting Permissions

Here’s how you can update the field values while ensuring the necessary permissions are in place:

1. Create a Codeunit to Update the Field Value

You will need to create a codeunit that allows you to modify the values programmatically. A codeunit is a container for AL code that can interact with the business logic in Business Central.


The way is to create a codeunit to update the value and add permissions to the tabledata sales invoice Header to RIMD and add logic to modify the field value



2. Add Logic to Modify the Field Value

Once the codeunit is created and permissions are set, you can call the procedure in the appropriate place in your code.

Here I have added on Test document action to update the Test field value.


Testing the Solution

The field should be updated without any permission errors.



Conclusion:

By creating a custom codeunit, adding the appropriate permissions, and implementing the logic to modify the field, you can resolve the "permissions prevented the action" error and successfully update values on the posted sales invoice page. With this approach, you can maintain data integrity while allowing users to make necessary changes in a controlled manner.


I hope this blog has been helpful to you!


PD
Prathama Deshpande

Prathama Deshpande is a dedicated Business Central Developer working with Forecloud Technologies since 2023. She is one of the key responsible person for Business Central Customization Development and Functional Implementation and Support.

No comments yet.

Add a comment
Ctrl+Enter to add comment