Logging to the SiteCron Last Run Log

I’ve worked with SiteCron quite a bit, but up until recently I hadn’t realised until recently that there was a field that should be used to track what happened when the Cron Job last ran, this field is the ‘Last Run Log’. I think it’s been around since version 2.18 but I didn’t notice it and couldn’t find any examples online which showed me how to use it:                 I wasn’t sure how to update it but as It is a Multiline text field I figured I could just be update it like any other Sitecore field like so: The script is pretty simple, it gets the Job Item and then finds the field and updates it. Thankfully SiteCron has some constants that can be used to help here. Notice how I’m appending to the field to build up an historic log of … Continue reading Logging to the SiteCron Last Run Log

Enable and Disable Publishing Targets with SPE

It’s been a while since my last post as back February & March I was preparing for presenting at the Swiss Sitecore user group and I’ve been pretty busy since then, So I thought it’s time I shared some things that other might find useful from the past few months. The client I’m currently working with needs to Toggle On and Off publishing Targets quite often in their UAT environment during performance testing.  I posted a question a while ago on SPE about how I could do this but the answers about setting permissions for specific users were not really feasible for me. So I wrote an SPE script to delete and restore the Publishing Targets, however  our version of SPE (5.1) was too old for it to work (as I’m using the Restore-ArchiveItem function). We recently upgraded to SPE 6.2 and I was able to test it and it works great. The Function … Continue reading Enable and Disable Publishing Targets with SPE

Scripting Sitecore Packages with SPE

This week I needed to automate the creation of a package to include a number of items that we want to backup before syncing content down from other environments. I needed to conditionally only backup certain test pages and components based on name. I figured I’d be able to do this with Sitecore PowerShell Extensions and it turns out you can. Here is a script based on the one included in SPE (/sitecore/system/Modules/PowerShell/Script Library/SPE/Core/Platform/Development/PowerShell Extensions Maintenance/Prepare Console Distribution). The script creates a package with two sources: Test Pages – pages within a specific folder Test Components – matches components in sub-folders that have a specific name (sub-folders that start with ‘Test’) It then provides the package for you to download like so:             To use this script update the meta data section at the top and the paths to include your own pages and components. Check the –InstallMode … Continue reading Scripting Sitecore Packages with SPE

Creating Sitecore Items with a Specific ID with SPE

I recently needed to re-create an item that had been deleted by accident and was no longer available in the recycling bin or anywhere else. However this item needed to be created again with the same Id to avoid a lot of re-configuration. I figured I might be able to do this with SPE (Sitecore Powershell Extensions) and after some digging it turns out there is a –ForceId param supported by the ‘New Item‘ function that I hadn’t come across before. It can be used like so – note: the -ForceId parameter that you will need to update to the Item Id you wish to use: Once you’ve run this command you should see an item created with the Id you set as below:               I haven’t seen any other blog posts on this so hopefully it’s useful for anyone else who needs to do this in … Continue reading Creating Sitecore Items with a Specific ID with SPE

Building Components in Sitecore 10 with the ASP.NET Rendering SDK

Last Thursday I presented at the London Sitecore User Group Online. This was the first online UK Sitecore user group this  year, which was a response to the Covid-19 Pandemic. I Demo’ed how to Build ASP.Net Core Components in Sitecore 10 with the ASP.Net Rendering SDK.  The Demo uses a modified version of the Getting Started template to do this. An overview of the ASP.Net Rendering SDK is also provided and some useful Tips too. Video Of Presentation You can find a pre-recording of my presentation on my YouTube Channel here: Steps To Build a Component in Sitecore 10 Bellow I’m going to detail the steps involved with Building a component in Sitecore 10 using the ASP.Net Rendering SDK. These are covered in the video but I thought it would be useful to write them down too and provide some further information where applicable. Development Environment Setup The first step is to get … Continue reading Building Components in Sitecore 10 with the ASP.NET Rendering SDK

Sitecore Symposium 2020 Highlights

On Tuesday and Wednesday last week it was Sitecore Symposium 2020. This year it was all on-line so was a bit different and that was great in terms of catching up on all the content but not so great from a networking and social perspective. I normally write a fairly detailed over-view of what I learned in the sessions over the 2-3 days; partly to share what I learned with others but also so I don’t forget what I learned either by the time I get back to the UK. However this time round as most of the sessions are available on https://sym.sitecore.com/ you can watch a lot of it yourself if you missed it. I had an ‘All Access Pass’ so you will need to upgrade to view some of the content I saw. So instead I’m going to summarise the 6 key themes over the 2 days instead with some … Continue reading Sitecore Symposium 2020 Highlights

My Sitecore Symposium 2020 Agenda

It’s Sitecore Symposium this week and It’s going to be a bit different this year. I attend Symposium in the USA most years and I’d usually be boarding a plane about now, this year (if it wasn’t for COVID-19) I’d be heading to Chicago. Instead the entire conference is Digital. This means unfortunately I won’t get to catch-up with others in the Sitecore Community in person or get to do a bit of travelling which is a shame. However there are some benefits though (other than it being a whole lot cheaper) which is that there a a lot of on-demand and breakout sessions which (if you purchase an all-access pass like I have) I believe you can access after the event. So unlike in the real-world you can catch up on sessions you’ve missed, in-light of this I’ve sometimes selected more than one clashing session. An additional benefit I guess you’ll … Continue reading My Sitecore Symposium 2020 Agenda

Bulk Adding Captchas to WFFM Forms with Sitecore Powershell Extensions

Last week we had some Robots submitting a lot of WFFM forms across the website, creating thousands of submissions. I knew the quickest way to solve this was to add the out of the box CAPTCHA to the forms. However we had to put a solution in place quickly but with over 350 form instances across the website this needed a automated solution. I immediately thought SPE might come to the rescue here (as it often does), so  had a look on Google/SSE etc but couldn’t see anyone else who’d done this. So I fired up SPE and the following script is what I ended up with: Add a CAPTCHA to all WFFM Forms with SPE The script recursively loops through all the forms in the root folder set in script and checks if a CAPTCHA exists on the form already. If it doesn’t find one, it creates one as the last field in the … Continue reading Bulk Adding Captchas to WFFM Forms with Sitecore Powershell Extensions

Automate Adding Experience Editor Buttons to Renderings with SPE

I had an situation last week where I needed to add a experience editor button to all components and we have 63 of them. So Instead of doing this manually I decided to see if I can do this easily with SPE. The other thing I had to consider is that most renderings had some custom experience editor buttons already, so I needed to make sure these were maintained. Also I only wanted to add the button if there was a datasource set as it is only relevent to components with buttons. It turns out this wasn’t that tricky and this same script could be used to populate any multi-list field, such as auto-setting the compatible renderings: Show Me The Script Already Hopefully someone else will find this useful too.

Creating Microsites In Sitecore without SXA

I’ve not used SXA in anger but have heard good things about it. Unfortunately due to licencing and timeframes it was not an option for me on a recent project where I was required to recommend and deliver an mechanism for quickly creating Microsites in Sitecore. TLDR: If SXA is not an option then Dynamic Sites Manager might be a good alternative for you. This meant I had 3 options: 1) Manual Configuration in the Sitecore Config 2) Use a Sitecore Microsite Module (such as the Multiple Sites Manager) 3) Write something custom to support adding Microsites dynamically Manual Config wasn’t really an option as I knew that we had a number of Microsites to add and having a more flexible approach with less work and maintenance involved was important. I also didn’t want to write something custom as I knew this would be a time-sink involving solving problems other people have already … Continue reading Creating Microsites In Sitecore without SXA