Sitecore tips and tricks and community news !

Post Top Ad

Post Top Ad

2:09 PM

SUGPL#3 Kraków

Time goes really fast, especially when you are really busy with things that you are interested in. Hence, it came 3rd SUGPL meeting, this time in Krakow.


We started our meeting with presentation our guests from Belarus, Daniil Raschupkin and Alexei Vershalovich from Brimi company. Topic of their presentation was "Sitecore 9 xConnect and Marketing Automation".


I must to notice here, that guys were really well prepared and everyone saw how much effort they spent to make this presentation. If you are reading that guys, good job !

After we have been fed new xconnect features and connecting to it, second presentation made our friend Tomasz Juranek. He has just come back from Las Vegas Sitecore Symposium and share with us news that Sitecore provide since Sitecore 9. Prresentation topic was: "Sitecore 9 – what’s new for Developers, DevOps and Content Authors". What more, he was our livesaver ;)



Third and the last presentation was provided by our guest from Germany - Sebastian Winter with topic "100% Availability – Scale your System landscape and processes waterproof". He was sharing knowledge that gathered during years of work on really big and distracted systems.



When everybody was full of news, we moved to the city center to networking purpose :) Unexpected place of our arrival was... vegan restaurant :) Afterwards I can say it was good place with good food, but of course, without meat :)





Cheers !


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 !





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





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






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 !


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

WFFM Action add contact to contacts list, extend conditions

All of us know WFFM very well and made there a lot of things. We would like today focus on particular action - "Add Contact To Contact List"

In general, this action is used to adding some contact data gathered from form and push this information as a contact to some list in List Manager. More details information is available in documentation here.

This action has very useful things - conditions:


It provides ability to create conditions based on fields you have in your form to add contact to the list. Developer see list of checkboxes what is userfriendly. 

List of checkboxes works as an 'OR' condition, so first true statement return true for whole list.

What in case when we want to have 'AND' condition and check if all selected checkboxes give true? Is it possible?

Sure, it is ! :)

I had already custom action which has been inherited from default action "Add Contact To Contact List". If you don't have this situation it's good to make it in this same way.

When we decompile this action we see:


Highlighted area on red show us part of code responsible for checking our conditions. To change it we have to take a look how it's working currently and how we can change it. Hence, during digging we see:





Selected area shows exactly, when some condition return true, the whole method return true as well. Right now, we have to think how to change it to AND condition ? I propose to create an array of results per each condition, then check if all of them return true. Since we will have that information we can decide if whole method should return true or false.





Later we have to only use our method implementation in our custom action. That's all ! It's working perfectly :)

Make conditions in that way and give content editors more possibilities :)

3:09 PM

Users migration

There is a lot of situations when we develop a new Sitecore project, but client wants to migrate old data, from previous project. We can assume that he has some really old Sitecore app as well.

One of the most important data for him are users.

What in that case?
- We have to migrate those guys.



Fortunately everybody know that Sitecore uses ASP.NET Membership structure to keep users. It's well known form, so it shouldn't be a hard work.

Here I would like to sell you some tip.

Users data contains information about users, but also about profiles which are used by Sitecore. The best option to migrate users is just use SQL scripts, but to move profile data, better is to use Powershell scripts.

I will describe SQL part, Powershell could be find on my friend blog, who cooperate with me in this task.

Below we have script which will help (I hope) during users migration. Firstly I've take care about membership, users and roles tables.



What we can notice here is word "COLLATE". Well I had this situation when old client DB had set different DB collation then new database has. Because of that I couldn't easily get that information and transfer to new table. I had to create walkaround, which became temporary tables. I transfer there data with new collation and later I could get those data and put directly where I wanted.

At the end of script I've also updated ApplicationId. I just didn't want to have mess in my tables. It's good to remember about that I think.

I hope that this information help you to smoothly migrate your users, without pain and sleepless nights :)

Take care !
10:00 AM

Dynamic insert options

Insert options, everybody know what does mean :) This is the place where we can make content editor life happier. We can prepare options in Content Editor context menu, to add new item based on some dedicated template.
It looks like image below.



Ok, so we have insert option, we have even put there some our custom template to create datasources. But what if we want to have only one instance of this item in this particular place ? Insert option allows to put as many we can, it doesn't say "Mate, only one is possible here". Is it possible to do that?

Well, yes it is :)

To make this dynamic option, we will use Rule Engine in Sitecore!

1. Rules for Insert Options.

To find rules we have to go to the path:

 /sitecore/system/Settings/Rules/Insert Options/Rules 

 In that place we can find something looks like:


To create new item, just click on Rules parent item and chose "Insert Option Rule". When we create this item, we can go to the field "Rule" and click it. This action will open a dialog when we can build our custom rule.


2. Rules Queries

Rules can as custom as we want. Only constraint can be your imagination. In our case it will be condition, if item (as an instance of our template) has been already added to this particular place, or not. To do that we can write query like:


Voilà, we have dynamic insert option in our application and new friends in content editor team :)
11:52 AM

SUGCON 2017 Memories

Few weeks ago, exactly 17th May, me and my "Sitecore" friends went to Amsterdam to SUGCON 2017. It was first time when I was attending to this event and I have to say it was really good time there. I've gather news from presentation, meet new friends and see in 'real life' old ones ;)

In this short post I would like to share with my SUGCON 2017 memories :)

First impression ?




Amsterdam of course, before Sugcon I was only on Schipol airport during transfer flights. But it was nice to visit other places :) Lots of bikes, beautiful canals and lovely architecture. After this everyone of us was in good mood to start with Sitecore part of the trip.

Conference

So many kind person which love Sitecore, the atmosphere of celebration was in the air. I've have a few talks with guys from other countries and share our experience and ideas according to particular Sitecore topics.


I have to highlight food.. nobody was hungry I assume :)

Presentations

The main part whole conference, presentation. It was so motivating to hear information about JS services in Sitecore or Publishing Services also great presentation. I hope that nobody will be angry on my but I admire Bas Lijten & Rob Habraken who has build own robot to show each conference that channels in Sitecore means everything. we can say sky is the limit. Amazing job Bas & Rob and of course say hello to Robbie :)

Afterparty

we had great opportunity get to know each other more on afterparty organized by Mirabeau
company. The made their office available for all conference attendees. It was a pleasure to be there :) Especially they serve even the food :) Really good job guys !


At the end I'm in 100% sure that was good decision to went to Amsterdam. Great place, great news and what the most important great people. We gonna meet on the next conferences I hope. Remember, if you are not sure, it means you should go!

See you there !