2

I have 2 templates:

  • Template A: PersonalTemplate
  • Template B: PrivateTemplate

Here I want to inherit Template B in Template A using the PowerShell script.

1
  • It sounds like you just need to set the Base template field (__Base template). Is that what you're hoping to do? If so, you should be able to find what you need here: doc.sitecorepowershell.com/… Mar 21, 2019 at 13:46

1 Answer 1

6

Sitecore PowerShell has a function called Add-BaseTemplate. This function can add one or more base templates to a template item.

There are multiple ways to call it, but the simplest is to get both template items and then pass those to the function:

Add-BaseTemplate -Item <Item> -TemplateItem <TemplateItem[]>

You can use that to add Template B to the base templates for Template A like this:

$templateB = Get-Item master:\templates\path\to\TemplateB
$templateA = Get-Item master:\templates\path\to\TemplateA

Add-BaseTemplate -Item $templateA -TemplateItem $templateB

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.