Sitecore tips and tricks and community news !

Post Top Ad

Post Top Ad

4:34 PM

Sitecore 9 - New is coming, so don't trust yourself (Installation tip)


It was going so fast, only Sitecore Symposium has been finished, I was installing new Sitecore 9 on my local machine. 


I have mainly everything on my computer, I believed, because of previous projects in Sitecore, so installation will be faster. I've skip all backgrounds tool like .Net Framework or Solr and I've focused on SIF installation. 

I went through each installation step and run script, it's alive I thought ! Everything was ok until step 27 which showed mi something like this:



Wow ! Something with windows service ? I've started to figure out what could block my windows service. Windows event logger looked like:


So something with my windows, which couldn't open new xconnect service. I've read a lot, talked with DevOps to find out some windows solution and then I've noticed that new Sitecore 9 needs solr on SSL setup :) !

My routine was my biggest opponent at that moment. I moved back to previous step installations and released SSL ports, installed solr on SSL and whole Sitecore work perfectly. At this moment I would like to warn you - don't trust yourself :)

In connection to Solr on SSL I will not repeat my friends work and just link to their posts:

Lukasz Skowronski post

Kamsar post

Enjoy new Sitecore 9 !
12:45 PM

Item Created event, how to use properly ?



Story: 

During work with EXM I had very interesting story last time. I've installed EXM in correct way, according to guide standards. I was happy that any problems didn't happen and then I realized I have one :)

During EXM tests I've created One column Message, firstly new item was created (cool!). But after that I saw new item has one issue, message tab can't load.

 

Later I've figured out that it has empty Body field, although branch template has definition for that by default, so that what probably the issue of incomplete loading the message tab.


Since that point I've started looking for problem which cases breaking of creation an email in EXM. Because email message creation is based on branch, it's connected with branching I assumed. After a lot of searching I've noticed that when I comment out my "item:created" event declaration, EXM issue disappears. I've found it already ! I thought :)

I was digging more and what I saw was really interesting. mentioned "item:created" event has issue on method "DisplayNameSetup", because I had method like that.

Conclusions? Well, I can't setup the display name on item created because it will broke branching engines ! (important, not only EXM branches, but all of them) Yey ! But still, why ? :) Because that question was still in my head I've talked to Sitecore support and what is established is below.

Solution:

Firstly we have to establish one thing, maybe it's not obvious, but "item:created" event doesn't say that process of creation has been finished. Even more, there is at least 4 event handlers that occurs after our item created event. According to my issue with EXM, it consist also method which sets 'body' to item.

After each mentioned event handler there is also saving handler, which occurs when item will be changed during creation process. Hence, when we are changing item during creation, it blocks next event handlers to be called.

If you want to change items, it's better to use:
 item:versionAdded and item:versionAddedRemote events.
That events occurs after item has been created, so we have sure we don't interrupt process of creation and filling item fields.

Explanation:

Accessing an item from the ItemProvider in the CreateItem() method or in the 'item:created' event handler has no versions. The version is added later inside the Sitecore.Nexus assembly command.

When the version has been added, the Sitecore.Nexus command also copies field values from the branch template to the item and only after that the item gets saved. So mentioned action SaveItem() of the ItemProvider ensures that the item has at least 1 version and other case it will add one.

Our problem form the story starts when an item is edited inside the CreateItem() method of the ItemProvider or in the 'item:created' event.
Let's go through the path. After editing our item.Editing.EndEdit() method saves the item, but it doesn't have any version, hence version will be added in SaveItem().

Afterwards, when we go to the Sitecore.Nexus command some of the branch template field values will not be copied to the new item, because it already has a version (from SaveItem()).
In our story, result will be that 'body' field of the branch template will be not added to the item.

Hope it will help some of you :)
 
11:34 AM

SUGPL #2 - Poznań




Our next step on SUGPL way was party meeting in Poznań! First of all very very big thanks for Marek Musielak, Adam Najmanowicz and all Poznań guys for organization this event and warm welcome us :)

 There was a time to see old friend Radek Kozłowski, MVP and one of the speakers that event.


Cheers Radek!

Also we had Marek Musielak, Alan Płócieniak and Adam Najmanowicz on board




First speaker during this evening was Przemek Taront who had presentation about gems inside the SXA. It was well prepared and well put to agenda presentation according to SUGPL #1, where I had a pleasure to put an introduction to SXA.


Mentioned earlier Radek was second speaker. He prepared very interesting presentation about Data Exchange Framework. We could hear about possibilities and advantages of using this tool. Now, every external integration with Sitecore has to be considered in connection with Data Exchange Framework :)





Our last presentation should be "Sitecore Helix: the story of my implementations – Updated" by Tomek Juranek. Unfortunately in this day we had in Poland hurricane "Xawery" and Tomek stuck in the train. As I know in normal 4h train trip, he had additional 9h delay.. you can imagine him inside this train :)

At the end, some integration beer for everyone with loud "See you soon" :) !