Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Answered

Why I'm getting missing privileges on WebAPI Calls?

Posted on by 60

Hi, I can't figure out  why am I getting this error

"Principal user (Id=xxxxxxxx-0971-e911-a81b-000d3a3b5c20, type=8, roleCount=5, privilegeCount=4532, accessMode=0), is missing prvCreaters_solicitudreservas privilege (Id=xxxxxxxx-22cf-4407-9986-34cc471264e1) 
on OTC=10585 for entity 'new_logentity'. context.Caller=xxxxxxxx-0971-e911-a81b-000d3a3b5c20. Or identityUser.SystemUserId=xxxxxxxx-c987-e911-a81c-000d3a3b5cdb, identityUser.Privileges.Count=909, identityUser.Roles.Count=2 is missing prvCreaters_solicitudreservas privilege (Id=xxxxxxxx-22cf-4407-9986-34cc471264e1) on OTC=10585 for entity 'new_logentity'." }

I'm Using a JS to create a record on new_logentity (logged as simple user) but I'm impersonating with an user(Admin) and it's unable to create the record? should i add those rights to the  normal user?  

var userId = "xxxxxxxx-0971-e911-a81b-000d3a3b5c20";
function Create_WebApi(query, obj, behalfAsOtheruser = false) {
    var req = new XMLHttpRequest();
    req.open("POST", Xrm.Page.context.getClientUrl()   "/api/data/v9.1/"   query, false);
    if (behalfAsOtheruser)
        req.setRequestHeader("MSCRMCallerID", userId);
    req.setRequestHeader("OData-MaxVersion", "4.0");
    req.setRequestHeader("OData-Version", "4.0");
    req.setRequestHeader("Accept", "application/json");
    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    req.send(JSON.stringify(obj));
    req.onreadystatechange = function () {
        if (this.readyState === 4) {
            req.onreadystatechange = null;
            if (this.status === 204) {
                //Success - No Return Data - Do Something
                return true;
            } else {
                //Xrm.Utility.alertDialog(this.statusText);
                return false;
            }
        }
    };
}

thanks.

  • Verified answer
    MehranBre Profile Picture
    MehranBre 730 on at
    RE: Why I'm getting missing privileges on WebAPI Calls?

    Hello

    Yes, the simple user should have at least access to read the record because when this does not happen the user can not own the record and you will receive an error.

    best regards.

  • Verified answer
    Anand Kumar M Profile Picture
    Anand Kumar M 120 on at
    RE: Why I'm getting missing privileges on WebAPI Calls?

    I believe in such case the Simple user should have basic level privileges on the entity. 

  • TerryShowman Profile Picture
    TerryShowman 60 on at
    RE: Why I'm getting missing privileges on WebAPI Calls?

    could anybody help me?

    if an user(let's call it Simple) wants to create a record in a Table with no permission to create BUT, that user can bahalf as another and impersonates the User(let's call it Admin) then.. ¿Does Simple user need privilege for Create?

  • TerryShowman Profile Picture
    TerryShowman 60 on at
    RE: Why I'm getting missing privileges on WebAPI Calls?

    Hi, thanks for your time.

    Thats, it's exactly my doubt I'll try explain it 

    Simple User .- A normal user that hasn't privileges to create on custom entity, but prvActOnBehalfOfAnotherUser is On

    Admin User.- Has all privileges 

    So if I impersonate the simple user as admin user, does simple user must have those privileges(Create on custom entity ON)?

  • Verified answer
    Ayaka Iwai Profile Picture
    Ayaka Iwai on at
    RE: Why I'm getting missing privileges on WebAPI Calls?

    According the error, it looks you don't have Create privilege of new_logentity entitiy.

    Please check this user's security role and add the missing privilege.

    If you want know cause in detail, we have to know your org customization, so I recommend you to create a support ticket for further investigation

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans