Home > SharePoint, SharePoint 2010 > SharePoint – Updating External Lookup Field

SharePoint – Updating External Lookup Field

Updating an external look up is a bit different compared to updating other look up fields.

Below is a small snippet which can help you with this task

SPBusinessDataField dataField = item.Fields["Field Display Name"] as SPBusinessDataField;
item[dataField.RelatedField] = EntityInstanceIdEncoder.EncodeEntityInstanceId(new object[] { NEWVALUE }); ;
item["Field_x0020_Internal_x0020_Name"] = newCRMNumber;

For getting SPBusinessDataField you need to get the fields from item which is the listitem we are trying to modify.

item.Fields["Field Display Name"] – This require you to pass the Field Display name

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: