locked
CRM 2013: Plugin error: Assign prv is missing RRS feed

  • Question

  • Hi Friends,

    Need you inputs on the following issue if you aware.

    We have registered a plugin on custom entity, on update of a custom option set field. If the value of the field is equal to "XXXX" then we are reading fields value from plugin context and passing it as an object to WCF service. If we update the custom record with System Admin role then it is working fine. But when we update the record with our custom role which is having Create,read and write privilege alone on that entity, we are getting "Principal user is missing prvAssigncustomentity" error. we are not doing Assign operation over here. Just reading the values. Please provide you suggestions.

    Thanks.

    Wednesday, December 17, 2014 7:19 AM

All replies

  • Hi,

    Can you check who is the owner of that record.

    You also need to check if the user has Create, read and Write privilege at what level?

    Whether its for his own record i.e. User level, or BU level or Org level.

    Thanks,

    Prasad

    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Wednesday, December 17, 2014 7:29 AM
  • Create, read and Write privileges are at Bu level and along with it Append permission is at org level.

    Getting this error for his own record.

    Wednesday, December 17, 2014 7:34 AM
  • Hi,

    Check if you have any lookups in your custom entity and that you have required privileges in those entities.

    Try using

    MyXrmServiceContext.UpdateObject(yourupdatedobj);
    MyXrmServiceContext.SaveChanges(); 

    If you are using anything different.

    Thanks,

    Prasad

    Wednesday, December 17, 2014 9:01 AM
  • Hi,

    I'm not updating any fields over here. Just reading the fields.

    Note: Plugin is registered in Post Operation.

    Thanks.

    Wednesday, December 17, 2014 9:06 AM
  • Can you clarify what you code is doing, and ideally post the code ? In your first post you said 'we update the custom record ', but in your last post you say you just read the fields - are you doing an update, or not ?

    One possible problem is if the Entity instance that you pass to the update includes the ownerid field. Crm shouldn't allow you to update the owner via an Update, but it may be that passing the ownerid triggers a check on the Assign privilege. If doing an update, you should only pass the attributes that have changed


    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

    Wednesday, December 17, 2014 9:07 PM
    Moderator
  • Sorry if my first post was not clear. Let me elaborate the scenario.

    Lets say, I have Custom entity "Actions" which has custom field "Action Type".

    On Update of Action Type, my plugin will trigger on Post-operation. If the Action Type value is eg:"Sent Email", I will read the other fields value of Actions from the Plugin context and pass the data to WCF service. No where I'm updating the Action entity in my code. But getting the "Principal user is missing prvAssigncustomentity" error.

    Thursday, December 18, 2014 1:28 PM
  • I completely understand your issue and I am facing exactly the same issue on update of a custom entity record. Do you know the solution for this?
    Friday, December 9, 2016 8:28 AM
  • Here is the solution my dear friends. The code segment and the inline comments says it all!

    Old code: Erroneous
    Entity curCounter = RetrieveCounterDateFromCRM(curUserData); //Retrieved OwnerId field as well
    curCounter["new_currentvalue"] = (int)curCounter["new_currentvalue"] + 1; //This is erroneous
    tracer.Trace("Trying to update User Counter [new_counter] record");
    service.Update(curCounter);

    New code: Issue fixed
    Entity curCounter = RetrieveCounterDateFromCRM(curUserData); //Retrieved OwnerId field as well
    Entity updateCounter = new Entity("new_counter", curCounter.Id);
    updateCounter["new_currentvalue"] = (int)curCounter["new_currentvalue"] + 1; //Works fine - Issue fixed
    tracer.Trace("Trying to update User Counter [new_counter] record");
    service.Update(updateCounter);

    I've tested this myself and it worked for me for obvious reasons. Please mark this as the right answer if you found this useful!
    Friday, December 9, 2016 11:59 AM