How to SharePoint form library permissions based on form information

Hi Experts, I've built an InfoPath form that I published to a SharePoint forms library.  As part of my form I have a 'Status' drop box with the entries: Planned, In Progress, Complete, Canceled.  Based on the 'Status' value of the form I need to be able to set permissions as follows:
   Planned = Editable by everyone
   In Progress =  Editable by the assigned person (another field in the form) and by the admin - Read Only to everyone else
   Complete & Canceled = Editable by the admin - Read Only to everyone else

I know this is sort of like a work flow, but I don't have the option to develop a custom WF and promote it to the production server - I was hoping it might be possible to accomplish this through code on my form.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Justin ImesFull Time SharePoint JediCommented:
my first thought was sharepoint designer, the workflow wouldn't be too complicated, but you will need this add on to accomplish it.
This is not a "true" permissions solution since someone may still be able download the xml, edit it manually and upload it with overwrite. In that case it is certainly not an accident and if versioning is turned on you should be able to address.

Since you are not afraid of code, if you store the currently assigned user in the form you can try this:

Attach a on changing event to the root node of the form.
Compare your criteria inside this method using if statements. If the change needs to be denied, you can cancel the change and display a message box.

Check out the code snip for canceling the change.

You may also do this with Submit rules if you use a submit button rather than letting people save the form direct.
public void rootNode_Changing(object sender, XmlChangingEventArgs e){

e.CancelableArgs.Cancel = true;
e.CancelableArgs.Message = "You may not edit";

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SharePoint

From novice to tech pro — start learning today.