A lookup field stores a reference to an item in another SharePoint list. It is useful when a request list needs users to choose from centrally maintained options rather than type free-form values. In a site-request workflow, a Template lookup points from Site Requests to the Site Templates list, letting the form present available templates as a drop-down. section 11.2.2
Creating a lookup field with PowerShell requires field XML. The XML identifies the target list through its GUID in List, selects the displayed target column with ShowField, and identifies the destination list through SourceID. Add-PnPFieldFromXml then adds the field to the request list. Making the field required ensures a submitted request includes a template selection. section 11.2.2
$xml = @"
<Field
Type="Lookup"
DisplayName="Template"
Required="TRUE"
EnforceUniqueValues="FALSE"
List="{$($templateList.Id)}"
ShowField="Title"
UnlimitedLengthInDocumentLibrary="FALSE"
RelationshipDeleteBehavior="None"
ID="{$(New-Guid)}"
SourceID="{$($list.Id)}"
StaticName="Template"
Name="Template"
ColName="int1"
RowOrdinal="0"
/>
"@
Add-PnPFieldFromXml -List $list -FieldXml $xml
The field definition connects Template to the Site Templates list, displays its Title value, and marks the selection as required. section 11.2.2
When Get-PnPListItem retrieves a SharePoint item, field values are held in a hashtable under internal field names. Ordinary fields such as Title can be simple strings, while lookup fields expose lookup information rather than the final value needed by the automation. A template lookup provides LookupId and LookupValue; the ID can retrieve the selected item from the referenced list. section 11.3.3
Resolve a selected site template
Read the Template value from a Site Requests item, use its LookupId to fetch that item from Site Templates, then read the template item's Name field. This turns the form selection into the internal template name used during site creation. section 11.3.3
$templateItem = Get-PnpListItem -List 'Site Templates' -Id $item['Template']. LookupId $templateItem['Name'] SITEPAGEPUBLISHING#0
This retrieval uses the lookup value's LookupId to load the selected template item and obtain its Name value. section 11.3.3
This two-step pattern keeps request entry readable while preserving the implementation value needed later. The requester sees a template title in the form; the automation retrieves the matching internal name before creating the site and recording the resulting URL and status on the request. section 11.2.2 section 11.3.3
