Locked Schema Got You Down? - Hilary Stoupa
in

InfoPath Dev

Hilary Stoupa

Locked Schema Got You Down?

Sometimes we want to create a new template off an existing schema. Microsoft has a great article here (EDIT: that link seems dead, but currently a copy is available here), but for those of you who have already created a form off an existing schema, and just want to know how to unlock it, it can be a bit much to dredge through (also, they don't even mention the little .xsf hack I'm going to show you....). Fortunately, you have me, and I feel your pain.

The Problem

You saved a beloved form as source files, because its schema was perfect, and you want to base another form off of it. You create a new form template, chosing XML or Schema for the source:
Base off xsd

and you happily design away... until you want to add a field. Or change the name of an existing field. That's when you realize.... you're stuck:
Locked Schema

See those little locks on the data fields? And at the bottom of the Data Source Task Pane, Add a Field or Group is grayed out....
Add fields

The Reason

If you read the article I've linked in the first paragraph, it says:

When you design a form that is based on an external schema, Microsoft Office InfoPath 2007, or Microsoft Office InfoPath 2003 assumes that the schema is finalized and therefore prevents any modification of the schema in the Data Source task pane.

So there you have it. InfoPath figured you were perfectly happy with the schema when you built the form off it.

One Solution

You can manually add elements to your schema. Save your form as source files and open myschema.xsd in a text editor. Here is my original schema:
Original Schema

And now I've added another string field named String2:

When I save my change and open manifest.xsf in design mode, I can see my newly added field:
New field

Another Solution

But what if you just want it unlocked, so you can add fields like a normal old data source? For that, again, we need to save as source files. Open manifest.xsf with a text editor. Look for your schema file in the files element. You'll see a property named editability which has helpfully been set to 'none':

 

Set this property to 'full':

 

Save your changes, and open your template in design mode again:

All your fields will be fully editable.

The Usual Warnings Apply

Save a copy of your form someplace safe before manipulating form files. This is by no means a full discussion of potential pitfalls that can be encountered -- more information on xsf structure is available here. Happy unlocking!
 

Comments

 

texastwo said:

Ms Hilary,

Pardon my ignorance, but if I built a form that relies on secondary data, will this unlock that data so I can add additional columns to the padlocked data? Or is this just for importing schema.

April 28, 2010 5:10 PM
 

Hilary Stoupa said:

This is just for imported schemas -- since the schema for your secondary data source is related to the actual data source (thus, outside of your form), you'll want to leave that locked.

May 26, 2010 4:46 PM
 

kclark said:

Hey Hilary,

Mine are still locked...

June 18, 2010 1:51 PM
 

Hilary Stoupa said:

I'm afraid without additional information, I don't really know what to suggest. Which did you try? Changing the schema file? or modifying the manifest?

June 18, 2010 3:55 PM
 

Jimmy said:

I found that when I tried this (the manifest hack) on a certain form, InfoPath prevented me from opening the template in design mode, giving the error "The operation failed."  I was able to fix this by modifying the schema to remove any namespace declarations that weren't actually used in the schema, and reimporting the schema in a new form.

August 17, 2010 8:35 AM
 

Gennady Vanin (Геннадий Ванин, Новосибирск) said:

Both links in the beginning of article are broken.

In Infopath 2010, which file do I open for "chosing XML or Schema for the source" and why?

Why not just save a template under another name?

August 24, 2012 6:42 AM
 

Hilary Stoupa said:

Search for ms kb 827006 to find the KB article.

I do not understand your other question - there are many reasons you may want to base a form off an existing schema - perhaps the schema was not from another InfoPath form. InfoPath is not the only application that uses XML. :-)

September 5, 2012 8:23 AM
 

bllittle said:

Hi Hilary,

thanks for the article, but I still can't get it to work. I have searched for kb 827006 and that returns no results on the MS site for me.

When I change the value in the manifest.xsf file to "full", InfoPath will not open the file any longer, giving me the oh so helpful message of: "InfoPath has encountered an error. The operation failed."

Any suggestions?

September 6, 2012 1:01 PM
 

Hilary Stoupa said:

Looks like Jimmy ran into the same issue - you'll see that in a comment above. You may just want to manually add your new fields to your schema instead of trying to unlock it.

October 9, 2012 7:56 AM

About Hilary Stoupa

I wandered into development after working as a business process analyst for a global manufacturing company. I create InfoPath solutions for our clients as well as work as a developer on company tools that extend InfoPath. I've also been instrumental in creating the InfoPath Master Class training provided by Qdabra.

Copyright © 2003-2018 Qdabra Software. All rights reserved.
View our Terms of Use.