2

I've got several list which have lookup fields, and I can't add new items to any of them. Every time I've clicked save, I get this error:

"Invalid data has been used to update the list item. The field you are trying to update may be read only."

None of the fields are set to read only. I've built the list "manually" by creating the XML files longhand in VS, but all those without lookup fields work fine. I've tried adding data manually by populating the element in the list instance, but I don't know how to properly do the lookup field.

Any ideas?

Edit: Relevant field XML

<Field ID="{5115854A-BC9E-498B-B54E-2EAAD6E89119}"
    Type="Lookup"
    Name="ParentCode"
    DisplayName="BL2"
    List="Lists/BL1"
    FieldRef="Code"
    ShowField="Title"
    Group="BL Columns">
</Field>

Which references these fields in list BL1:

<Field ID="{DAAEF78C-4756-458E-8F8F-B40352BF5BEA}"
    Type="Text"
    Name="Title"
    DisplayName="BL1"
    Group="BL Columns">
</Field>
<Field ID="{42C00D43-D33F-420A-A85A-15E5AD0183F8}"
    Type="Text"
    Name="Code"
    MaxLength="6"
    DisplayName="BL1 Code"
    Group="BL Columns">
</Field>

The contents of the lists are shown fine in the form dropdown, it's just the save that's broken.

  • Can u post your code? Thanks – Frederik P. Apr 26 '12 at 10:32
0

You should use ID of the lookup target, when setting values to look up fields. Take a look at this post How to set ListItem Lookup Field value

0

I think you have to set a extra field property --> Overwrite="TRUE"

  • While this is true, it will not fix the error, but it will allow the fix to be added. – Sam Sussman Dec 1 '12 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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