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 hidden or 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).
Sitecore 10 is out! I tried installing it using SIA(Sitecore Install Assistant) along with SXA and it installed smoothly without any errors!
Prerequisites:
No need to install any prerequisites(includes Solr, SIF) 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 to make sure the required SIF and Windows Server prerequisites are up to date.
Install Solr 8.4.0 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 Confirm password (new to Sitecore 10), and license file path.
Fill out SQL server instance name, admin username and password.
Double-check the Solr URL (browse to make sure it’s running successfully), System root and Windows service name
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 10.
Error:
While installing got this error –
Failed to start service ‘Sitecore Marketing Automation Engine – sc10.xp.dev.localxconnect.dev.local- MarketingAutomationService (sc10.xp.dev.localxconnect.dev.local- MarketingAutomationService)’.
Failed to start service Sitecore Marketing Automation – MarketingAutomationService
Resolution:
This could be due to a license expiry issue. In my case, I had a valid license file. Resolved the issue by moving the non-self signed certificates to trusted certificates.
I ran this command as an admin and got a couple of certificates that were non-self signed.
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.