SP.FieldLookup.primaryFieldId property (sp.js)

Gets or sets a value that specifies the primary lookup field identifier if this is a dependent lookup field. Otherwise, it is an empty string.

Applies to: apps for SharePoint | SharePoint Foundation 2013 | SharePoint Server 2013

var value = SP.FieldLookup.get_primaryFieldId ()
var value = SP.FieldLookup.set_primaryFieldId ()

Return value

If the field is a secondary field in a multi-column lookup, this property returns the string representation of the GUID that identifies the primary lookup field; otherwise, it returns an empty string.

Exceptions

Exception Type

Condition

NotSupportedException

The field belongs to an external list.

You cannot change the value of this property after it has been set.

Remarks

When you create a multiple column lookup, the primary field is the FieldLookup object that establishes the relationship with the source list. One or more secondary fields depend on the primary field for the relationship to the source list.

If the current SPFieldLookup object's IsDependentLookup property returns true, then the current object is a secondary field and its PrimaryFieldId property will return the string representation of the GUID that identifies the primary lookup field on which it depends.