locked
Is field level security possible for statecode (Active/Inactive) RRS feed

  • Question

  • I have a custom entity for which the field level security is disabled for the built-in statecode field. I want to enable field level security, but it won’t let me change the field security setting.

    Thanks.

    Monday, June 4, 2012 9:48 PM

Answers

  • Jim,

    Yes, you could definitely try to hide the "Deactivate" ribbon button and let the user deactivate the record through workflow.

    Alternatively, if you only want the owner to be able to deactivate a record, you could create a plugin that runs on SetState and SetStateDynamicEntity and check to see if the InitiatingUserId is the same as the owner. If not, throw the InvalidPluginExecutionException which will bubble up as an error dialog box.

    I hope this helps. If my response answered your question, please mark the response as an answer and also vote as helpful.


    Dimaz Pramudya | CSG (Melbourne) | http://www.xrmbits.com | dimaz@xrmbits.com If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Tuesday, June 5, 2012 12:11 AM

All replies

  • Thanks.

    That looks like a promising solution, but it isn’t clear whether it actually works and/or is maintainable. I will reply if I try it and it works.

    I see that the status is changed by clicking a built-in button on the ribbon. Could I hide that button and have the user run a workflow instead if I were willing to sacrifice some flexibility - say if I only wanted the owner to be able to deactivate?

    Monday, June 4, 2012 11:49 PM
  • Jim,

    Yes, you could definitely try to hide the "Deactivate" ribbon button and let the user deactivate the record through workflow.

    Alternatively, if you only want the owner to be able to deactivate a record, you could create a plugin that runs on SetState and SetStateDynamicEntity and check to see if the InitiatingUserId is the same as the owner. If not, throw the InvalidPluginExecutionException which will bubble up as an error dialog box.

    I hope this helps. If my response answered your question, please mark the response as an answer and also vote as helpful.


    Dimaz Pramudya | CSG (Melbourne) | http://www.xrmbits.com | dimaz@xrmbits.com If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Tuesday, June 5, 2012 12:11 AM