During latest interaction with various people who are using the BDC Browser to generate their BDC Models I’ve come across one question many times. The question is “How do I stop a field form appearing from my New Item (create) & Edit Item (update) Forms ?”
Let’s take the example of the Models that are delivered OOB for DuetEnterprise Feature Pack 1.0. We will consider the CRMContacts model for our discussion.
Well, there are many ways to go about hiding the field. First you need to ask yourself the following questions
1. Do we actually need the field in any of my stereotypes i.e. Read , Query , Create or Update?
If the answer is no, then we want to make the field totally disappear from our Model. Go to the SharePoint designer and uncheck the field from all the stereotypes wherever it is appearing (shown below is a sample screen).
We need to be carefully so that we don’t have any field in the Specific Finder (Read) method unchecked which checked else where. If this is the case then sharepoint will not create the default forms for the external list. The onus to make sure that you have not unchecked any mandatory fields also lie with you. So make sure you are not removing any mandatory fields or else your calls will start failing in the backend.
2. Do I need to remove it from the View Item(specific finder) page?
Unfortunately, this step is not possible if you want to use the external list pages that are automatically create by SharePoint. Read method return set defines the entity structure and sharepoint build forms based on this structure. All the return set for any other method should be a sub-set of the Read method return set.
3. Do I need to remove it from create / update screens?
If you which to hide a field from create screen , update screen or from both at the same time , all you need to do is to again uncheck the field for the specfic method form the SharePoint designer as shown below:
If you do not have access to SharePoint designer then this can be done manually by modifying the model file. After opening the model in an editor / notepad go the specific method definition ( in our example we would go to the Create Method). The methods can be identified by “MethodInstance” tag’s “Type” attribute. So in our case we are looking for the type “Creator”.
Once you have located the method , scroll up to the TypeDescriptor corresponding to the field . If we take “FullName” (shown up) as example then in the model file you would find it as:
Now , all you need to do is to remove [CreatorField=”true” ] from the tag. So the new tag would look like:
With this you are done.
Similarly for update scenario, you need to remove the [UpdaterField=”true”] from the update method field typedescriptor as shown below:
Change this TypeDescriptor to
Once this is done, you can upload the model back and you should be able to see the desired changes.
Hope this helps!!!