I have created a new table where I store settings. These settings are used for posting data to an external party. For the posting I use a codeunit. But when a normal user trys to post I get an error:
Sorry, the current permissions prevented the action (TableData ....Read....)
In the codeunit I set the permissions RMID. But still not working. Am I missing something?
My table:
table 63000 /Middleware Settings/
{
DataClassification = ToBeClassified;
fields
{
field(1; Id; Text[200])
{
}
field(2; /Host/; Text[2048])
{
}
field(3; /ApiKey/; Text[100])
{
}
}
}
Codeunit code:
codeunit 69002 MiddlewareApiLogicCodeunit
{
Permissions = tabledata 63000 = rimd;
procedure SendRequestToApi(jsonText: Text; endPoint: Text; method: Text) response: HttpResponseMessage
var
client: HttpClient;
request: HttpRequestMessage;
contentHeaders: HttpHeaders;
requestHeaders: HttpHeaders;
content: HttpContent;
apiKey: Text;
settings: Record /Middleware Settings/;
apiEndPoint: Text;
begin
if settings.IsEmpty() then
Error('No middleware settings found. Please add settings on page /Middleware Settings/');
settings.FindFirst();