Tuesday, 4 December 2012

[ERROR FIX:] The selected control cannot store data because it is bound to a field or group that will not be included by default when a new form is created.


I. PROBLEM

For my today’s task, I was asked to investigate an error found in an infopath form wherein the sharepoint user could not create a new list item. When I opened the form in infopath designer, I could see the control but I could see an error “Control bound to missing field or group”. Not having a single idea on what it meant, I right-clicked the control and clicked on “More Info”.

"The selected control cannot store data because it is bound to a field or group that will not be included by default when a new form is created. To fix this problem, move the control into an optional section which is bound to the group that contains the controls field or group."




II. SOLUTION

After consuming some time trying to figure out what had caused this error, I realized that this is a configuration error that has something to do with the schema on both the queryfields and datafields. The queryfields are what infopath is looking when the form attempts to ‘query’ a data. On the other hand, datafields are needed by infopath when the form is trying to ‘save’ a data. The error has something to do with the datafields that is why the user is not able to save a new item on the list. So as a solution, simply go to the data tab and click on Default Values. Make sure that all the fields are checked in datafields. Follow the screenshot below.



HOW TO MAKE AN ATTACHMENT A REQUIRED FIELD IN INFOPATH FORM


I. INTRODUCTION

For today, I was asked by my project manager to modify an existing infopath form. The requirement is to make the attachment a required field in the infopath form. I thought that this is an easy thing to do as I have already experienced making a textfield required in an infopath form. For a normal textfield, this can be done by ticking the ‘Cannot be blank’ checkbox in the Validation tab.
In an attachment field, this will have a different approach and this is what I will discuss on this post.

II. SCOPE

This post assumes that the reader already knows how to create a custom list in sharepoint 2010. It is also required that the reader knows how to customize the layout of the sharepoint list form by using Infopath. A good post about doing this is located on this site. ( http://msdn.microsoft.com/en-us/library/office/gg180738(v=office.14).aspx )

III. REQUIREMENTS
- Sharepoint 2010
- Infopath Form

IV. IMPLEMENTATION

1. Navigate to
http://<your site collection>/ in your browser.
2. Navigate to your list and open the list form in the Infopath Designer 2010.

To open the list form in the Infopath 2010 Designer
1. On the List tab of the ribbon, Click Customize form as shown in Figure 1.

Figure 1. Customizing the list form


2. We will focus our attention in the attachment control. Drag the attachment field into the canvas and add a label ‘Attachment’ beside it.

Figure 2. Attachment field


3. To make the attachment field required, we will add a dummy textbox control that will contain the required rule. To do this, add a textbox control and place it before the attachment field.

Figure 3. Textbox in attachment field


4. Right click on the textbox control, hover on ‘Rules’ and click on Manage Rules.

Figure 4. Manage Rules on textbox


5. Create a rule for the textbox. Click on the ‘New’ rule button and click on Validation. Add a name to your rule. On the Condition window, Select the ‘Attachments’ field and on the condition, select ‘Is Blank’.

Figure 5. Condition window

  
6. Create another rule to hide the textbox. Click on the ‘New’ rule button and click on Formatting. Tick on the checkbox ‘Hide this control’.

Figure 6. Hide the control


7. That’s it! We are done. Try to add an item to the list and try to not add an attachment. The save operation should fail. The infopath should raise an error indicating that a required attachment field is empty.
Oscar L. Barit Jr. "I am Oca, i am writing to share with you some sharepoint matters that i learned on my day job. Enjoy! Mwah Mwah Tsup Tsup! "