-
-
Save patelcp/1cf0925df7d08baa9ba4567ac83353bb to your computer and use it in GitHub Desktop.
Find the fields used by a template, excluding the standard template fields in Sitecore PowerShell Extensions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a list of field names on the Standard Template. This will help us filter out extraneous fields. | |
$standardTemplate = Get-Item -Path "master:" -ID ([Sitecore.TemplateIDs]::StandardTemplate.ToString()) | |
$standardTemplateTemplateItem = [Sitecore.Data.Items.TemplateItem]$standardTemplate | |
$standardFields = $standardTemplateTemplateItem.OwnFields + $standardTemplateTemplateItem.Fields | Select-Object -ExpandProperty key -Unique | |
# Change the Id to something other than the Sample Item template. | |
$itemTemplate = Get-Item -Path "master:" -ID "{76036F5E-CBCE-46D1-AF0A-4143F9B557AA}" | |
$itemTemplateTemplateItem = [Sitecore.Data.Items.TemplateItem]$itemTemplate | |
$itemTemplateFields = $itemTemplateTemplateItem.OwnFields + $itemTemplateTemplateItem.Fields | Select-Object -ExpandProperty key -Unique | |
$filterFields = $itemTemplateFields | Where-Object { $standardFields -notcontains $_ } | Sort-Object |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment