I am working on a Business Central Extension. I have enabled REST API / Web Services via OAUTH 2.0 with the main goal of creating an retrieving data between BC and an app.
I am struggling to insert data into a specific table due to a validation check against the currently logged in user (UserId). Here's the specific error:
Here's the trigger excerpt (The last error is where the above is coming from):
The error: Error('UserID' + ' ' + '[' + UserId + ']' + ' has not been assigned to any employee. Please consult the HR officer for assistance'), is grabbing the User Name for the Microsoft Entra Application I created and enabled to allow for API calls to BC.
The Trigger is grabbing the User Name from the above User Information Sub section, and since that user information is not stored in the User table in Business Central, and it hasn't gone through some set ups, it will immediately fail the OnInsert trigger.
My question is, how can I change the User Information that is obtained in the API to something that I have in the User table in BC?
Or how can I add the above information to the User table in BC, so that it wont fail the check for the OnInsert?