microsoft / bc2adls

Exporting data from Dynamics 365 Business Central to Azure data lake storage
MIT License
92 stars 53 forks source link

Add permissions to "ADLSE - Track Delete" #131

Closed Arthurvdv closed 1 year ago

Arthurvdv commented 1 year ago

image

In the OnAfterOnDatabaseDelete method the user also need read and execute permissions on the "ADLSE Table Last Timestamp" record, see the error message (in Dutch) above.

    [EventSubscriber(ObjectType::Codeunit, Codeunit::GlobalTriggerManagement, 'OnAfterOnDatabaseDelete', '', true, true)]
    local procedure OnAfterOnDatabaseDelete(RecRef: RecordRef)
    var
        ADLSETableLastTimestamp: Record "ADLSE Table Last Timestamp";
        ADLSEDeletedRecord: Record "ADLSE Deleted Record";
    begin
        // exit function for tables that you do not wish to sync deletes for
        // you should also consider not registering for deletes for the table in the function GetDatabaseTableTriggerSetup above.
        // if RecRef.Number = Database::"G/L Entry" then
        //     exit;

        // check if table is to be tracked.
        if not ADLSETableLastTimestamp.ExistsUpdatedLastTimestamp(RecRef.Number) then
            exit;

        ADLSEDeletedRecord.TrackDeletedRecord(RecRef);
    end;