ItemUpdated List Item Comparison

54 Views Asked by At

Is it possible to compare the properties listItemId with a field in a new list? I have an event receiver, I want to update a new list once an item in updated. I don't want to use GetItemById, I want to compare the first list auto generated ID with a field in the new list.

foreach(ListItem UpdateItem in destListItems) {
  if (properties.ListItem["ID"] == UpdateItem["NewId"]); {
    //Do something
  }
}

The script does not update the item in the destination list. Any suggestions?

1

There are 1 best solutions below

0
On

Try this:

if (properties.ListItem["ID"].ToString() == UpdateItem["NewId"].ToString()); {
    UpdateItem["Field"]="123";
    UpdateItem.Update();
}