Hello i am trying to Update come fields on one record for table "Sales Invoice Header" by code, but when it reach my modify(false); i got the error "You do not have the following permissions on TableData Sales Invoice Header: Modify. To view details about your permissions, see the Effective Permissions page. To report a problem, refer to the following server session ID: '91'."
Is there a way to achieve this?
Put my code for more references
salesInvcHdr.Reset();
salesInvcHdr.get(idDoc);
if success then begin
salesInvcHdr."Fiscal Invoice Number PAC" := uuid;
salesInvcHdr."Date/Time Stamped" := Format(Today);
salesInvcHdr."Date/Time Sent" := Format(Today);
salesInvcHdr."Error Code" := '';
salesInvcHdr."Error Description" := '';
salesInvcHdr."Electronic Document Status" := stampStatus::"Stamp Received";
end
else begin
salesInvcHdr."Fiscal Invoice Number PAC" := '';
salesInvcHdr."Date/Time Stamped" := '';
salesInvcHdr."Date/Time Sent" := '';
salesInvcHdr."Error Code" := '99';
salesInvcHdr."Error Description" := errMsg;
salesInvcHdr."Electronic Document Status" := stampStatus::"Stamp Request Error";
end;
salesInvcHdr.Modify(false);
Thanks in advance
0
Answers
> How can i achieve this? i already validate by code the write permissions and the procedure returns me false
Did you explicitly write Modify permissions for the sales invoice header on your codeunit, and nothing changed? Are you in Business Central on Prem or SaaS?
Permissions = tabledata "Sales Invoice Header" = RIMD;
At the beginning of your object, for example:
Codeunit 50100 YourCodeunit
{
Permissions = tabledata "Sales Invoice Header" = RIMD;
/*...your code...*/
}
Permissions = 0 = RIMD;
or
Permissions = "0" = RIMD;
If this is not working, it is probable not possible.
> Roby one last doubt i need to update different table on the same codeunit how can i grant permissions for all the tables?
I don't know if TallyHo solutions works, on c\al was necessary to specify each permission, try with TallyHo solution or specify permissions for each table separated by comma