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