Share via


Creating Records

When you are calling the CreateRecords operation, the Schema element should describe the structure of the Data element. Any field that is omitted from a record will be assigned its default value. If you specify the _ParentID field, the record is created as a child of the specified record. You can also specify values for the _Editors, _Readers, CreatedBy, CreatedByURL, ModifiedBy, and ModifiedByURL system fields. If you specify values for any other system fields, the values are ignored.

Although it is possible to generate a schema by other mechanisms, you should first call the QueryRecords operation and set the QueryMetadataOnly parameter to true. This returns a Schema element that includes the record schemas for all of the forms in the tool.

If you are creating parent and child records, you must do so in separate operations. You must follow these steps to create parent and child records:

  1. Create the parent record.

  2. Use the returned RecordURI to read the newly created record with ReadRecords and get its _RecordID.

  3. Create the child record, specifying the parent record's ID in the _ParentID element.

Note

The forms designer can impose constraints on the values that the user can enter on forms. The designer can define constraints for form fields or can create custom constraints in forms script code. The constraints that are defined on a form field are applied when you call CreateRecords. If any updated record fails any constraint, the CreateRecords operation fails and no records are created. In contrast, any constraints defined by the forms designer in script code are not applied when you call CreateRecords. It is the responsibility of the Groove Web Services application developer to be aware of these constraints when updating a Forms tool through CreateRecords.

In order to call CreateRecords successfully, the identity specified in the GrooveHeader object must have permission to create the records.

You cannot create records using the record schema of a form that has been deleted.

Creating records in the InfoPath Forms tool has different requirements than creating records in the Groove Forms tool. In the InfoPath Forms tool, the InfoPath XML document that describes the entire record is stored in the Forms_Tool_IPContents attachments field. If you are creating records, this field must be present in each record and it defines the values of all designer-defined fields. If you also specify values in the individual designer-defined fields, these values are ignored when creating a record. When creating records, the value in this field must be a valid InfoPath X-document for the tool's InfoPath template. In addition to conforming to the InfoPath schema, the X-document must have a name that is identical to the InfoPath Form ID and a solution version that is equal to the InfoPath Form Template version.

You can achieve a minor improvement in efficiency by reducing the size of the Forms2RecordDataSet by excluding the columns of the system fields that are ignored in CreateRecords, such as _RecordID, or the columns where you are setting the fields to their default values, such as _CreatedBy.

In This Section

Example Code: Creating a New Discussion Topic and Response

See Also

Reference

GrooveForms2.CreateRecords Operation

Concepts

Accessing Forms Tool Records
Using ADO.NET DataSets to Access Forms2RecordDataSet Data
Example Code: Converting ADO.NET DataSet to Forms2RecordDataSet
Reading Records Specified by URI