Skip to content

Failed to lookup current user during business object sync

Error message (sample)

The portal returns an error while syncing business objects. Example (redacted):

{
    "message": "An error occurred while syncing the business objects: POST to 'https://<redacted-host>/api/metadata/tables?loglevel=Error' failed with BadRequest :: { \"message\": \"Exception - Failed to lookup current user\", \"errors\": [\"Exception: Exception - Failed to lookup current user: Object reference not set to an instance of an object.\"] }",
    "errors": [
        "An error occurred while syncing the business objects: POST to 'https://<redacted-host>/api/metadata/tables?loglevel=Error' failed with BadRequest :: { <redacted payload> }"
    ]
}

Symptoms

  • Portal shows a BadRequest error when syncing business objects.
  • Metadata table sync fails from the NPO Portal (npobp_portal).

Scope

Occurs when syncing metadata/business objects against a target Microsoft DataVerse (Power Apps) environment.

Root cause

The calling Power Apps/Dataverse user is not valid in the target Dataverse environment. This commonly happens when one of the following is true:

  • The user does not exist as a user in the target Dataverse environment.
  • The user exists but has no security roles assigned.
  • The Power Platform environment is in administration mode and the user is not a System Administrator.

Resolution

  1. Confirm the identity used by the portal/API call.
  2. In the target Dataverse environment, verify that this identity exists as an enabled user.
  3. Ensure at least one appropriate security role is assigned.
  4. If the Power Platform environment is in administration mode, ensure the user has System Administrator privileges.
  5. Retry the business object sync.

Verification checklist

  • [ ] User exists and is enabled in target Dataverse environment
  • [ ] User has required security role(s)
  • [ ] User is System Administrator when administration mode is enabled
  • [ ] Business object sync succeeds without the "Failed to lookup current user" error