August 10, 2010 02:27 PM

Q: How Do I Make a Type String Type Descriptor a Required Field in the BDC Explorer

SharePoint Pro
InstantDoc ID #125751
Rating: (6)

By Tomek Stojecki, Stefan Kowalewski, and Ethan Wilansky

Problem:
You have a type descriptor of type string and you want to make it a required field in a Visual Studio 2010 Business Data Connectivity (BDC) app definition.

By default, the nullability of a type descriptors’ underlying data type determines whether the field is required or not in an auto-generated list form tied into an external list. Because the System.String type is nullable in .NET, the type descriptors of type string result in non-required fields on the forms, even though the LOB system might require a value for it.

Solution: To make a type descriptor of type string a required field in the BDC Explorer, select the type descriptor and in the Properties window, under General, click the Custom Properties field.

This displays the Property Editor modal window. Enter the following values into the respective columns:

Name

RequiredInForms

Type

System.Boolean

Value

true


Keep in mind these important tips:
1. Because the Value field is a multiline field, if you enter text into the Value field last and hit Enter, the OK button doesn’t become enabled, which prevents you from completing this operation.

To enable the OK button, set a cursor back into the Name field after all the values have been entered, then hit Enter, or enter the values in a reverse order, where the Value field isn’t set last.

2. The Boolean values are case sensitive. Enter the value of true or false (all lowercase); otherwise you will receive a parser error when compiling the project.

See all the SharePoint Q&As:


Sharepoint Q&A: How Can I Create an External List When SharePoint Throws an Unspecfied ASP.NET Error?

Sharepoint Q&A: How Can I Create an Action for an External Content Type in SharePoint?

Sharepoint Q&A: How to Make a Type String Type Descriptor a Required Field in the BDC Explorer

Sharepoint Q&A: Data Source Conflict

Related Content:

ARTICLE TOOLS

   
Comments
  • Stojecki
    1 year ago
    Feb 08, 2011

    @Vandeput: If you can submit the form without an error, than the validation didn't kick in for some reason. Two things I can recommend are:
    Make sure the RequiredInForms property is defined on the right type descriptor - you actually need to specify it on the ReadItem method's type descriptor, because that is where the XSLT LVWP is pulling the metadata for validation.
    Delete the list and the content type, then redeploy the model and recreate the list. We have run into scenarios where changes made to external content typed were not visible until we have redeployed the model and recreated the list. In the list settings you should see the field marked as required.

  • Caroline Marwitz
    1 year ago
    Feb 07, 2011

    I'll check and see what Tomek says. Caroline.

  • Vandeput
    2 years ago
    Dec 14, 2010

    This is not working for me!
    When I had to property, I still can save an item with no value in it...
    Any help?

    Grtz

  • Vandeput
    2 years ago
    Dec 14, 2010

    This is not working for me!
    When I had to property, I still can save an item with no value in it...
    Any help?

    Grtz

  • Vandeput
    2 years ago
    Dec 14, 2010

    This is not working for me!
    When I had to property, I still can save an item with no value in it...
    Any help?

    Grtz

You must log on before posting a comment.

Are you a new visitor? Register Here
   
   

Dan Holme's Viewpoint on SharePoint Blog

Office 365 Plan for Pain

With cloud services, even Office 365, what you don’t know about your cloud service can hurt you,...

SharePoint News and Products

Let SharePoint Be SharePoint: Making Social Collaboration Secure

Hesitant about unleashing SharePoint's social features? SharePoint security vendors aim to help....

Dan Holme's Viewpoint on SharePoint Blog

Microsoft SkyDrive Updates in the News

Microsoft's cloud storage, sharing, and collaboration platform for Windows Live is updated,...