Posts

Showing posts with the label PowerShell

Running SQL Queries On Sitecore Databases Using Sitecore PowerShell Extensions

Image
  Whether you are developing on Sitecore or supporting a live Sitecore instance, there are times you need to access the SQL databases to run queries to fetch some data. While the Sitecore APIs provide access to the items in the content tree, they are not very useful when you want to check the old login tickets in core database, or need to inspect the JWT tokens received from identity provider when using federated authentication.  There are many reasons for a Sitecore developer to want to access the Sitecore database. I am sure there are equal if not more number of reasons for the security team to deny access. Many a times you would be an admin on the Sitecore instance but won't even have read-only access to the SQL databases. In this article I am going to show how you can run simple queries on the Sitecore databases using the power of SPE. For this to work, you need to have access to use the PowerShell ISE on the Sitecore instance. First, we will need to fetch the connection s...

Fix for the issue with renaming local data sources resulting in broken links

Image
Sitecore introduced local/page data sources with SXA. The local data sources allow better organisation of your page specific and shared data sources. However, one challenge with local data sources is, the links to them won't automatically get updated when you rename them. This is because Sitecore uses the path instead of ID to link to local data sources. If you inspect the raw value of final renderings field of a page with module that has local data source you can see the path "local:/Data/...". For this reason Sitecore warns about renaming local data sources manually. The documentation clearly says you need to convert your local data source paths to IDs using the out of the box scripts provided before renaming the local data source item. (Source: https://doc.sitecore.com/xp/en/developers/sxa/93/sitecore-experience-accelerator/data-sources.html#rename-local-data-sources) The script works fine in most cases, except for when not all your data sources are direct children of ...