Just Sitecore Things

Sitecore tips and tricks and community news !

Post Top Ad

Post Top Ad

Wednesday, November 29, 2017

10:55 AM

Event Queue - Hidden Dangerous

Last time I was involved into project because of some strange issue. Guys had environments divided on CM and CD, there were a few of them, and on each was problem with propagating content.



Let's start with details, well, imagine situation when you change something using content editor on  CM server. Then publish that changes and go to CD server. Now you notice that there are no changes here. Strange, right? 
Ok, then imagine situation when things mentioned before happened, but sometimes,nobody knows why, it's working. Yeap, in some situation your changes, like new field values or new items, appear on CD. 
Nice? 
Than imagine situation when things mentioned before happened and additionally you have an access from CD to Sitecore dashboard. We assume some intern didn't know to cut off access from there. To clarify both CD and CM use the same set of databases. To check master database we are making some changes in Content Editor and save it, than without publish we go to CD, go to Sitecore dashboard and open Content Editor. What we see ? There is no our changes. What more? sometimes it works, like on Web database.

To summarize:
- we have separation on CM and CD
- both use the same DBs set
- sometimes we see changes on each DB

Strange ? Strange is an euphemism.



What we think firstly? Come on guys, there should be some other DB or some corrupted connection strings. Some other ideas, maybe some Load Balancer switch sometimes to other app version? Or maybe there is an issue with EventQueue, it's overloaded and doesn't refresh remote server so often as it should. Other ideas? 

After passing above points we also figure out a few more and our list after some time looked like:

  • checked DBs connections
  • checked LoadBalancer settings
  • checked overflow of EventQueue and PublishQueue
  • checked sites html definitions
  • checked AWS RDS with Sitecore vanilla
  • checked dynamic cache on IIS
  • checked cache server possibility before application servers

After went through whole list, everybody can feel disappointed. So, the best assumption was check data propagation one more time, hence we came back to EventQueue. As before, it wasn't blocked, overflowed or something, so looked nice. I got instance name from InstanceName column and check with machines and what discovered, both had the same name !

What it means ?
It means there was sort of race between servers during reading EventQueue. Who read first EventQueue, then it has the newest value, second server in reading saw it has been read already by itself (the same instance name) and didn't invoke any event to refresh.

It was probably occurred by devops server creation, who just clone previous server :)

To ad hoc fix I've setup InstanceName settings in config. for each application instance on servers.

I hope it will help someone, because sometimes so small things can be imperceptible.



Mystery solved !





Saturday, October 28, 2017

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 !

Monday, October 16, 2017

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 :)
 

Monday, October 9, 2017

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" :) !





Thursday, September 21, 2017

2:19 PM

SUGPL #1 - SXA Speaker feelings

15th of September 2017 we have first meetup of Sitecore User Group Poland (SUGPL). I had a big pleasure to be one of the speakers on this meeting. It was a great feeling to see all this guys from our Polish Sitecore environment.It has begun with a lot of smiles and happy stories which each of us had recently.



With this big positive emotions we started our presentations. I've been as first speaker on the battle front :) My presentation was called:

"Fast & Furioius: SXA in the game"


Because during preparation of the presentation I had a lot of questions like "Cool topic bro, but what SXA is in general?" I thought to make some kind of  SXA kickoff. We have pass through the issues which SXA solves, main features and we understood how the work approach with content has been changed by SXA.

Presentation was divided in two parts, first which has been focused on SXA improvements that are made and overview of particular features in SXA.


Second part was live demo, where I wanted to show how SXA lives, give some tips for the beginners and just let attendees touch SXA in Sitecore :)


After my presentation and short break, we have started with Robert Senktas presentation called: "Sitecore Azure Toolkit in Action". During presentation I've derived a lot of theory and practical knowledge about this toolkit. When Robert is explaining details of connection Sitecore and Azure, everybody see he experience I belive.

Last presentation was performed by Lukasz Skowroński who wanted to show whole community group how to prepare best SPEAK application. As a presenter he has introduced us to SPEAK topic with filling theoretical gaps and after that we moved further with live demo. Together we pass from the scratch to working SPEAK application in Sitecore, what has brought up the topic for all of us.


That was really enjoying evening where all of attendees have fun ! Share knowledge and integrate, the best options in the best company :) !






Friday, September 15, 2017

9:20 AM

Powershell: Remove languages version from items

I had a request to remove from project all items in some particular language version. Of course Sitecore enable option to make it manually, but it's per item. So if I would like to remove n-elements I had to click n-times whole process.

To avoid this, I thought that the best option to solve it will be Powershell :)




Moreover if you want to add some version language, it's also "no problem" for Powershell !


Thursday, August 31, 2017

9:16 AM

InfoMEET Conference

June 10th I had a pleasure to be the speaker on InfoMEET conference in Wroclaw. InfoMEET is a place where many people from IT world can share their experiences and get to know more with others specializations in wide IT world.



Because of very large scope of technologies on this conference, I've prepared topic:

"Sitecore – Example of Digital Marketing Platform"

SoftServe picture

My main goal was to encourage other IT guys like students or .Net developers into Sitecore. I have described client needs and solution which Sitecore gives them on to that.



I hope for every participant this was a valuable time :)