Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11508

Event Receiver to update field in list based on another list's corresponding field

$
0
0

I have a requirement where I have to update a field on a list based on the value of the same field in another list. However, it has to update the field of the same list item. I already started writing the item updating event receiver but am stuck as to how to get the corresponding list item.

List 1 has field A and field B

List 2 has field A and field B

Both lists are in the same site.

Field A is a column that contains numbers to identify an item. Field B is a column that contains a comment. List 1 has both fields complete. List 2 has all of the field A values, but has no field B values.

Example:

List 1

Field AField B
957Comment 1
834Comment 357

List 2

Field AField B
957
834


So, if I make a change to list item 957 in List 1 by changing its field B from 'Comment 1' to 'Comment 257', how do I replicate the change in List 2's list item 957 field B? The desired effect would be for List 2's list item 957 to have its field B show 'Comment 257' to match List 1. I am thinking that I need to use SPQuery, but am not sure.


Viewing all articles
Browse latest Browse all 11508

Trending Articles