Insert-Delete-Modify Records in Business Central - 3 Smart Ways

An overview of permission sets via the User Interface (UI) on objects in Dynamics 365 Business Central.

In Business Central, there may be times when you need to insert or modify a record, but the system does not enable you to do so directly owing to permissions constraints. This can be annoying, but there are workarounds that can help you achieve the result.

It is the permissions property that sets whether an object has additional permission necessary to do operations on one or more tables. The operations can be to read, insert, modify, and delete data.

Moreover, the property applies to Code unit, Table, Request Page, Page, Xml Port, Report, Query, Permission Set, and Permission Set Extension.

If you just have indirect permission to insert data into a specific table, you cannot do so using the standard user interface. To enter data into the table, you must utilize a database object that has been granted additional authority permission. Let us explore the process in detail.

Get help to modify data across various departments in Microsoft Dynamics ERP, with our passionate team of consultants!

How to Insert, Delete, and Modify Records When Permission is not Allowed?

Users' permissions in Dynamics 365 Business Central are determined by their license. The security permission sets that administrators grant to users further enhance these permissions. The data access kinds include Read, Insert, Modify, and Delete.

A user who has Read permission can access the page that displays data from a table, such as the Item or Customer tables. To edit or delete data, however, the user must have Modify and Delete permissions.

Sometimes the license or permission set only allows the user indirect permission to conduct operations on specific data in tables (Table Data). A user with Indirect Read permission cannot open a page that displays data from a table unless the page has been granted the user's permission to read data from the table. That is, the user can only execute an action on the data via another object.

In other words, if you only have indirect permission to, say, insert data into a certain table, you cannot do so using the standard user interface. To enter data into the table, you must utilize a database object that has been granted additional permission.

Objects do not have the permission attribute declared by default and utilize the same permissions as the user. Users do not have write or edit permissions in some circumstances, such as the numerous Ledger Entries tables. In such a scenario, users should instead run posting routines that make ledger entries on their behalf.

With Dynamics 365 implementation, explore how to grow your business and debug the glitches surrounding Microsoft Dynamics GP or Dynamics Nav or Microsoft Dynamics Business Central or any other Microsoft Dynamics ERP for that matter!

The Best Way to do it - Indirect Permission!

You can grant users access to an object, but only via another object. This is called giving "Indirect" permission.

When a user has Indirect permission, he or she can only edit the Sales Line table via running the Sales-Post code unit or another object with Sales Line table modification permission.

Only from supported application areas can the user alter the Sales Line table. Other techniques cannot be used by the user to run the feature mistakenly or maliciously.

The table below shows how the Permission property interacts with the permissions provided to an object by a license or a permission set. The table compares the runtime results when and when not the Permission attribute is set.

Permissions Granted by Permission Set Permission Property not Set Permission Property Set
None Runtime error caused by missing permissions. Runtime error caused by missing permissions.
Indirect Permission Runtime error caused by missing permissions. Success
Direct Permission Success
Success
User has full access to the data.

The example below demonstrates how to set the permissions property for the code unit used for customer ledger entries. In the same way, you may define the permissions attribute in other objects.

codeunit 50113 CreateCustomer
{
    Permissions = TableData "Cust. Ledger Entry" = rm;
    TableNo = Customer;
    trigger OnRun();
   begin
        InsertEntry(Rec);
    end;
    procedure InsertEntry(var Cust : Record Customer)
    var
        CustLedgerEntry: Record "Cust. Ledger Entry";
    begin
        CustLedgerEntry.Init();
        CustLedgerEntry."Entry No." := 1;
        CustLedgerEntry."Customer No." := Cust."No.";
        CustLedgerEntry."Posting Date" := WorkDate();
        CustLedgerEntry.Insert();
    end;
}

If you are still fighting hard to find solutions, contact our Dynamics 365 support partner to help you fix the problem instantly. Get, Set, Go!

3 Simple Methods to Modify Records in Business Central

Insert, Modify or Delete records in Microsoft Dynamics 365 Business Central when permissions are not allowed, following these easy to go methods:

1. By Making Use of an Extension

- Create a New Extension

  • Open Visual Studio Code
  • Create a new AL project
  • Define a new table extension
  • Add fields and functions as required
  • Publish the extension

- Insert or Modify a Record using the Extension

  • Open Business Central
  • Go to the Extension Management page
  • Install the extension
  • Navigate to the desired record page
  • Use the extension to insert or modify the record

2. By Making Use of Web Services

- Create a Web Service

  • Open Business Central
  • Go to the Web Services page
  • Create a new web service
  • Define the required fields and functions
  • Publish the web service

- Insert or Modify a Record using the Web Service

  • Use a tool like Postman to send a POST or PUT request to the web service endpoint
  • Include the necessary data in the request body
  • The web service will insert or modify the record accordingly

3. By Making Use of an Integration Platform

- Select an Integration Platform

  • Research different integration platforms that are compatible with Microsoft Business Central
  • Consider factors such as ease of use, pricing, and available features
  • Choose the integration platform that best fits your needs

- Configure the Integration Platform

  • Set up the integration platform according to the provided instructions
  • Connect it to your Business Central instance
  • Define the necessary mappings and transformations

- Insert or Modify a Record using the Integration Platform

  • Use the integration platform's interface to insert or modify the record
  • Follow the platform's documentation for specific steps

Did you Know?

Microsoft has discontinued its support for Dynamics GP! Make a smooth Dynamics GP to Business Central migration today.

There are several methods via indirect permission to achieve the desired outcome when Microsoft Dynamics 365 Business Central does not allow direct permissions for inserting, deleting, or modifying data.

Utilizing extensions, web-based services, or connection platforms are some simple ways to effectively handle the data in Microsoft Dynamics Business Central (earlier known as Dynamics NAV). With these techniques, you can experiment to see which one best suit your needs.

For more queries on which methods help to maintain the database by adding, modifying, and removing records, you can drop us an email at arish.siddiqui@dynamicssquare.com or call us directly at +1 281 899 0865. Get in touch with your trusted Microsoft Dynamics Partner.

author
Vivek Gururani

Vivek is a Digital marketing expert at Dynamics Square, specializing in crafting compelling content on advanced tech topics such as ERP, CRM, cloud computing, AI, ML, BI and more. His profound passion for the digital landscape has led him to explore and master diverse fields including SEO, SEM, content strategy, and data-driven marketing.

blog-side-pic-1blog-side-pic-2

Book a Free Consultation

See How Dynamics Square Can Help Transform Your Business With Microsoft Business Applications.

Phone
contactfor-sede-img