Sitecore Symposium Day 2 #SitecoreSYM #ParagonDev

I am writing this late at night. It has been a busy day. Some pictures below. Having an awesome day and learning and meeting so many in the Sitecore world.

A little early morning run to start the day.

#VegasStrong

My new developer running buddy from GeekHive.

Mark Frost CEO opening up the Sitecore Symposium.

A development track might be better than a running track.

Bloody Mary in the morning? Tomato juice and coffee go well together.

The Sitecore guru himself Kamruz.

Keep on learning.

I love dessert.

Sitecore Mints!!! My breath smelled like mints and great websites.

Keep on learning…

Paragon and our little microbrews.

Closeup because why not?

Dinner time. Italian family style.

Goodnight!

Sitecore Symposium Day 1 #SitecoreSYM #ParagonDev

First day of the Sitecore Symposium I am in awe. It was great to meet people I talk to virtually, catch up with current coworkers, old coworkers and meet new people. So here is Day 1 in pictures.

Is my head really that big? Seen at the baggage area of the airport.

Paragon developers meet Marilyn Monroe. Maybe she needs a Sitecore site?

If you close your eyes and go back to the 50s these guys were good. It was the 50s right?

I can’t take Darth Vader in a Jedi fight, but pretty sure I can beat him in a race.

This drink was called cloud 9. No alcohol, but it was good. Loved licking the sugar from the side.

Sitecore development would be super hard without Hedgehog software. I am taking one of the babies home with me.

Room with a view.

No white tiger sightings yet.

Good night. Going running in the morning and then learning lots of things during the day.

So That is What the Custom Data Property is for. #Sitecore #Hedgehog #TDS and Glass Mapper Model Generation.

Glass and TDS makes our development life easier so we should try and use every feature we can. Right? One of my favorite features is generating a list of Glass models instead of GUIDS. A lot of you probably know this, but there is always times where someone does not. I wanted to document this so this can help others.

Select the field that is a Treelist or whatever multi list field.

In the properties under Code Generation you need to specify the type of list you want returned with model.

In my case:

type=IEnumerable<Feature.SectionLink.Models.sitecore.templates.Feature.SectionLink.SectionLink>.

Now Glass will auto generate and you will get the actual Glass Item Model instead a list of GUIDS.

[SitecoreType(TemplateId=ISectionLinksConstants.TemplateIdString)]

public partial class
SectionLinks  : GlassBase, ISectionLinks

       {

///
<summary>

 /// The Section List field.

            ///
<para></para>

                           ///
<para>Field Type: Treelist</para>          

                           ///
<para>Field ID: e09af999-37fa-42a3-98b7-1ffb802413c2</para>

                           ///
<para>Custom Data: type=IEnumerable<Feature.SectionLink.Models.sitecore.templates.Feature.SectionLink.SectionLink></para>

                           ///
</summary>

                           [global::System.CodeDom.Compiler.GeneratedCodeAttribute(“Team Development for Sitecore – GlassItem.tt”, “1.0”)]

                           [SitecoreField(ISectionLinksConstants.Section_ListsFieldName)]

                           public
virtual
IEnumerable<Feature.SectionLink.Models.sitecore.templates.Feature.SectionLink.SectionLink> Section_Lists  {get; set;}

       }

In my controller I just call it this way and I have my list to run through the ForEach:

viewModel = sitecoreservice.Cast<ISectionLinks>(Sitecore.Context.Item,inferType:true).Section_Lists.ToList();

So that is it. Let me know if there is something else we can do with this property. I would like to know.

Top Must Have Tools for Your #Sitecore Development Environment

There are so many tools I have used over the years in my Sitecore projects. I wanted to come up with a list of the ones I use the most. I will be using the list as a reference as well when I start a new project each time and hope that others can find it useful. I kept the descriptions short, but if you click on the links I provided you can find more information on what each tool does. So here they are in no particular order.

  1. SIM Installer (Sitecore Instance Manager)

    The SIM installer is great for installing/uninstalling different versions of Sitecore sites. It also does many other things that you help you maintain and update your Sitecore instances. I would not install an instance of Sitecore without using it.

    You can download it here.

  2. Sitecore Developer Toolbox

    You ever wonder what happened to the XPath Builder? Wouldn’t it be cool to be able to get to the admin tools from the content editor? The Sitecore Developer Toolbox brings all the major developer tools together. Time is money and having these shortcuts at the ready will save you lots of time.

    You can find it in the Sitecore market place here.

    For more information about it check out this link.

  3. Google Chrome Extension

    This Chrome extension is fantastic for getting to the Sitecore admin pages much faster from the Chrome browser.

    You can find the tools here.

  4. Sitecore Rocks

    Sitecore Rocks works integrates with Visual Studio to give you an all in one interface to Sitecore. With Sitecore rocks you have a Sitecore explorer window that you can use to view your Sitecore sites. You can do just about all the same functionality with Sitecore Rocks that you can do in Sitecore without leaving Visual Studio. Some of the functionality like creating/updating templates, creating/updated renderings and retrieving data using a query analyzer. One of my favorite features of Sitecore Rocks is the multiple select and delete.

    You can find it here.

  5. Luke

    Luke is the perfect tool for troubleshooting query and data issues with Lucene. I have used the tool many times when I find data abnormalities.

    You can download it here.

  6. Helix Generator

    Since Helix has started becoming a standard with new Sitecore projects having a way to have a Helix skeleton to get you started is nice to have. You can find many Helix generators out there. Here is the one that I usually use. The thing I like I bought it is you can choose what you want installed.

    You can find it here.

  7. DotPeek or Reflector

    These are great utilities for opening code from any DLL need to understand the code better. Whenever I have a task that a pipeline needs to be overridden or I need to understand why something is being set I use one of these utilities.

    DotPeek can be downloaded from here.

    Reflector can be downloaded from here.

  8. TDS or Unicorn

    TDS and Unicorn are critical in a development environment if you want to keep your Sitecore database in sync with your team. Both work well with source control so you can keep your Sitecore changes safe.

    You can find TDS here.

    You can find Unicorn here.

  9. Data Exchange Framework

    For importing and exporting data, updating xDB and anything else you can think of ways of manipulating Sitecore data the DEF is Sitecore’s best tool to do so.

    You can find it here.

  10. Sitecore Slack Chat and Sitecore Stack Exchange

    Stuck on something? More than likely someone else has been stuck on the same issue. Nothing wrong with reaching out for help. Some of the nicest Sitecore developers can be found on Slack and Stack Exchange.

    You can find the Slack group here.

    The Sitecore Stack Exchange can be found here.

  11. Debug Attach Manager

    I have found this the easiest way to attach to a process and debug. It remembers the process you last attached to so you can easily attach to it again.

    You can find it here.

  12. ZeroDeploy by Hedgehog Software.

    No developer likes to wait to debug their website. Sometimes you forget what you changed while testing if the site takes too long to reload. With ZeroDeploy it makes the wait time 99% faster.

    You can find it here.

  13. Razl by Hedgehog Software

    With this tool you can compare and merge your Sitecore databases. This tool is great for troubleshooting missing data, getting production data into development for testing, resetting production from a backup etc.…

    You can find it here.

    So those are my favorite tools to use in my Sitecore development environment. Is there some more that I should be using? Let me know.

Serializing a #Sitecore Computed Index Field (When You Need to Pass an Immense Amount of Data)

Recently I worked on a Data Exchange Framework process that involved extracting several records. Each record would eventually be inserted into an external table as they were basically rows. The DEF process was slow creating the records so I created a computed index field to handle creating the records and the DEF process would just need to read and insert the records accordingly. Problem was most computed index fields usually return a small value. In this case it could be several rows of data. The solution was simple though. Serialize a list of objects then deserialize it and let the DEF processor take it from there.

In my example the computed index field is created using an Image field class which contains a list of ImageInfo objects. You can fill in and create the index however you want. See below.

public class
 Image
 {
  [IndexField("imageinformation")]
  publicList<ImageInfo> ImageInformation { get; set; }
  [IndexField("images")]
  public string Imagelist { get; set; }
  [IndexField("_templatename")]
   public string TemplateName { get; set; }
 }

public class ImageInfo
 {
  public string EntityId { get; set; }
  public string caption1 { get; set; }
  public string caption2 { get; set; }
  public string freeformcaptions { get; set; }
  public string url { get; set; }
  }

As stated above, Image contains a list of ImageInfo objects. I used Newtonsoft to Serialize it.

return JsonConvert.SerializeObject(image.ImageInformation); 

This is an example of what the serialized data looks like:

“[{\”EntityId\”:\”4aa575d5-af18-466f-8e56-a06494ca6d16\”,\”caption1\”:\”NoCaption\”,\”caption2\”:null,\”freeformcaptions\”:null,\”url\”:\”https://acme.com/-/media/Images/Acme/Products/location/area51/subspecies/images/Streetscape3.ashx\”},{\”EntityId\”:\”4aa575d5-af18-466f-8e56-a06494ca6d16\”,\”caption1\”:\”NoCaption\”,\”caption2\”:null,\”freeformcaptions\”:null,\”url\”:\”https://acme.com/-/media/Images/Acme/Products/location/area51/subspecies/images/Streetscape.ashx\”},{\”EntityId\”:\”4aa575d5-af18-466f-8e56-a06494ca6d16\”,\”caption1\”:\”NoCaption\”,\”caption2\”:null,\”freeformcaptions\”:null,\”url\”:\”https://acme.com/-/media/Images/Acme/Products/location/area51/subspecies/images/Streetscape1.ashx\”},{\”EntityId\”:\”4aa575d5-af18-466f-8e56-a06494ca6d16\”,\”caption1\”:\”NoCaption\”,\”caption2\”:null,\”freeformcaptions\”:null,\”url\”:\”https://acme.com/-/media/Images/Acme/Products/location/area51/subspecies/images/Exterior.ashx\”},{\”EntityId\”:\”4aa575d5-af18-466f-8e56-a06494ca6d16\”,\”caption1\”:\”NoCaption\”,\”caption2\”:null,\”freeformcaptions\”:null,\”url\”:\”https://acme.com/-/media/Images/Acme/Products/location/area51/subspecies/images/Streetscape3.ashx\”},{\”EntityId\”:\”4aa575d5-af18-466f-8e56-a06494ca6d16\”,\”caption1\”:\”NoCaption\”,\”caption2\”:null,\”freeformcaptions\”:null,\”url\”:\”https://acme.com/-/media/Images/Acme/Products/location/area51/subspecies/images/Streetscape4.ashx\”},{\”EntityId\”:\”4aa575d5-af18-466f-8e56-a06494ca6d16\”,\”caption1\”:\”NoCaption\”,\”caption2\”:null,\”freeformcaptions\”:null,\”url\”:\”https://acme.com/-/media/Images/Acme/Products/location/area51/subspecies/images/Streetscape5.ashx\”}]”

This is the computed index in the index configuration.

<fields hint="raw:AddComputedIndexField">
<!-- Custom Computed Fields -->
<!-- Default SC Fields -->
<field fieldName="images">Acme.Feature.Website.ComputedFields.CustomReporting.ImagesComputedField, Acme.Your.Website</field>
 </fields> 

In the process method of the DEF you can then deserialize the field and do your processing.

var imageinfo = JsonConvert.DeserializeObject<List<ImagesComputedField.ImageInfo>>(image.Imagelist);
foreach (var imagedet in imageinfo)
{
 UpdateDataTable(new Guid(imagedet.EntityId), imagedet.caption1, 
 imagedet.caption2,imagedet.freeformcaptions, imagedet.url); 
}

So that is it. Not too bad and will solve a lot of issues where you need to move a lot of data. The DEF process went from 15 plus minutes to less than a minute once this index was created.

#Sitecore Data Exchange Framework Scheduling Tasks Options

One of the little known things that comes with the DXF is new commands that can be used to schedule DXF pipeline batches.

The new command options under System/Tasks/Commands/Data Exchange are the following:

  • Run All Pipeline Batches Command (Used to run multiple batches.)
  • Run Selected Pipeline Batches Command (Used to run one batch process.)

Run All Pipeline Batches Command

This command is used for running multiple batch processes. You will notice in the Pipeline Batches Root I just selected the Pipeline Batches parent folder. This should run all the batch processes underneath it.

Run Selected Pipeline Batches Command

With this command you can select one Batch Process to run.

Scheduling

Once you have your commands setup scheduling is easy. Just create a scheduling task and select the command and fill in the required fields like you would do for other commands.

That’s it. Easy to schedule.

#Sitecore June Meetup Chicago Impressions

This was my second Sitecore Chicago Meetup I attended this year. You can find the June meetup here. I learned a lot of information on this meetup and it was always good to see fellow Sitecore developers and talk about the industry. This is my high-level overview in a few words and pictures. If you have not been to one I highly recommend it. Should be another one in about 2-3 months from now.

The presentation was put on by Verndale and the speakers were Javier Castillo and Kirsten Leshko. To sum what the presentation was about I copied this from the meetup:

Sitecore’s customer intelligence and context marketing capabilities. Join us as we extend our presentation to focus on key considerations for marketers throughout the upgrade process to help set up your implementation for both short and long-term success.”

You can find the white paper of what they talked about here.

I always joke that I come to these for the Lou Malnati’s pizza and the drinks. That may be half true.

062317_1021_SitecoreJun1.jpg

Javier Castillo and Kirsten Leshko putting on their presentation.

Whoa Analytics.

Time to head back to the train. Need to take a pic first.

I got the best seat on the train. Upstairs double seat.

#Sitecore’s Data Exchange Framework Reddit Style Part 5 the Finale

In part 1 you saw what Sitecore items were created to for the data exchange process. In part 2 you saw how the backend was connected and the classes defined in the Converters section. In part 3 you saw how the item models are used. In part 4 you saw how the pipeline step processor is the method that brings everything together. In this part I want to talk about how the Pipeline Batch process is called that runs each step. This is the one of the coolest parts as you will be able to see the final result. You can find the source code here for reference. Still waiting for my module to get approved, but hopefully that will be soon.

Below you will find a Pipeline Batch that was created to run all the necessary steps to process and import the data into Sitecore.

When you first click on the Pipeline Batch you will notice a group of buttons on the ribbon. If something is not correctly setup these buttons will be disabled. To run the Pipeline Batch just click on the Run Pipeline Batch button.

While it is running the button will grey out and you will see the Stop Pipeline Batch button enabled. After it is finished running the Run Pipeline Batch will be enabled again.

Below are the steps that get run under Pipelines. You can also see above that the Reddit Pipeline is selected.

As you saw before the Reddit Pipeline Step hooks into the Converter and Processor. That will then call the next step below it (Iterate feed from Reddit Feeds and Run Pipeline).

The Iterate feed from Reddit Feeds and Run Pipeline as you see below will call a Pipeline (Reddit Feed to Sitecore Item Sync Pipeline) and store the data that the processor outputted into the Pipeline Context Source.

On the Resolve Sitecore Item Pipeline Step I defaulted all the fields except for the following. You will see the Template for New Item is the Reddit Feed Data item. The Item Name Value Accessor uses one of the fields from the Value Accessor Set to name the item. Endpoint From I just selected the Sitecore one. For the Identifier section you will see that the Identifier Value Accessor is a unique value that you can select from the Value Accessor Set. Then the Identifier Object Location is simply the Pipeline Context Source.

For the Apply Mapping from Reddit feed to Sitecore Item the fields are defaulted except for the Mapping Set. This is set to the Reddit Feed to Sitecore Item. You can see what it looks like below. This will map the data to the Sitecore fields.

For the Update Sitecore Item Pipeline Step I just chose the Sitecore Database Endpoint. This is the final step that updates the new item.

After everything runs you get the final result below:

So that is the Sitecore’s Data Exchange Framework in a nutshell. I have some more stuff I will be showing in different blogs, but this concludes the Reddit feed import example. I hope you have found this useful and I will be updating these blogs and cleaning them up as time permits. Please let me know if you have any questions.

#Sitecore’s Data Exchange Framework Reddit Style Part 4

In part 1 you saw what Sitecore items were created to for the data exchange process. In part 2 you saw how the backend was connected and the classes defined in the Converters section. In part 3 you saw how the item models are used. In this part I wanted to talk about the pipeline step processor. The method that brings it all together. You can find the source code here for reference.

This is a snapshot of each folder that was created and the corresponding class file. You can see there is a Processors\PipelineSteps folder that contains the process class.

RedditItemsProcessor.cs

In Sitecore under Pipelines\Reddit Pipeline\Reddit Pipeline Step you will see under Processor Type the RedditItemsProcessor defined.

Below is the code for the processor. You will see that the Required EndpointPlugin is defined for RedditSettings. Endpoint, PipelineStep and PipelineContext should all have values at this point. As you will notice the pipelineContext.PipelineBatchContext.Logger.Info is used to set up any custom logging. This will be outputted in the batch window when the processor runs. See example below.

If you look at the method RedditFeed. What that does is create a new Reddit class using RedditSharp. It then uses the blogpath setting from the endpoint to retrieve the blog feed. The redditfeedresults gets set to a collection of Reddit blogs. From there that collection is passed to the DXF which will use everything we setup to map and process each of the records. It will use fieldnames we defined earlier to match the Reddit feed fields to the fields defined for the new Reddit Sitecore item.

Outputted to the batch window:

Hopefully now you are getting the big picture on how all this stuff pieces together. In part 5 I will get into the part of running the DXF process and different options you can do. Let me know if you have any questions.

#Sitecore’s Data Exchange Framework Reddit Style Part 3

In part 1 you saw what Sitecore items were created to for the data exchange process. In part 2 you saw how the backend was connected and the classes defined in the Converters section. In this part I wanted to talk briefly about the item models that are defined for data exchange framework. You can find the source code here for reference.

This is a snapshot of each folder that was created and the corresponding class file. You can see there is a Models folder.

RedditFeedFieldValueValueAccessorItemModel.cs

As mentioned in the previous blog a ItemModel is used to defined the field name for the Value Accessor fields. Using this method is a good practice if you need to rename the field and makes the accessor code cleaner.

The name corresponds to the filed name of the template used for Value Accessor fields.

RedditReadStepItemModel.cs

As shown in the last blog in the RedditEndPointConverter class the RedditReadStepItemModel is used to correspond to the field name that holds the selection to the required EndPoint. As the previous item model mentioned this a good practice if you need to rename the field and makes the code cleaner.

Sitecore ItemModel class

The ItemModel Sitecore method that this item models inherit from is below.

So this blog was brief, but hopefully it gives a little glimpse of the value of having the item models defined. In part 4 I will get into the pipeline step processor. The most important piece that brings the functionality together. Let me know if you have any questions.