I have two lists. The first one has customers and the second one has Orders. Now i want to add some (test) data in the elements.xml of the listinstances. For customers this works without a problem

      <Field Name="Id">1</Field>
      <Field Name="FirstName">Beni</Field>
      <Field Name="LastName">Egli</Field>

Now I want to do the same for the orders. An order is linked to a customer via a lookupfield. I also want to set the date to (for example) today.

      <Field Name="Id">1</Field>
      <Field Name="CustomerLookup">2</Field>
      <Field Name="Date">[today]</Field>

The Date=[Today] can't even deploy and when I remove the date line no entries are added (date is not required)

  • how did u create Date Field? I think u should set default value when u r creating ur field
    – user7676
    Apr 3, 2012 at 8:19
  • I agree, set the Date field to have a default value of Today/Now.
    – Ian
    Apr 3, 2012 at 9:25
  • You could also inject data on feature activated, then you have full control of what and how you add data
    – eirikb
    Sep 12, 2012 at 6:14

2 Answers 2


This will not work because Sharepoint will eventually put every list item in the same table in the database. The order item will not be added since an item with ID=1 already exists. (the customer item).

It is not recommended to add list items this way, and as suggested above you could use a feature event receiver to add items instead.

If you would like to use the xml make sure that the ids do not match. This can be tricky when you get a lot of lists and items in them.


I don't know about the lookup field but for date field you can write this way:

  <Field Name="Id">1</Field>
  <Field Name="Date">2011-12-30T21:00:00Z</Field>

Refer this discussion for more details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.