The following ports needs to be available for containers
The following ports need to be available for running the Docker instance. Make sure you are using stopping the services so it’s available for Docker to consume.
Note: Always use iisreset /stop in the command line rather than stopping it in IIS.
To check the port availability, run the following in PowerShell. It shouldn’t return any process.
netstat -ano | findStr 127.0.0.1:443
netstat -ano | findStr 8079
netstat -ano | findStr 8984
netstat -ano | findStr 14330
Installation:
Extract the file zip file downloaded into Sitecore_10.2(or any folder name).
2. Execute this command to set the execution policy unrestricted.
3. Navigate to XP1 folder (Sitecore_10.2\SitecoreContainerDeployment.10.2.0.006766.683\compose\ltsc2019\xp1) in PowerShell and run compose-init.ps1 script.
.\compose-init.ps1 -LicenseXmlPath <License Path>
Note: I’m installing XP1, If you want XP0, navigate to XP0 folder and follow the same exact steps.
4. Run docker-compose pull
docker-compose pull
5. Run docker-compose up (It takes some time, you can get a coffee!)
docker-compose up –d
Once it’s done, let’s bring in CM instance –
https://xp1cm.localhost/sitecore
Login as adminusing ‘Password12345‘ password (not b though)
It’s so cool see the new desktop view! Cool work Sitecore!
It’s time for CD instance –
https://xp1cd.localhost/
Errors and Resolutions:
If you get unhealthyfor any nodes, don’t worry. It’s very common, I get this most times.
Incognito/private mode to see if Forms are showing up
Rebuilt Forms folder from Developer menu (faster way)
Rebuilt Sitecore Master Index
After doing above all, Forms weren’t still showing up 🙁 Decided to take a deeper dive.
I checked the JobsViewer(/sitecore/admin/jobs.aspx) to check what jobs are running and to my surprise, the re-indexing only Forms folder was running for more than 2 hours and they were so many jobs queued up (Content Authors may be busy creating more content for the website).
I was wondering what’s causing the indexing queue to be clogged. Checked the Crawling log using Sitecore Log Analyzer to see what’s happening and for every single update, it was triggering re-index synchronously and immediately checked the Indexing Strategy for sitecore_master_index and it was set to syncMaster!
This was the root cause of the problem because every time the Content Author was making a change it was triggering the re-index synchronously, whereas it should asynchronously re-indexed with an interval. I switched it to the intervalAsyncMasterstrategy to fix the issue.
Tip: Sitecore Log Analyzer is a powerful tool for parsing Sitecore log files. It provides the interface to explore and navigate through a large amount of log data.
Here is the patch I used to update the index strategy.
Now within few minutes, all queue jobs cleared and moved to finished jobs.
Checked Forms in Designer view, all forms were showing up! Tada!
I was working on a Sitecore 9.0.2 client project and the Sitecore Sidekick(1.4.4 version) was already installed. When I tried to initiate the Sidekick and it was throwing an error –
While researching the error, came to know that I need to update Rainbow and Unicorn (If you use Unicorn in your project to serialize items make sure you install the No Rainbow package as this will not overwrite Unicorn’s Rainbow DLL files but rather utilize whatever version Unicorn is using (Sidekick can work with any version). You can skip if your project doesn’t use it) packages as it wasn’t compatible with the versions that were installed.
I was wondering what version of these packages(SideKick, Rainbow, and Unicorn) will be compatible with Sitecore 9.0.2 and realized it doesn’t matter!
So decided to update the Sidekick(it automatically updates Rainbow) and Unicorn with the latest version via NuGet. Make sure to update all installed Sidekick packages to up-to-date. In my case, I updated the below ones –
SitecoreSidekickFoundation
SitecoreSidekickContentMigrator
SitecoreSidekickCore
SitecoreSidekickAuditLog
SitecoreSidekickEditingContext
It automatically updated all the dependencies like below
Now updating Unicorn(Skip if your project doesn’t use it for serialization)
All packages and it’s dependencies were successfully installed and deployed to QA and UAT environments(it needs to be deployed to the servers in order to make the contract) and the Sidekick started working.
Now we were able to pull content from any environment!
Installing via Sitecore Package
It is not recommended, If you like to install it in environments directly without check-in to source control, you can install it as a package. Download the latest package at the root of the repo.
We were seeing High memory utilization on the xConnect server and it coincides with when our monitoring service reports the site being down. Logs were particularly showing these two errors related to the xConnect –
Error #1:
System.OperationCanceledException: The operation was canceled.
at System.Threading.CancellationToken.ThrowOperationCanceledException()
at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.AuthenticationFilterResult.<ExecuteAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()
Error #2:
Sitecore.XConnect.Operations.SetFacetOperation`1[Sitecore.XConnect.Facet]: Sitecore.XConnect.Operations.FacetOperationException: Operation #0, AlreadyExists, Contact {32971b60-1245-0000-0000-0611bab4b38e}, Classification
[Error] ["XdbContextLoggingPlugin"] XdbContext Batch Execution Exception
Sitecore.XConnect.Operations.FacetOperationException: Operation #0, AlreadyExists, Contact {32971b60-1245-0000-0000-0611bab4b38e}, Classification
[Error] XConnect Exception Filter OnException(), url - "https://prod9-xconnect.everence.com/odata/Contacts?%24filter=Identifiers%2fany(id:id%2fIdentifier+eq+'a5642a9a87ad41e1ab65a624b7d1b1f6'+and+id%2fSource+eq+'xDB.Tracker')&%24expand=Identifiers,MergeInfo,ConsentInformation,Classification,EngagementMeasures,ContactBehaviorProfile,Personal,KeyBehaviorCache,ListSubscriptions,AutomationPlanEnrollmentCache,AutomationPlanExit,TestCombinations"
System.OperationCanceledException: The operation was canceled.
at System.Threading.CancellationToken.ThrowOperationCanceledException()
at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.AuthenticationFilterResult.<ExecuteAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()
Investigation:
Created a dump using the Procdumptool. Here is the command I used for creating 18GB of the dump file
procdump -m 18000 -ma [Name or PID]
From reviewing the memory dump, we could see two SQL queries that have consumed 8GB and 6GB of memory in your XConnect instance.
Both queries were running the [xdb_collection].[GetInteractionsByContactIds] stored procedure. This stored procedure retrieves interaction data for a contact.
The queries are attempting to retrieve the interactions for a specific Contact ID. After reviewing some of the retrieved interactions from this contact, we could see the User-Agent for this contact was
Mozilla/5.0 (Unknown; Linux x86_64) AppleWebKit/534.34 (KHTML, like Gecko) PingdomTMS/0.8.5 Safari/534.34
The above agent is Pingdom (It is a website monitoring and availability service) to have many interactions stored in XConnect. Although it’s a bot, it was considered a valid user and the interactions were being tracked.
Resolution:
In order to mitigate the interactions from Pingdom, we added the User-Agent of Pingdom to the <excludedUserAgents> configuration (Sitecore.Analytics.ExcludeRobots.config) so that future visits from Pingdom are treated as a bot and not saved to XConnect.
I came across a scenario, where I need to update the email field for all custom forms built with ‘EmailTemplate’. Since it’s going to be a bulk update, decided to do it in SPE(so powerful!)
Here is the script I wrote –
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sitecore 10 was out a couple of months back. I installed it using SIF, hit a couple of roadblocks while installing and sharing the resolutions that helped resolve the issues.
If you haven’t installed Sitecore 10, here are some blogs that help you install.
I have multiple Solr services running for different versions of Sitecore and here is the error I got while installing Sitecore 10.
“Port 8984 is already being used by another process. Please choose a different port”.
Run services.msc to check how many Solr’s are running on the machine.
Resolution:
If you have multiple instances of Solr running and you don’t know what port, it’s associated with. Here is a quick way to get the process name and kill if it’s is no longer needed.
Also when installing the Solr, you can add the Port Name and Sitecore Version number or any information in the Description of Details tab.
This is life saver, do not need to worry about which Solr maps which port in the future!
Error # 2: SQL User Issue
“msdeploy.exe : Error: .Net SqlClient Data Provider: Msg 12809, Level 16, State 1, Line 5 You must remove all users with password before setting the containment property to NONE. At C:\ProgramFiles\WindowsPowerShell\Modules\SitecoreInstallFramework\2.2.0\Public\Tasks\Invoke-CommandTask.ps1:31 char:13”
Resolution:
For some reason, the SC10 uninstall did not remove all the variables for failed instances. I removed the ‘sc10_CollectionUser’ in local DB users, fixed the issue.
Error # 3: Credential Issue
“Install-SitecoreConfiguration: A parameter cannot be found that matches parameter name ‘Credential’. This error might have been caused by applying the default parameter binding. You can disable the default parameter binding in
$PSDefaultParameterValues by setting $PSDefaultParameterValues[“Disabled”] to be $true, and then trying again. The following default parameters were successfully bound for this cmdlet when the error occurred: -Debug -WarningAction
-Verbose -InformationAction -ErrorAction
At C:\ResourceFiles\XP0-SingleDeveloper.ps1:77 char:1
After you install the tools, restart your machine.
SameSite cookies and custom domains:
The commonly-used browsers such as Chrome and Safari are changing how the browsers interpret the SameSite cookie. After the change takes effect, Horizon will only work if the Sitecore Horizon host instance, the Sitecore identity instance, and the Sitecore CM instance belong to the same site.
Download Horizon 10 from here. I downloaded the on-premises deployment.
Extract the zip file and open InstallHorizon.ps1
Fill out the below parameters –
Run the InstallHorizon.ps1 in Adminstrator mode.
Once the installation is done (only takes 2 to 3 minutes), you will see a new Icon in Sitecore XP.
Clicking the Icon opens Horizon (yes, it’s separate IIS site) in a new tab and you can explore the new features!
Post Installation
To use the alignment and indentation features in the rich text editor in Horizon, make sure to add the below styles to your default style sheet (like default.css in your project).
Ensure Sitecore Identity is installed. For example, if your Sitecore CMS instance has the address https://cmdomain.com, then install Sitecore identity with the address identity.cmdomain.com
Download Horizon 9.3 from here. I downloaded the on-premises deployment.
Extract the zip file and open Parameters.ps1
Fill out the below parameters –
Run install.ps1 in Powershell Administrator mode
Once the installation is done (only takes 2 to 3 minutes), you will see a new Icon in Sitecore
Clicking the Icon opens Horizon (yes, it’s separate IIS site) and you can explore the new features!
Troubleshooting Error
I faced this error after the installation was successful. When I opened Horizon, here is the error message I got.
Failed to render a page: Failed to render the root extension, with error: Failed to render a fragment. Status code: InternalServerError, message:
I checked the logs (C:\inetpub\wwwroot\[Hoirzon Website\logs) and it showed below message
[1] Ensure that Node.js is installed and can be found in one of the PATH directories.Make sure the Node executable is in one of those directories, or update your PATH.
I verified that the Node.js path (C:\Users\manbalagan\AppData\Roaming\nvm\v10.16.0\) was accessible and PATH was correct.
Also, I uninstalled Node v10.16.0 and reinstalled. Restarted my machine. Nothing helped.
Finally, I resolved the issue by adding ‘Everyone‘ permission and allowed full control to NVM folder (C:\Users\manbalagan\AppData\Roaming\nvm) fixed the issue! IIS couldn’t access the folder without ‘Everyone’ permission.
Uninstall
If you want to uninstall the failed versions (to clean up IIS sites it created), here is how you can do it –
Uninstalling is straight forward – just need to run the uninstall.ps1 script
After uninstalling, it didn’t remove the Horizon Icon in Desktop mode. Clicking on the icon goes to 404 page. It would be clean if the icon is also removed.
Hope this helps someone. Any issues, let me know in comments section.
Browser Extensions are handy and easy to use without leaving the tab. Here are the top 5 Sitecore Chrome Extensions I use daily and it saves ton to time!
This extension is a lifesaver and must have! Here is the set of handy tools into Content Editor. Favourites Bar, Desktop notifications, and Dark mode are my favorites.
This tool allows navigating to admin pages like cache, serialization, show config (I use this most of the time), etc. Also, you can switch between databases or set a new database on the options page.
Are you looking for a generic method to read the values from any type of Sitecore Form fields? Here is the solution.
private static Dictionary<Guid, string> FormFieldsToDictionary(IList<IViewModel> fields)
{
Dictionary<Guid, string> fielDictionary = new Dictionary<Guid, string>();
foreach (var field in fields)
{
fielDictionary.Add(Guid.Parse(field.ItemId), field.GetType().GetProperty("Value")?.GetValue(field, null)?.ToString() ?? string.Empty);
}
return fielDictionary;
}
private static string GetValue(IViewModel field)
{
if (field == null)
{ return default(string); }
if ((field as StringInputViewModel) != null)
{
return (string)(object)(field as StringInputViewModel).Value;
}
if (field is ListViewModel)
{
var listField = (ListViewModel)field;
var array = listField?.Value?.ToArray();
if (array == null)
{
return string.Empty;
}
return String.Join(",", array);
}
if (field is DateViewModel)
{
var dateField = (DateViewModel)field;
return dateField.Value.HasValue ? dateField.Value.Value.ToShortDateString() : string.Empty;
}
if (field is NumberViewModel)
{
var numberField = (NumberViewModel)field;
return numberField.Value.HasValue ? numberField.Value.ToString() : string.Empty;
}
if (field is TextViewModel)
{
var textField = (TextViewModel)field;
return (string)(object)textField.Text;
}
if (field is CheckBoxViewModel)
{
var checkbox = (CheckBoxListViewModel)field;
return (string)(object)checkbox.Value;
}
return default(string);
}
Utilization:
protected override bool Execute(UpdateContactData data, FormSubmitContext formSubmitContext)
{
var fieldsDictionary = FormFieldsToDictionary(formSubmitContext.Fields);
// From here you can create a model from fieldsDictionary, call any API and return call status
}
Hope this helps someone. Any questions, leave a comment.
You can now publish the forms within Forms Designer. No need to navigate to Content Editor to publish. This is pretty handy when developing forms.
Users can now delete submitted data for a particular form and specify a date range.
You can now use the Sitecore bot detection functionality to verify whether visitor is human. This removed the need for a Captcha element. Nice work Sitecore!
Now the forms element that allows you to add email confirmation to a form.
Users can now use the Redirect submit action to redirect to a URL and pass parameters to it.
To add file upload functionality to your forms, you can now use the File upload forms element. I use to utilize the Forms Extensions module(It’s very nice), it’s now included in forms element.
Apart from these, there are bunch of enhancements made –
Improved database performance by increasing our ability to prevent deadlocks.
You can now use the client-side API to retrieve form fields, for example when you build a custom submit action that needs to show all the form fields.
You no longer need to rebuild the master index after you install Sitecore XP.
Hope this helps. Any questions, leave a comment below.
I’m participating in Sitecore Hackathon 2020 for the second time. One of the requirement is to have sitecore 9.3 installed on your machine except for commerce . I want to share my experience how i quickly installed Sitecore 9.3 using SIA(Sitecore Install Assistant) in 20 minutes!
Note: No need install any prerequisites(includes Solr) manually, SIA will take care of it.
Preparation:
Download installation package (Graphical setup package XP Single) from here.
Installation:
Extract the file zip file downloaded and click on Setup.exe
Install the prerequisites if needed.
Install Solr 811 by filling Port, Windows service path prefix and Install path and Install.
Note:Make sure the port number is different from earlier versions of Solr installed.
Fill out site prefix, admin password(going with b, so easy to remember) and license file path.
Fill out SQL server instance name, admin username and password.
Fill out the Solr URL, System root and Windows service name
Note:Go to Solr URL to make sure it’s running successfully.
Select optional module SXAif you need. I’m going for it, time to explore SXA! Would be nice if Horizon is listed here.
Review the summary to make sure the settings are correct.
SIA validates to make sure the files look good.
Install. This takes around 10 minutes (you can get a coffee!). If it errors out, check out the log.
Yayy!! It’s installed. Is it easy to install with SIA? It’s indeed a great tool!
Check out the release notes for what’s new in Sitecore 9.3 here
2019 is going great so far, wanted to share my contributions to the Sitecore community(Awesome!).
Presented Sitecore 9 Forms(Intermediate/Advance) in 7 SUG’s-
• April 18 2019 – SUG Bulgaria • May 4 2019 – SUG Bangalore • June 4 2019 – SUG Manchestor, NH • June 6 2019 – SUG Belarus • June 12 2019 – SUG Boston • June 25 2019 – SUG NCR(Delhi -India) • Aug 29 2019 – SUG Educador
The blog posts I have written and one of my blog post received ‘You are life saver, Thank you’ comment.
• Install Sitecore 9.1 quickly in 5 easy steps • Sitecore 9 Forms: Redirecting to formbuilder on Submit? • Sitecore 9 Forms: The required anti-forgery cookie __requestVerificationToken is not present • Sitecore license file expired? • Sitecore 9.1 Forms: Conditional Logic • Sitecore 9 Forms: Custom Control – Conditional Section • Sitecore 9 Forms: Success message • Sitecore 9 Forms: Custom Submit Action • Tips and Tricks : GIT Cherry Pick • Sitecore Certification : Exam and Review • Sitecore 9 Forms: Save Data • Sitecore 9 Forms: Custom Regex Validation • Sitecore 9 Forms: Custom Grouped dropdown • Sitecore 9 Forms: Uncaught TypeError: Cannot read property ‘unobtrusive’ of undefined • XConnect: Certificate was not found • Sitecore 9 Forms: Access landing page fields in FormSubmitContext? • Sitecore 9 Forms: The date range is invalid. Please select a date range that is within the range of the list. • Sitecore Forms: Export Data to CSV shows Field Types on column header? • Sitecore Forms: Redirecting to External URL
Youtube • How to add Forms Custom Submit Actions – https://www.youtube.com/watch?v=wE_aaFN7GvY
I came across a scenario where I need to redirect to a external url(thank you page) after form submission. It’s achievable using formSubmitContext’s RedirectUrl property on your Custom Submit Action.
Here is the code snippet –
protected override bool Execute(string data, FormSubmitContext formSubmitContext)
{
//Prepare model
//WebApi Call
//Redirect to external URL
var thankYouPageUrl = $"{HttpContext.Current.Request.Url?.Scheme}://{HttpContext.Current.Request.Url?.Host}/[thank-you-page-path]/";
formSubmitContext.RedirectUrl = $"{thankYouPageUrl}?id={add-any-querystring-if-needed}";
formSubmitContext.RedirectOnSuccess = true;
return true;
}
I deployed the forms to Staging environment and see how the forms were performing.
I exported the data using Export form data into CSV button and i received ‘The date range is invalid. Please select a date range that is within the range of the list.‘ error.
I tried different range and it threw the same error. I checked the db([project]. ExperienceForms) and there was NO DATA!
I submitted the form and tried again. It downloaded the CSV file with an entry on it.
I came across a scenario where I needed to access landing page fields(the page where we add Forms) in Custom Submit Action’s FormSubmitContext.
By default, the page item isn’t known at the Submit Action. So started thinking should i create a custom hidden field or use the Forms Extensions module? At the end of the day, i didn’t need either.
Here is the quick way to access the current page using HttpContext’s AbsolutePath.
protected override bool Execute(string data, FormSubmitContext formSubmitContext)
{
var contextItem = GetContextItem.GetItem(HttpContext.Current.Request.UrlReferrer?.AbsolutePath) as ILandingPageContentItem;
// Access fields from ContextItem
}
public class GetContextItem
{
public static IStandardTemplateItem GetItem(string path)
{
Item item = Sitecore.Context.Database.GetItem($"/sitecore/content/<tenant>/Home{path}");
return item?.AsStronglyTyped();
}
}
Hope this helps someone. Any questions, please leave a comment.
Experience Analytics was not working in the Production Azure PaaS environment. I checked the logs and it was throwing Certificate was not found error.
Exception: System.InvalidOperationExceptionMessage: The certificate was not found.Source: Sitecore.Xdb.Common.Webat Sitecore.Xdb.Common.Web.CertificateWebRequestHandlerModifier.Process(HttpClientHandler handler)at Sitecore.Xdb.Common.Web.CommonWebApiClient`1.CreateRequestHandler()at Sitecore.Xdb.Common.Web.CommonWebApiClient`1.CreateClient()at System.Lazy`1.CreateValue()at System.Lazy`1.LazyInitValue()at Sitecore.Xdb.Common.Web.CommonWebApiClient`1.<ExecuteAsync>d__37.MoveNext()--- End of stack trace from previous location where exception was thrown ---at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)at Sitecore.Xdb.Common.Web.CommonWebApiClient`1.<ExecuteGetAsync>d__32.MoveNext()--- End of stack trace from previous location where exception was thrown ---at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)at Sitecore.XConnect.Client.WebApi.ConfigurationWebApiClient.<Refresh>d__4.MoveNext()
My first guess was certificate would have expired, but it was valid.
Second guess was thumbprint could be wrong, but thumbprint was perfectly matching with the config value(\App_Config\AppSettings.config file , in the validateCertificateThumbprint setting).
Started wondering why it can’t find the certificate for some reason? Came to know that need to add an application setting to the web app called WEBSITE_LOAD_CERTIFICATES and the value needs to be the certificate thumbprint.
This application setting is required for the app service to load the certificate into the local certificate store of the host running the app service.
Once the setting is added and I no longer see the error in logs and the Experience Analytics started showing some number/graphs. Yay!
Hope this helps. Any questions, please leave a comment.
Are you getting this error on Sitecore 9 Forms Submission? I got it and it took me some time to figure out. It’s all related to Validation. Here are the points to check to narrow down the issue —
If you have form fields set it to mandatory, change it to optional and see if that makes the submission successful. If so, one of the field validation is causing trouble.
It happens for custom form control quite often, where you need add the validation to razor view file and make sure you have this attribute – GenerateUnobtrusiveValidationAttributes.
Compare your custom control razor file to any one of inbuilt form controls ([iis-site-folder]\Views\FormBuilder\FieldTemplates ) like below and if you see any difference on attributes, add it out.
Finally a simple check: make sure to publish all the forms and view the landing page in live mode(not in preview mode)
I came across a requirement from a client that they wanted to show Country and it’s states grouped in a dropownlist. I created a custom grouped dropdown to fit into the scenario. Since this is an extension of dropdownlist, no speak knowledge required.
Let’s get started
Step 1: Create custom dropdown list
Create a custom dropdownlist under /sitecore/system/Settings/Forms/Field Types/Lists based on Field Type(/sitecore/templates/System/Forms/Field Type) template like below
Step 2: Create a code behind class and razor view
create a code behind class like this in VS project
using System.Collections.Generic;
using Sitecore.Data.Items;
using Sitecore.Diagnostics;
using Sitecore.ExperienceForms.Mvc.Models.Fields;
namespace Sitecore.Project.Example.Views.StateDropdown
{
public class StateDropdown : DropDownListViewModel
{
protected override void InitItemProperties(Item item)
{
Assert.ArgumentNotNull(item, nameof(item));
base.InitItemProperties(item);
}
protected override void UpdateItemFields(Item item)
{
Assert.ArgumentNotNull(item, nameof(item));
base.UpdateItemFields(item);
}
public Dictionary<string, Dictionary<string, string>> Regions()
{
if(string.IsNullOrEmpty(DataSource)) return new Dictionary<string, Dictionary<string, string>>();
Dictionary<string, Dictionary<string, string>> counrtyCollection = new Dictionary<string, Dictionary<string, string>>();
Item item = Context.Database.GetItem(DataSource);
var children = item.GetChildren();
foreach (Item child in children)
{
counrtyCollection.Add(child.Fields["Name"].Value, new Dictionary<string, string>());
foreach (Item desc in child.Children)
{
counrtyCollection[child.Fields["Name"].Value].Add(desc.Fields["Name"].Value, desc.Fields["Code"].Value);
}
}
return counrtyCollection;
}
}
}
Create a razor view like this and build project
@using Sitecore.ExperienceForms.Mvc.Html
@model Sitecore.Project.Example.Views.StateDropdown.StateDropdown
@{
var regions = Model.Regions();
}
<label for="@Html.IdFor(m => Model.Value)" class="@Model.LabelCssClass">@Html.DisplayTextFor(t => Model.Title)</label>
<select id="@Html.IdFor(m => Model.Value)" data-trigger name="@Html.NameFor(m => Model.Value)" class="@Model.CssClass" placeholder="Select Your Work Location" data-sc-tracking="@Model.IsTrackingEnabled" data-sc-field-name="@Model.Name" @Html.GenerateUnobtrusiveValidationAttributes(m => m.Value)>
<option placeholder>Select Your Work Location</option>
@foreach (var region in regions)
{
<optGroup data-id="@region.Value" label="@region.Key">
@foreach (var state in region.Value)
{
<option value="@state.Value">@state.Key</option>
}
</optGroup>
}
</select>
@Html.ValidationMessageFor(m => Model.Value)
Step 3: Fill out the fields
Fill out the View Path, Model Type and Property Editor(should be Property Editor Settings/DropDown List).
you are now all set to utilize the custom dropdown list in Forms Designer. Don’t forget to publish the field!
Hope this is helpful. Any questions, please leave a comment.
I came across a scenario where i implemented a custom validation on Sitecore 9 Forms. Sharing my knowledge here. You can achieve this in three simple steps.
Step 1: Create custom validator
Create a custom validator under /sitecore/system/settings/forms/validation based on Validation(sitecore/templates/System/Forms/Validation) template like below
Step 2: Fill out the fields
Fill out your own regex and error message. You can copy the Type value from other validator.
Step 3: Assign the custom validator
You can now add the new custom validator to any Form fields( /sitecore/system/Settings/Forms/Field Types). All set and no code required!
Hope you found this blog helpful. Any questions, please leave a comment.
I have Sitecore 9.1 instance and today my sitecore license file expired. I had to replace the license.xml in multiple places to make sure my site, xConnect and Identity Server sites work.
Have you submitted a form and it returned with this error ‘The required anti-forgery cookie “__requestVerificationToken” is not present’? If so, here is the resolution.
This could be because of caching. Can you check if your rendering component or container/page level caching check box is checked? if so, unchecking the caching will fix the issue.
Also here is quick check you can do to see whether your form is cached – Inspect the form and check the _requestverificationtoken value like below and refresh the page – do you see same value now? if so, your form is in cache!
I’m participating in Sitecore Hackathon for the first time this year. One of the requirement is to have sitecore 9.1(Initial version) installed on your machine. So I want to share my experience how i quickly installed Sitecore 9.1 using SIF on developer machine in 5 easy steps. This post includes the prerequisites, preparation and installation.
Prerequisites:
OS: Windows 10, Windows Server 2016
DB:
Microsoft SQL Server 2017 or 2016 SP2 – Supports the XM database and is the required for the xDB
Microsoft SQL Server 2014 Sp2 – Only supports XM databases and does not support the xDB
MongoDB Server 3.6.6 – This is required if you are going to use MongoDB for the Collection database or as a Session State Provider
IIS 10
. NET
Sitecore XP 9.1.0 requires .NET Framework 4.7.1
Sitecore Identity server requires .NET Core Runtime 2.1.3
You must apply any available updates to the .NET Framework on every Sitecore installation
Search Indexing
Solr 7.2.1 – Default search provider
Azure Search – supported and recommended for Azure Cloud PaaS deployments only
Lucene – Only supports content search and does not support xConnect.
Powershell 5.1 – for Installing SIF
Preparation:
Download installation package(XP Single) from here
Extract the zip file you just downloaded
Again extract this file – XP0 Configuration files 9.1.0 rev. 001564.zip
Copy your license.xml file (If you have enrolled for Hackathon, you should have received the file in email)
Update the following files in the folder with the exact information – solr path, solr service name, configsets path, instance name for sitecore, SQL instance name and login credentials.
This is a proctor guided exam, no book allowed. Also, the exam software Senitel says you should have an external web camera. It worked with the in-built camera on my work computer. So don’t worry about the external camera.
The exam has 50 questions and 90 minutes to complete. You can review the answers as many times as you want. I completed the exam in 30 minutes and review the answers in the next 30 minutes and I still have 30 more minutes left!
Overall I got a 88% score. Here is my Topic level scoring:
Architecture: 100% Creating and Editing Items: 100% Development Environment: 75% Docs and Support: 100% Installation: 100% Publishing: 100% xManagement: 100% Field Types: 83% Media: 100% Templates: 85% Versioning: 100% Presentation: 77% API: 100% Modules and Packages: 100% Performance: 100% Search: 80%
Once you complete you exam, you will receive an email from test center with score and certification pdf file. Good luck!
Note:
Sitecore Professional Developer – This examination is for Version 8.2
Sitecore Certified Platform Associate Developer – This is for Version 9.0
I came across a situation where I need to merge only couple of commits from branch(not the entire branch) and Git cherry pick does the job pretty clean. I use Git extensions IDE and context menu makes it easier.
Here are the steps:
Make sure you checkout the branch you want to merge the commits
Navigate to the commit you want to cherry pick
Right click and select cherry pick commit option
It opens a dialog with the option to choose auto commit and add commit reference. I recommend checking both of them. By default, they are not checked. Hit Cherry pick button.
Now the commit is auto committed and ready to be pushed into current branch.
Sitecore 9 form feature is awesome and simple to work with. It is more like Visual Studio Toolbox and you can drag and drop the fields.
I had a requirement from Client asking for Ajax form and wanted to show Confirmation/Success message after the form is submitted. Out of the box, this is achievable with the Form.
Here is a small guide on how to create a form with confirmation message:
1. Select Forms from Dashboard.
2. Click Create button.
3. Select blank form.
4. Drag a page for main content.
5. Drag a another page for confirmation message.
6. Design the fields according to needs. Here I’m doing Email Signup form. You can add field validation and css-class as needed.
Please make sure you have these scripts in Layout.cshtml.
I was trying to figure out what would be the best way to list out partial views based on Model type and found C# 7.0 new feature ‘Pattern matching in switch statements’ would be great fit for the scenario.
Before only string/integer can be compared, now you can compare on any type of object. Below is the example shows switch case based on Model Interface type.
@model Synthesis.IStandardTemplateItem
@switch (Model)
{
case INavigationColumnItem nci:
//Take any action
break;
case IColumnNavigationFolderItem ncfi:
//Take any action
break;
case IHeaderLogoItem hli:
//Take any action
break;
case IHeaderNavigationLinkItem hnli:
//Take any action
break;
case IHeaderPhoneNumberItem hpni:
//Take any action
break;
}
Checkout more cool new C# 7.0 features here. Happy coding.