Just Sitecore Things

Sitecore tips and tricks and community news !

Post Top Ad

Post Top Ad

Monday, January 22, 2018

12:54 PM

WFFM Custom Error Message

Well known picture, isn't it ? :) Creating our custom message is really helpful in the future: during using our application by end-users or even for other developers who will maintain project.

What in case when we use WFFM, is it possible ? Of course it is, each WFFM action has possibility to display custom error message by dedicated field which looks like:

It works perfectly. We can use many custom actions with own error messages for each other. Generally it solves problem with custom error messages.

But what when someone has a lot of custom error messages or many combination of them? We assume that this person would like to avoid creating many action just to see correct error message. Is there any solution?

Well.. sure it is :) !

Firstly we have to create our custom Form Verification action. It's important to make Form Verification action, not the Save Action.

Secondly we create our custom class which inherits from WffmCheckAction and do the magic inside.
The most important part of this magic for us is to catch exception that can occur. We can for instance put there message we would like to see and re-throw it again. Even in bubble way from previous layers.

At the end this exception message will be displayed above our form.
You don't have to fill error message fields in the action. The code you have written is everything you need.

Cheers !

Monday, December 18, 2017

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 !

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. 
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 ?


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.


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.


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