Sublayout Renaming - Sitecore

Overview

Occasionally it is necessary to rename a Sitecore sublayout. This article describes how.

Procedure

SQL

The following SQL, when run against the MASTER database, will give you the row that contains the path to the sublayout of interest.

select 
    * 
from 
    dbo.SharedFields 
where 1=1
    and ItemId = 'SublayoutGuid'
    and FieldId = 'E42081B6-8A95-4A11-89CE-DF70ED502F57'

Alternate SQL

The following SQL requires the dbo.ItemTree view, found here. Use the first query to determine the value to use in the other two. When you run Query 2, make note of the Value column value. You can use it (modified, of course) in Query 3.

/*--- Query 1 ---*/
select 
     ItemPath
    ,FilePath = Value    
    ,[SharedFields.ID] = f.ID
from 
    dbo.SharedFields f
    inner join dbo.ItemTree t
        on f.ItemId = t.ID
where 1=1
    and FieldId = 'E42081B6-8A95-4A11-89CE-DF70ED502F57'
    and t.ItemPath like '/sitecore/layout/sublayouts/globalpayments%'
order by
    ItemPath

/*--- Query 2 ---*/
select * from dbo.SharedFields f where f.Id = '[SharedFields.ID] from first query'

/*--- Query 3 ---*/
update dbo.SharedFields
set Value = 'new value'
where ID = '[SharedFields.ID] from first query'

Other Considerations

When renaming a sublayout, be sure to change the following as well.


You must also publish the sublayout under its new name before it will be available on the website.