diff --git a/docs/_authors/dgashi.md b/docs/_authors/dgashi.md new file mode 100644 index 0000000..e3baf07 --- /dev/null +++ b/docs/_authors/dgashi.md @@ -0,0 +1,10 @@ +--- +title: Dren Gashi +short_name: dgashi +name: Dren Gashi +function: Senior Software Engineer +--- + +{% avatar drendotnet size=200 %} + +Experience with Sitecore since 2017. diff --git a/docs/_posts/2024-01-09-exm-campaign-dispatch-queued.md b/docs/_posts/2024-01-09-exm-campaign-dispatch-queued.md new file mode 100644 index 0000000..48a58ef --- /dev/null +++ b/docs/_posts/2024-01-09-exm-campaign-dispatch-queued.md @@ -0,0 +1,97 @@ +--- +title: "EXM campaign dispatch stopped because of contacts missing the Alias identifier" +date: 2024-01-09 08:00:00 +0100 +categories: +- Sitecore +tags: +- Sitecore +author: dgashi +--- + +![Email Marketing](../files/2024/01/09/email-marketing.png "Email Marketing") + + +## Situation + + +It is how it mostly is - marketing team putted all their efforts together to send out a very important press release to over 8000 recipients at a particular time and date - and during the dispatch - this regular campaign type paused and was set to queued without any information or indicator about what went wrong to the marketing team. + +#### Campaign Manager + +![Campaign Manager](../files/2024/01/09/exm-dispatch-campaign-manager.png "Campaign Manager") + +We saw the status is Queuing, the columns *Sent to*, *Skipped*, *Unprocessed* and *Failed* showed all a 0 so we felt lucky and thought that this was just a hiccup maybe because of the huge amount of contacts and we reset the status, tried to send it out an another time - after some 2 or 3 minutes - same issue again. + + +#### Reporting mail + +Astonishment arose when the customer provided one of the received reporting mails: + +![Reporting Mail](../files/2024/01/09/exm-dispatch-abort-mail.png "Reporting Mail") + +O man, there are really contacts which already received these mailings, but the majority not. So, the numbers on the overview within the Campagne Manager are not true in this case. + +This all happened on a Sitecore XP 9.1.1 CM instance, what at the end of this post gets important again. + +## Troubleshooting + +``` + +10776 10:35:21 ERROR Exception: System.NullReferenceException +Message: Object reference not set to an instance of an object. +Source: Sitecore.EmailCampaign +at Sitecore.Modules.EmailCampaign.Core.Dispatch.DispatchQueueItemDataReader.GetValue(Int32 i) +at System.Data.SqlClient.SqlBulkCopy.GetValueFromSourceRow(Int32 destRowIndex, Boolean& isSqlType, Boolean& isDataFeed, Boolean& isNull) +at System.Data.SqlClient.SqlBulkCopy.ReadWriteColumnValueAsync(Int32 col) +at System.Data.SqlClient.SqlBulkCopy.CopyColumnsAsync(Int32 col, TaskCompletionSource`1 source) +at System.Data.SqlClient.SqlBulkCopy.CopyRowsAsync(Int32 rowsSoFar, Int32 totalRows, CancellationToken cts, TaskCompletionSource`1 source) +at System.Data.SqlClient.SqlBulkCopy.CopyBatchesAsyncContinued(BulkCopySimpleResultSet internalResults, String updateBulkCommandText, CancellationToken cts, TaskCompletionSource`1 source) +at System.Data.SqlClient.SqlBulkCopy.CopyBatchesAsync(BulkCopySimpleResultSet internalResults, String updateBulkCommandText, CancellationToken cts, TaskCompletionSource`1 source) +at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternalRestContinuedAsync(BulkCopySimpleResultSet internalResults, CancellationToken cts, TaskCompletionSource`1 source) +at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternalRestAsync(CancellationToken cts, TaskCompletionSource`1 source) +at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternalAsync(CancellationToken ctoken) +at System.Data.SqlClient.SqlBulkCopy.WriteRowSourceToServerAsync(Int32 columnCount, CancellationToken ctoken) +at System.Data.SqlClient.SqlBulkCopy.WriteToServer(IDataReader reader) +at Sitecore.Modules.EmailCampaign.Core.Data.SqlDbEcmDataProvider.AddToDispatchQueue(Guid messageId, MessageType messageType, IEnumerable`1 recipients, Dictionary`2 customPersonTokens, Dictionary`2 customQueryStringParameters) +at Sitecore.EmailCampaign.Cm.Dispatch.DispatchManager.Queue(Int32 threadIndex, IEntityBatchEnumerator`1 recipients, Int32 abTestRecipients, DispatchNewsletterArgs args, Int32 enqueueBatchSize) + +``` + +## What we found out + +First, we were not sure how this error message is related to the stop of the email campaign dispatch. + +NullReferenceException - what could be missing? + +We continued with our investigation and involved Sitecore Support which told us to check if we have contacts in the included lists which have a missing Alias identifier. + +So, we checked all included contact list about these contacts and we found what we were looking for: + +![Segmented contact list](../files/2024/01/09/exm-dispatch-contact-list.png "Segmented Contact List") + +There was an included segmented list where contacts are displayed in the List Manager without *Email*, *First Name* and *Last Name* was outputted as {{LastName}}
+*Therefore, if you see such contacts in your lists please do not ignore them.* + +With double-click on one of those, we entered the Experience Profile for this contact and with the contact ID we were able to check the identifiers directly in the XDB with utilizing the xdbsearch Role: + +![Empty contact identifiers](../files/2024/01/09/exm-dispatch-contact-data.png "Empty contact identifiers") + +Here you can see that these contacts have no identifiers and personal information at all, how that came we still need to investigate but these seem to be very old contacts with no interactions since more than a year. + +## Solution +Sitecore support have advised there is no supported way to programmatically add the Alias identifier and the best option is to manually delete and recreate these contacts. But we had no time now - the mail must go out now. + +So, we checked all available segmentation rules and conditions to filter against these corrupt contacts without Alias identifier. + +![Segmented contact list](../files/2024/01/09/exm-dispatch-contact-list-segmented.png "Segmented Contact List") + +After these contacts were filtered out from the contact lists the campaign dispatch ran through and the send-out finished successfully + +#### A ray of hope - Sitecore 10 +On Sitecore 10.3 this issue will not occur anymore, we found out that these contacts with no Alias identifier do not appear anymore on the segmented list. Maybe this was already a known issue and has been fixed with the upgrade.
+For older versions I suggest filtering these contacts out in your segmented lists + delete or recreate these contacts afterwards + + + +
+Image from Muhammad Ribkhan on Pixabay \ No newline at end of file diff --git a/docs/_posts/2024-01-15-sitecore-10-upgrade-problems-and-solutions.md b/docs/_posts/2024-01-15-sitecore-10-upgrade-problems-and-solutions.md new file mode 100644 index 0000000..2541fba --- /dev/null +++ b/docs/_posts/2024-01-15-sitecore-10-upgrade-problems-and-solutions.md @@ -0,0 +1,194 @@ +--- +title: "Sitecore 10 Upgrade Problems And Solutions" +date: 2024-01-08 12:00:00 +0100 +categories: +- Sitecore +tags: +- Sitecore +- Sitecore 10.3 +- SQL +- Sitecore Powershell Extensions +- Docker +author: tcanyalcin +--- +![alt text](../files/2024/01/15/sitecore-10.png "Sitecore 10") + + +After upgrading from Sitecore 9.1 to Sitecore 10.3 like many people, we faced bugs and some features stopped working for us. In this post, I will try to list some of them and explain how we fixed them. + +## Problem: Sitecore forms list fields stopped showing values of list items in local languages + +We use local languages and they have a fallback to the main languages. Such as; en-gb to en, de-de to de. + +We realized after the upgrade, that any field that is based on list fields started showing item names on these local languages instead of translated ones for them. So we opened a ticket to Sitecore Support and asked for a solution. Sitecore Support registered this behavior as a bug in their bug-tracking system and gave us a reference number 602361 for tracking. + +## Solution +As a workaround, they suggested either not using a fallback mechanism on form fields and creating versions on local languages or using ListDataSourceProvider from Sitecore 9. + +We went with the second option as we had many forms in many languages. So we patched Sitecore 9 ListDataSourceProvider over Sitecore 10: + +{% highlight csharp %} +public class ListDataSourceProvider : IListDataSourceProvider + { + private readonly IFormBuilderContext _formBuilderContext; + private readonly IListItemParser _listItemParser; + + public ListDataSourceProvider( + IFormBuilderContext formBuilderContext, + IListItemParser listItemParser) + { + Assert.ArgumentNotNull((object)formBuilderContext, nameof(formBuilderContext)); + Assert.ArgumentNotNull((object)listItemParser, nameof(listItemParser)); + this._formBuilderContext = formBuilderContext; + this._listItemParser = listItemParser; + } + + public virtual IEnumerable GetListItems( + string dataSource, + string displayFieldName, + string valueFieldName, + string defaultSelection) + { + List listItems = new List(); + IEnumerable dataItems = this.GetDataItems(dataSource); + string[] strArray; + if (defaultSelection == null) + strArray = (string[])null; + else + strArray = defaultSelection.Split('|'); + string[] source = strArray; + foreach (Item obj in dataItems) + { + ListFieldItem listFieldItem = this._listItemParser.Parse(obj, displayFieldName, valueFieldName); + if (!string.IsNullOrEmpty(listFieldItem.Value)) + { + listFieldItem.Selected = source != null && ((IEnumerable)source).Contains(listFieldItem.ItemId); + listItems.Add(listFieldItem); + } + } + return (IEnumerable)listItems; + } + + public virtual IEnumerable GetDataItems(string dataSource) + { + Item obj = !string.IsNullOrEmpty(dataSource) ? this._formBuilderContext.Database.GetItem(dataSource, this._formBuilderContext.Language) : (Item)null; + return (IEnumerable)((obj != null ? obj.Children.ToList() : (List)null) ?? new List()); + } + } +{% endhighlight %} + +{% highlight xml %} + + + + + + + + + + +{% endhighlight %} + +## Similar Problem: Form submissions not working in local languages +On our website, we use custom submit actions to make API requests. These API requests rely on data source items selected on Sitecore. After testing, we realized that some fields on these data source items have empty values sent to API even though they were filled on the main languages on Sitecore. So Sitecore could not fill these values that are supposed to come from fallback language. + +## Solution + +After opening another Sitecore support ticket, we realized that Enable item language fallback and Enable field language fallback checkboxes were not checked on site items. In the Sitecore 9 version, there was no checkbox and we were using the Other Properties field. That’s why the problem occurred. You can check the following documentation from Sitecore here +[link](https://doc.sitecore.com/xp/en/developers/sxa/103/sitecore-experience-accelerator/enable-language-fallback-for-sxa-sites.html) + + +For these 2 problems thank you for your support, Arun Tiwari... + +## Problem: Form field classes not rendered + +After the upgrade, all of our forms were not showing CSS classes. Since they are added to the project for custom implementations, they were not changed by upgrade automatically. + +## Solution + +In Sitecore 9, *Model.CssClass* for fields and *Model.LabelCssClass* for labels was used. These properties become obsolete in Sitecore, so we needed to use *Model.CssClassSettings.CssClass* and *Model.LabelCssClassSettings.CssClass* respectively. After these changes, forms were rendering CSS classes again. + +## Similar Problem: Forms Editor not showing Styling section on custom form fields + +In Sitecore 10, there was another change for each form field on the core database. Sitecore started using new CssClass and LabelCssClass items on Styling item: + +![alt text](../files/2024/01/15/sitecore-10-styling-item-image.png "Sitecore 10 styling item") + +## Solution + +Even though item names are the same, there are different items selected in Sitecore 10. You can put the following IDs on the ControlDefinitions field on Sitecore for each of these custom fields, then we will be able to see CSS classes on Sitecore Forms Editor: + +{% highlight yaml %} +{98FB361E-3A7F-49F9–8789–8C169FB95B61}|{121B9875–2F7D-4D62-BD0F-35A7B909ECE8} +{% endhighlight %} + + +## Problem: Missing field values after Glass Mapper upgrade + +After the upgrade, we realized there were many field values not showing on the website. All of these fields had one thing in common. Their properties did not have setters on class entities. But all of them were working fine before the upgrade. + +## Solution + +We searched on Glass Mapper release documentation and found this one: +[Glass Mapper](http://www.glass.lu/Mapper/Releases.html) on version 5.3.17 which mentions: + +>ISSUE 370 The lazy object inceptor will now ignore class properties that don't have a setter or have the SitecoreIgnore attribute. + +So, after upgrading the Glass Mapper, checking if every property mapped with the Glass Mapper has a setter is crucial. Especially, if you use them for API calls or search functionality. + +## Problem: Custom Powershell scripts on Toolbar not working + +In our project, we used Powershell scripts to bulk edit workflow state, copy item version, reset field value, and many more. We created these scripts and added them to the Toolbar so our customers can use them too. But after upgrading to Sitecore 10, we saw that all of them were not clickable, showing just script names and blank icons. + +## Solution + +After some investigation, we rebuilt all Powershell ISE scripts. This rebuild created some changes on items. But mainly on items that represent each script on the core database had a different type now: + +>Spe.Client.Controls.ContentEditorRibbonPanel,Spe + +*Before* they had the following value on the type field: + +>Cognifide.PowerShell.Client.Controls.ContentEditorRibbonPanel,Cognifide.PowerShell + +So after we start using the updated type, scripts become clickable and icons are showing again. + +## Problem: Fast Queries Not Supported + +Fast queries are deprecated in Sitecore 10. It's suggested to use a search index. In our case, we used a fast query to reach a setting item. + +## Solution + +We developed a custom SettingProvider and started using it instead of queries or search indexes. + +## Problem: System.OutOfMemory Exception + +After we switched to Sitecore 10 with Docker and imported the databases from the production system, several developers in the team experienced this exception. + +Either cm was unhealthy, or after some time it was becoming unhealthy. When we check logs on the docker or inspect the container, we would always see this error popping up. Also, the Sitecore system needed to be faster to work on. + +## Solution + +We first checked how much each container consumes when docker is started with the following command: + +>docker stats + +Thanks to this command, we could see that the SQL server is using way more than usual. We have seen values like 10–20 GB. We tried changing the mem-limit for each container to find the combination that works but that was barely enough. Sitecore was again too slow. We also tried deleting the whole data on the preview database, since it was not needed on our locals, but that was also not enough. + +Then we realized something golden. EventQueue and PublishQueue tables in the master, web db had over 405k entries on them. So we started a cleanup using the following SQL: + +{% highlight sql %} +USE [Sitecore.Core] +DELETE FROM dbo.EventQueue +DELETE FROM dbo.PublishQueue +USE [Sitecore.Master] +DELETE FROM dbo.EventQueue +DELETE FROM dbo.PublishQueue +USE [Sitecore.Web] +DELETE FROM dbo.EventQueue +DELETE FROM dbo.PublishQueue +{% endhighlight %} + +After this cleanup docker became fast, and we got rid of the exception. + +Thanks to Fabian Geiger and Ramazan Yilmaz for their support... \ No newline at end of file diff --git a/docs/files/2024/01/09/email-marketing.png b/docs/files/2024/01/09/email-marketing.png new file mode 100644 index 0000000..641886b Binary files /dev/null and b/docs/files/2024/01/09/email-marketing.png differ diff --git a/docs/files/2024/01/09/exm-dispatch-abort-mail.png b/docs/files/2024/01/09/exm-dispatch-abort-mail.png new file mode 100644 index 0000000..3d1f8ac Binary files /dev/null and b/docs/files/2024/01/09/exm-dispatch-abort-mail.png differ diff --git a/docs/files/2024/01/09/exm-dispatch-campaign-manager.png b/docs/files/2024/01/09/exm-dispatch-campaign-manager.png new file mode 100644 index 0000000..8c1304a Binary files /dev/null and b/docs/files/2024/01/09/exm-dispatch-campaign-manager.png differ diff --git a/docs/files/2024/01/09/exm-dispatch-contact-data.png b/docs/files/2024/01/09/exm-dispatch-contact-data.png new file mode 100644 index 0000000..511a10d Binary files /dev/null and b/docs/files/2024/01/09/exm-dispatch-contact-data.png differ diff --git a/docs/files/2024/01/09/exm-dispatch-contact-list-segmented.png b/docs/files/2024/01/09/exm-dispatch-contact-list-segmented.png new file mode 100644 index 0000000..a90d4b6 Binary files /dev/null and b/docs/files/2024/01/09/exm-dispatch-contact-list-segmented.png differ diff --git a/docs/files/2024/01/09/exm-dispatch-contact-list.png b/docs/files/2024/01/09/exm-dispatch-contact-list.png new file mode 100644 index 0000000..08a0041 Binary files /dev/null and b/docs/files/2024/01/09/exm-dispatch-contact-list.png differ diff --git a/docs/files/2024/01/15/sitecore-10-styling-item-image.png b/docs/files/2024/01/15/sitecore-10-styling-item-image.png new file mode 100644 index 0000000..3ffb7e3 Binary files /dev/null and b/docs/files/2024/01/15/sitecore-10-styling-item-image.png differ diff --git a/docs/files/2024/01/15/sitecore-10.png b/docs/files/2024/01/15/sitecore-10.png new file mode 100644 index 0000000..6c3ff01 Binary files /dev/null and b/docs/files/2024/01/15/sitecore-10.png differ diff --git a/docs/readme.md b/docs/readme.md index 6b0326f..bda4429 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -49,7 +49,7 @@ You can update the default `minima` theme: