output
stringlengths 34
25.7k
| instruction
stringlengths 81
31k
| input
stringclasses 1
value |
---|---|---|
I had the same issue and avoiding custom culture was not an option. I reached out to Sitecore supports and this is what they came back with. I was able to successfully implement it with below guidance:
Please try using the following example to add a custom language(e.g. ru-US):
1: Create a console application RegisterCustomCulture.exe that will register a custom language in the Windows OS according to the article
2: Create a Dockerfile file to build a new custom image. For example:
FROM scr.sitecore.com/sxp/sitecore-xm1-cm:10.1-ltsc2019
COPY LanguageDefinition.Custom.config "c:\inetpub\wwwroot\App_Config\Include\zzz\LanguageDefinition.Custom.config"
COPY RegisterCustomCulture.exe "c:\RegisterCustomCulture.exe"
RUN "C:\RegisterCustomCulture.exe"
3: Add your custom language to the LanguageDefinition.Custom.config config file;
4: Copy the required files(RegisterCustomCulture.exe, Dockerfile, LanguageDefinition.Custom.config) to a build folder on your machine. For example to c:/build.
5: Open the Powershell session, change the folder to the c:/build, trigger building the new image for a Sitecore role (e.g. CM). For example:
cd "c:/build"
docker build -t xm1cm:10.1-ltsc2019-custom-culture .
6: Update your docker scripts to use custom imagexm1cm:10.1-ltsc2019-custom-culture instead of the OOB ones.
7: Start Sitecore environment and add the language according to the article:
| How to install Sitecore Custom Languages in Containers based deployment
I am looking for inputs to install Custom Languages into Containers based deployment.
Generally in ASP.NET MVC application (IaaS) we need to follow steps mentioned at https://sitecore.stackexchange.com/a/4298/303
Application Details:
Sitecore Version: 10.1.1
Implementation: Headless
Client Side Framework: ReactJS
Deployment: Containers
Please share your thought process and suggestion to achieve above requirements.
| |
I was able to resolve this issue by checking for sc_mode=edit in UrlReferrer
| Context.PageMode is not working in Experience editor
When I load the page in Experience Editor for the first time, I am able to get Context.pagemode.IsExperienceEditor as true. We have a few ajax begin forms on the page. When I call any method in the page we will be validating a filter and if it's Experience Editor then we allow access to the method, I am getting Context.PageMode.IsExperienceEditor as false invalidation method.
As a result, the 302 redirection happens resulting in CORS error. This was working fine earlier in all environments. But currently not working in a QA environment.
Note: We didn't make changes to the code at all.
| |
You can use Sitecore Powershell Extensions to achieve what you need.
You first need to call Get-ItemReferrer function and then Publish-Item on every item you get from the first function.
$linkedItemId = "{00000000-0000-0000-0000-000000000001}"
$itemsLinkingToMyItem = Get-ItemReferrer -Path $linkedItemId
foreach ($itemLinkingToMyItem in $itemsLinkingToMyItem) {
Publish-Item -Item $itemLinkingToMyItem
}
Source:
https://www.skillcore.net/sitecore/sitecore-publish-all-items-linking-to-an-item
| How can I publish all the items that link to a particular item?
I am using Sitecore 9.1
I recently deleted an item (let's call it A) and selected Link to another Item when presented with the Breaking Links dialog, redirecting these links to a new item (B). This means that items C and D now point to B instead of A. When I publish B and select publish related items, items C and D are not published... According to the Sitecore Documentation I have read, this seems to be because items that B links to are considered related, but not items that link to B. Is there a way to easily publish all the items that link to B or do I have to do this manually? (In my example there are only 2 items linking to B, but in fact, there are closer to 60, so publishing them manually is going to be hard.)
| |
I fixed this by escaping the file path with double backslashes in docker-compose.override.yml i.e.
C:\\tools\\entrypoints\\iis\\Development.ps
entrypoint: powershell -Command "& C:\\tools\\entrypoints\\iis\\Development.ps1"
Running on Windows 11, the latest Docker desktop
| Error when starting CM and XConnect containers from docker examples custom-images
I have cloned the Sitecore docker examples repository and used docker-compose up to start up the containers. Solr, Sql and Id containers are running successfully, however CM and XConnect are showing this error in the log files and failing to start:
The term 'C:toolsentrypointsiisDevelopment.ps1' is not recognized as the
name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is
correct and try again.
At line:1 char:3
+ & C:toolsentrypointsiisDevelopment.ps1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:toolsentrypointsiisDevelopmen
t.ps1:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I have also run the sitecore-containers-prerequisites.ps1 previous to starting the containers and didn't see any issues. Based on the answer provided Deploying files to Identity Server Container I've checked the CM and XConnect dockerfile and they contain the copy development tools and entrypoint command. I also have the SitecoreDockerTools module installed. Not sure what else to check, thanks in advance.
| |
You can create a PowerShell report by which content authors can execute whenever needed. There are other ways to achieve the same results like adding a Context menu or a button in ribbon etc...
<#
.SYNOPSIS
Lists all media items in a folder
#>
#
# INPUT / CONFIGURATION
#
$props = @{
Title = "Lists all media items"
Description = "Lists all Media items"
OkButtonName = "Run Report"
CancelButtonName = "Cancel"
Parameters = @(
@{ Name = "mediaRootItem"; Title = "Media Item Root Folder"; Editor = "droptree"; Source = "/sitecore/Media Library/" }
@{ Title = "Note"; Value = "Select the root (folder) of the Media Items."; Editor = "info" }
)
}
$result = Read-Variable @props
if($result -ne "ok") {
Close-Window
Exit
}
function Get-MediaUrl($mediaitem) {
$siteContext = [Sitecore.Sites.SiteContext]::GetSite("website");
$result = New-UsingBlock(New-Object Sitecore.Sites.SiteContextSwitcher $siteContext) {
[Sitecore.Resources.Media.MediaManager]::GetMediaUrl($mediaitem)
}
$result
}
#Start Executing the Report
Get-ChildItem -Path master: -ID $mediaRootItem.ID -Recurse | Where-Object { $_.TemplateName -ne "Media Folder" } | Show-ListView
Reference: https://sitecorechat.slack.com/archives/C09THADMX/p1638803732147400
| Sitecore PowerShell Extension - How to get Media Item URL and export it in CSV file (Script making)
I am completely new to Sitecore PowerShell script making. I have a task where I need to get the media item url from the specific folder sitecore/media library/somefolderofimages.
Media Item URL that I am talking about is formatted like this: sitecore/media library/somefolderofimages/cat.png, for example, Content Editors can get the script which will export all of the media items URL from some folder to the CSV File.
If anybody has any tips, please make sure to comment and give me tips on how to do it. Thank you in advance!
| |
Not sure what you want the layoutServiceHost to be, but it's not mandatory. If you remove the layoutServiceHost parameter it will use the current host it's on. So that is also an option.
| How can I change the layoutServiceHost to be read from an environment variable?
Currently the layoutServiceHost is read from a parameter in scjssconfig.json. This means that it needs to be changed and then a rebuild needs to occur for the change to take effect.
Is it possible to change this to read from an environment variable so that we don't need to rebuild?
| |
Clearing the EventQueue and PublishQueue tables seems to have fixed it. I tested items and it doesn't go to Web DB anymore. This is the link on how to clear the tables: https://doc.sitecore.com/xp/en/developers/90/platform-administration-and-architecture/clean-up-the-eventqueue-and-publishqueue-tables.html
| Sitecore publishes item when saved
I already disabled the scheduled publish in sitecore using a patch file. the config is now:
<agent type="Sitecore.Tasks.PublishAgent" method="Run" interval="00:00:00" patch:source="PublishAgentInterval.config">
<param desc="source database">master</param>
<param desc="target database">web</param>
<param desc="mode (full or smart or incremental)" patch:source="PublishAgentInterval.config">smart</param>
<param desc="languages">en, da</param>
</agent>
However, when i save an item, it still publishes the item. any ideas why this is occuring? this is in production environment but in staging it doesn't happen. both have the same patch file with this value:
<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/" xmlns:env="http://www.sitecore.net/xmlconfig/env/">
<sitecore>
<scheduling>
<agent type="Sitecore.Tasks.PublishAgent" method="Run" interval="00:00:00">
<patch:attribute name="interval" value="00:00:00"/>
<param desc="mode (full or smart or incremental)">smart</param>
</agent>
</scheduling>
</sitecore>
</configuration>
This is the config for item:saved event:
<event name="item:saved" patch:source="XSitecore.Audit.Config">
<handler type="Sitecore.Links.ItemEventHandler, Sitecore.Kernel" method="OnItemSaved"/>
<handler type="Sitecore.Globalization.ItemEventHandler, Sitecore.Kernel" method="OnItemSaved"/>
<handler type="Sitecore.Rules.ItemEventHandler, Sitecore.Kernel" method="OnItemSaved"/>
<handler type="Sitecore.Caching.Placeholders.PlaceholderCacheEventHandler, Sitecore.Kernel" method="UpdateCaches" resolve="true"/>
<handler type="Sitecore.Marketing.xMgmt.Definitions.ItemEventHandler, Sitecore.Marketing.xMgmt" method="OnItemSaved" patch:source="Sitecore.Marketing.config"/>
<handler type="Sitecore.Analytics.Data.ItemEventHandler, Sitecore.Analytics" method="OnItemSaved" patch:source="Sitecore.Analytics.Tracking.config"/>
<handler type="Sitecore.ContentTesting.Events.GenerateScreenshot, Sitecore.ContentTesting" method="OnItemSaved" patch:source="Sitecore.ContentTesting.PreemptiveScreenshot.config">
<excludeFields hint="list:ExcludeFieldFromComparison">
<created>__created</created>
<createdby>__created by</createdby>
<updated>__updated</updated>
<updatedby>__updated by</updatedby>
<revision>__revision</revision>
<sortorder>__sortorder</sortorder>
<validfrom>__valid from</validfrom>
<workflow>__workflow</workflow>
<workflowstate>__workflow state</workflowstate>
<lock>__lock</lock>
<pageleveltestsetdefinition>__Page Level Test Set Definition</pageleveltestsetdefinition>
</excludeFields>
</handler>
<handler type="Sitecore.ExperienceAnalytics.Client.Deployment.Events.SegmentDeployedEventHandler, Sitecore.ExperienceAnalytics.Client" method="OnItemSaved" patch:source="Sitecore.ExperienceAnalytics.Client.config">
<param type="Sitecore.ExperienceAnalytics.Client.Deployment.DeploySegmentDefinitionProcessor, Sitecore.ExperienceAnalytics.Client">
<param ref="experienceAnalytics/client/logger"/>
<param type="Sitecore.ExperienceAnalytics.Core.Repositories.ReferenceData.ReferenceDataSegmentStore, Sitecore.ExperienceAnalytics.Core"/>
</param>
</handler>
<handler type="XSitecore.Wcms.CwpBase.XSitecore.Wcms.Audit.ItemAudit.ItemOperations,XSitecore.Wcms" method="OnItemSaved" patch:source="XSitecore.Audit.Config"/>
</event>
| |
This comes due to the old version of PowerShell i.e. 4.7 which doesn't have proper support for pscustomobject.
Either upgrade version to at least 5.1 or be specific when calling to show-listview i.e. give actual field name to show in report like show-listview -property FullPath, ItemUrl.
Hope it gives you an idea of the resolution.
| Value cannot be null error in Sitecore powershall report download
I am trying to generate report using powershell. I am getting results but when I tried to download report using powershell report dialog box throwing error as shown in below screenshot
Please see below code that I wrote to generate report, my Sitecore version is Sitecore 9 update 2 and powershell version is 4.7.2
$startPath = "master:/sitecore/content/Home"
Write-Host "Search started $(Get-Date -format 'u')"
$linkProvider = [LM.Lightcore.Links.LinkProvider]::new()
$urlOptions = [Sitecore.Links.UrlOptions]::new();
$list = [System.Collections.ArrayList]@()
$itemsToProcess = Get-ChildItem $startPath -Language * -Recurse
if($itemsToProcess -ne $null) {
$itemsToProcess | ForEach-Object {
$match = 0;
foreach($field in $_.Fields) {
if($field -match '.*__SearchText*') {
$item = Get-Item ("web:" + $_.ID)
$info = [pscustomobject]@{
"FullPath"=$_.Paths.FullPath
"ItemUrl"=$linkProvider.GetItemUrl($item, $urlOptions)
}
[void]$list.Add($info)
}
}
}
}
Write-Host "Search ended $(Get-Date -format 'u')"
Write-Host "Items found: $($list.Count)"
$list | Show-ListView
Close-Window
Thanks
Rishi
| |
To open it into Experience Editor, you can add the below piece of code or wrap up your HTML code in Glass Mapper @using:
@using (Html.Glass().BeginEditFrame(Model, "Edit video field", x => x.VideoFile))
{
<div style="float:left; padding-right:20px">
<video width="320" height="240" controls>
<source src="@Model.VideoFile" type="video/mp4" />
<source src="@Model.VideoFile" type="video/ogg" />
your custom message
</video>
</div>
}
If you have more than one video field for each extension. Your code will be:
@using (Html.Glass().BeginEditFrame(Model, "Edit video fields", x => x.VideoFileA, x => x.VideoFileB))
{
your HTML
}
You don't need to create any custom Experience Button or Frame for this.
| Rendering video control with Glass mapper and Experience Editor support
Hi,
I am trying to render a video using <video> tag and it expects a url to video file. Looks very straight forward this way but can anyone suggest how I can provide Experience Editor support using Glass().Editable().
The content editor should be able to select the video file from Media Library and it should load the selected video file in Experience Editor. For Images there is out-of-the-box RenderImage() method available. How to achieve this for rendering video?
Please if anyone can help. Thanks in advance.
Parry
| |
For XP, there is no expiration date per se for the certifications. One reason for that is that some customers are still on downlevel versions of the platform. They need support access, but it doesn't make sense to force them to upgrade their certs past where their system is.
However, whether or not a certification is useful depends a great deal on what you need it for. For instance, for a partner trying to attain tiering, they need a particular number of developers per level on a current version. If you are at a partner and currently hold a 9.x certification, you should go pass the 10 certification. Going forward, that will always be by major number, not by minor number. Check the Sitecore Partner Network for details on that.
Certifications for the SaaS products (OrderCloud, CDP, Content Hub, etc.) will likely require a periodic renewal, but we haven't announced the specific policy and renewal time for those yet. Keep an eye on SPN for that as well.
| Certification Exam & Expiration Dates
I'm running into an odd question that I can't seem to find a clear answer to. If anyone here knows a definitive answer to this question and/or can link me to a Sitecore page that documents an answer, I would really appreciate it.
I just got my Sitecore 10 Certification and in trying to track this with the rest of my organization's certs, I came to a bit of an odd point regarding my cert's expiration. In my googling, I came to learn (and recall) that the 9.0 and 9.1 exams had been removed from Sitecore's exam offerings some time ago and replaced by the more broad "Sitecore 9" exam around the time that 9.3 came out.
So ultimately now my question is... when does my "Sitecore 10 Certification" actually expire? If Sitecore is no longer including upgrade versions in their exam/certificate titles, what do we base our expiration off of?
As an example: What does this mean for the people who have 9.0 certifications? Did all their certs expire on 31-Dec-2020, when 9.0 reached the end of its Mainstream Support period, or do they expire on 31-Dec-2022, when 9.3 reaches the end of its Mainstream Support period?
For context: https://support.sitecore.com/kb?id=kb_article_view&sysparm_article=KB0641167#SupportPhasesForSpecificProducts
Side Note: It seems some people are of the opinion that Sitecore certs last 3 years, while others point out that Sitecore certs don't actually expire at all for the version they apply to. Unfortunately, none of these statements I've read actually come directly from Sitecore and I can't seem to find any official documentation from Sitecore defining this.
EDIT: Someone on my team just pointed out that a similar question to this was asked recently: When Sitecore Developer Certificate will expire? however, the answer there doesn't seem all that clear, either, especially not considering that the "Sitecore 10" certification doesn't come with any clearly printed expiration or info detailing any kind of expiration in the slightest.
Unfortunately, the only official statement we have from Sitecore is the following which has been quoted on a number of articles I've seen on the topic:
Certification expiration dates are the same as the Mainstream Support
End Date for the corresponding Sitecore version per Sitecore Product
Support Lifecycle policy.
The problem with using this as an answer is that Sitecore doesn't make it easy to determine what the "corresponding Sitecore version" when the exam and certification are both titled "Sitecore 10" rather than "Sitecore 10.0", "Sitecore 10.1", or "Sitecore 10.2".
So while we can maybe safely say that Sitecore 9.0 certs expired in Dec 2020... when are the new Sitecore 10 certs expiring? Especially considering I took and passed the exam while Sitecore 10.2 was already released and available?
| |
This approach helped me resolve the issue:
Step 1: Delete all certificates from MMC under Current user and Local machine
Step 2: Create root Certificates
New-SelfSignedCertificate -CertStoreLocation cert:\LocalMachine\My -Subject "DO_NOT_TRUST_SitecoreRootCert" -FriendlyName "DO_NOT_TRUST_SitecoreRootCert" -KeyExportPolicy Exportable -KeyProtection None -NotAfter (Get-Date).AddYears(10)
Step 3: Create the xConnect Certificate and replace the "ABC.xconnect" in the below script with your Instance name which will use in the installation script prefix parameter.
New-SelfSignedCertificate -CertStoreLocation cert:\LocalMachine\My -Subject "ABC.xconnect" -FriendlyName "ABC.xconnect" -KeyExportPolicy Exportable -KeyProtection None -NotAfter (Get-Date).AddYears(10)
Step 4: Create the website Certificate and replace the "ABC.sc " in the below script with your Instance name which provide in the installation script prefix parameter.
New-SelfSignedCertificate -CertStoreLocation cert:\LocalMachine\My -Subject "ABC.sc" -FriendlyName "ABC.sc" -KeyExportPolicy Exportable -KeyProtection None -NotAfter (Get-Date).AddYears(10)
Step 5: Open In the Local computer MMC using this command "certlm.msc"
Copy all the above 3 certificates from personal to trusted root certificates Authorities.
Step 6 : Now Run your Installation PowerShell script, with names of certificates you have created manually.
| Sitecore 9 update 2 installation failure with certificate error
I accidentally broke my Sitecore instance, thus removed everything following this :
https://blogs.perficient.com/2019/02/20/failed-sitecore-installation-clean-up-checklist/
and trying to reinstall a new instance but it fails again and again with the attached error.
Please let me know what am I missing here. attaching the log file as well.
Log File:
**********************
Windows PowerShell transcript start
Start time: 20211216011445
Username: HCLTECH\samridhi.sachdeva
RunAs User: HCLTECH\samridhi.sachdeva
Configuration Name:
Machine: LP-5CD8471464 (Microsoft Windows NT 10.0.18363.0)
Host Application: C:\WINDOWS\system32\WindowsPowerShell\v1.0\PowerShell_ISE.exe
Process ID: 20544
PSVersion: 5.1.18362.1801
PSEdition: Desktop
PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1.18362.1801
BuildVersion: 10.0.18362.1801
CLRVersion: 4.0.30319.42000
WSManStackVersion: 3.0
PSRemotingProtocolVersion: 2.3
SerializationVersion: 1.1.0.1
**********************
Transcript started, output file is C:\cb\xconnect-createcert.211216 (2).log
************************************
Sitecore Install Framework
Version - 1.2.1
************************************
WorkingDirectory : C:\cb
LogPath : C:\cb\xconnect-createcert.211216 (2).log
WhatIf : False
Verbose : SilentlyContinue
Configuration : C:\cb\build\assets\xconnect-createcert.json
Debug : SilentlyContinue
WarningAction : Continue
ErrorAction : Stop
InformationAction : Continue
[---------------------------------------------------------------------------- CreatePaths : EnsurePath -----------------------------------------------------------------------------]
[CreatePaths]:[Create] c:\certificates
[------------------------------------------------------------------------- CreateRootCert : NewRootCertificate ---------------------------------------------------------------------]
FileInfo Certificate
-------- -----------
C:\certificates\SitecoreRoot.crt [Subject]...
[------------------------------------------------------------------ ImportRootCertificate : ImportCertificate ----------------------------------------------------------------------]
PSParentPath: Microsoft.PowerShell.Security\Certificate::LocalMachine\Root
Thumbprint Subject
---------- -------
16F74B6D4B69324F09344EA084FECEDCF298BC86 CN=DO_NOT_TRUST_SitecoreRoot, O=DO_NOT_TRUST, OU=Created by https://www.sitecore.net
[----------------------------------------------------------------------- CreateSignedCert : NewSignedCertificate -------------------------------------------------------------------]
**********************
Command start time: 20211216011450
**********************
PS>TerminatingError(New-SelfSignedCertificate): "CertEnroll::CX509Enrollment::_CreateRequest: Object already exists. 0x8009000f (-2146893809 NTE_EXISTS)"
>> TerminatingError(New-SelfSignedCertificate): "CertEnroll::CX509Enrollment::_CreateRequest: Object already exists. 0x8009000f (-2146893809 NTE_EXISTS)"
Install-SitecoreConfiguration : CertEnroll::CX509Enrollment::_CreateRequest: Object already exists. 0x8009000f
(-2146893809 NTE_EXISTS)
At C:\cb\install-xp0.ps1:195 char:8
+ Install-SitecoreConfiguration $XConnectCertificateConfiguratio ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-SitecoreConfiguration
Install-SitecoreConfiguration : CertEnroll::CX509Enrollment::_CreateRequest: Object already exists. 0x8009000f (-2146893809 NTE_EXISTS)
At C:\cb\install-xp0.ps1:195 char:8
+ Install-SitecoreConfiguration $XConnectCertificateConfiguratio ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-SitecoreConfiguration
[TIME] 00:00:05
**********************
Windows PowerShell transcript end
End time: 20211216011450
**********************
enter code here
| |
It depends on the Sitecore version you use.
In the past it was always Lucene.
For modern Sitecore versions (e.g. Sitecore 10.x now) it's Solr.
You can open web.config file in your wwwroot and search for search:define
<add key="search:define" value="Solr" />
| Default Sitecore Index Provider
After installation and setup of a Sitecore project, what index provider does it use? Lucene or SOLR?
How can I also find if my Sitecore project is using either?
| |
With no good news with my trials, we have decided to refactor our models to just pass through the native Glass objects. We simplified the View Model to pass the native objects, instead of the indirect hand-off to a custom SitecoreFields type. So, this bypassed the problem.
public class TestViewModel
{
#region Master Properties
public FundViewModel FundVM { get; set; }
public BaseViewModel BaseVM { get; set; }
#endregion
public ISiteSettings SiteSettings { get; set; }
}
and added [SitecoreId] for Guid Id in a partial class as shown below.
public abstract partial class SitecoreItem : ISitecoreItem
{
[SitecoreId]
public virtual Guid Id { get; set; }
}
The above change worked for us and we were able to resolve this.
| Value cannot be null. Parameter name: objectToSwitchTo
I am upgrading Glapp Mapper to V5. I see that the GlassView is deprecated and instead we have to use @Html.Glass().
In V4, my code has something like @Editable(Model, x=>x.BackGroundColor)
So I changed my code to something like @Html.Glass().Editable(Model, x=>x.BackGroundColor).
When I open Experience editor, This piece of code was throwing an error.
Failed item resolve - You cannot save a class that does not contain a property that represents the item ID. Ensure that at least one property has been marked to contain the Sitecore ID. Type: <NameOfMyClass>.
After looking at the below link,
Glassmapper | Cannot save a class that does not contain a property that represents the item ID
I have added an ID to my model
[SitecoreId]
public virtual Guid Id { get; set;}
Now the above error went away, instead got a new error
Value cannot be null. Parameter name: objectToSwitchTo.
I saw that this question was asked in the past as in below link
Glass Error opening Experience Editor (ObjectToSwitchTo)
It already explains that if we have set method with virtual keyword, it should work. But in my case I already have those implemented and still having the null error.
I also tried assigning a value to Id something like id = Guid.NewGuid(); which has generated a new GUID. but nothing seems to work. Any thoughts?
Here is my Model
public class TestViewModel
{
#region Master Properties
public FundViewModel FundVM { get; set; }
public BaseViewModel BaseVM { get; set; }
[SitecoreId]
public virtual Guid Id { get; set; }
#endregion
public virtual SitecoreFields Fields { get; set; }
public class SitecoreFields
{
public virtual string Title { get; set; }
public virtual string BackgroundColor { get; set; }
}
}
| |
This functionality is part of the Sitecore Experience Accelerator; as such is it not necessarily included in a default 9.3 installation.
Sitecore Experience Accellerator, also known as Sitecore SXA or just SXA is a paid-for add on product to the base Sitecore XM or XP product offerings. As such you would need a license for it, and then it could be installed onto your solution.
| How to get missing Redirects functionality not available in upgraded 9.3 installation working
According to Sitecore Docs v9.3 should have the ability to do redirects ootb.
However, it is not available and doesn't exist in the content tree anywhere.
We started out with v9, I believe. (before I came onboard) Then, we were 'upgraded' by a vendor team but from what I gathered it was mostly changing config version strings, mostly. Guessing new functionality requires more additions of dlls/configs, etc?
My questions are:
Can I add the functionality myself as-it-is?
Is it not OOTB and must be installed?
Thanks for reading.
| |
Sitecore PowerShell has a report to get items by a specific ID:
<#
.SYNOPSIS
Lists all content items that inherit from a given template
.NOTES
Alex Washtell
#>
$database = "master"
$root = Get-Item -Path (@{$true="$($database):\content\home"; $false="$($database):\content"}[(Test-Path -Path "$($database):\content\home")])
$baseTemplate = Get-Item master:\templates
$props = @{
Parameters = @(
@{Name="root"; Title="Choose the report root"; Tooltip="Only items from this root will be returned."; }
@{ Name = "baseTemplate"; Title="Base Template"; Tooltip="Select the item to use as a base template for the report"; Root="/sitecore/templates/"}
)
Title = "Items With Template Report"
Description = "Choose the criteria for the report."
Width = 550
Height = 300
ShowHints = $true
Icon = [regex]::Replace($PSScript.Appearance.Icon, "Office", "OfficeWhite", [System.Text.RegularExpressions.RegexOptions]::IgnoreCase)
}
$result = Read-Variable @props
if($result -eq "cancel") {
exit
}
filter Where-InheritsTemplate {
param(
[Parameter(Mandatory=$true,ValueFromPipeline=$true)]
[Sitecore.Data.Items.Item]$item
)
if ($item) {
$itemTemplate = [Sitecore.Data.Managers.TemplateManager]::GetTemplate($item)
if ($itemTemplate.DescendsFromOrEquals($baseTemplate.ID)) {
$Item
}
}
}
$items = @($root) + @(($root.Axes.GetDescendants() | Initialize-Item)) | Where-InheritsTemplate
if($items.Count -eq 0) {
Show-Alert "There are no content items that inherit from this template"
} else {
$props = @{
Title = "Item Template Report"
InfoTitle = "Items that inherit from the '$($baseTemplate.Name)' template"
InfoDescription = "The following items all inherit from the '$($baseTemplate.FullPath)' template."
PageSize = 25
}
$items |
Show-ListView @props -Property @{Label="Icon"; Expression={$_.__Icon} },
@{Label="Name"; Expression={$_.DisplayName} },
@{Label="Updated"; Expression={$_.__Updated} },
@{Label="Updated by"; Expression={$_."__Updated by"} },
@{Label="Created"; Expression={$_.__Created} },
@{Label="Created by"; Expression={$_."__Created by"} },
@{Label="Path"; Expression={$_.ItemPath} }
}
Close-Window
| How to Get Items from the specific folder with specific TemplateName in Parameters
How to get the items with specific template only. I need this, beacuse it is useful for the bucketable items, like Tags
Here is my code:
$props = @{
Title = "Test"
Description = "Test"
OkButtonName = "Run Report"
CancelButtonName = "Cancel"
Parameters = @(
@{ Name = "TagName"; Title = "Tag Name"; Editor = "multilist"; Source = "/sitecore/system/Settings/Buckets/TagRepository/" }
@{ Title = "Note"; Value = "SitecoreExchange"; Editor = "info" }
)
}
Here is the path (where I want specific template):
Source = "/sitecore/system/Settings/Buckets/TagRepository/"
| |
It turns out I missed out the part that I need to reassign the variable with the new IQueryable:
foreach (var key in keyList)
{
queryResults = queryResults.FacetOn(x => x[key]);
}
Reading through the logs do indeed help as it allowed me to know that facet=on is not included in the executed SOLR query, even more so my index fields. This allowed me to get more clues as to why it is returning an empty set. Check your logs!
| GetFacets / GetResults returns an empty facet list
I was tasked to create a facet component for our solution on top of an already existing search functionality - which is an API controller.
The code snippet I added is the use of .FacetOn(x => x[key]) and .GetResults() but this returns an empty set:
//queryResults is an IQueryable<SearchResultItem>
//searchparams is the JSON request body
//fl is the list of facet titles from JSON request body
//e.g. "Tag List","Action"
var facets = searchparams.fs.Split(','); //["Tag List","Action"]
//Converts facet titles to index keys (info stored as item in Sitecore)
//["tag_list_sm","action_sm"]
var keyList = this.GetFacetKeys(facets);
foreach (var key in keyList)
{
queryResults.FacetOn(x => x[key] != null);
//also tried
//queryResults.FacetOn(x => x[key]);
}
var results = queryResults.GetResults(); //shows result items, but no facets
The tags are stored as a TreeList on the target pages, and are filled up.
Am I missing something? Do I have to add something in the defaultSolrIndexConfiguration node of Sitecore? I also tried creating a model that contains the fields that I need but it still won't show.
public class SearchPage: SearchResultItem
{
[IndexField("action_sm")]
public string Action{ get; set; }
[IndexField("tag_list_sm")]
public string TagList{ get; set; }
}
| |
If you're installing Sitecore 10, 10.1, or 10.2, SIA requires Microsoft Web Deploy 3.6 to be installed on the machine as a prerequisite to the SIA prerequisite installation. I assume that this is due to the fact that there's not a publicly available download link for this component. I was able to get around this issue using the following steps:
Uninstall any newer versions of MS Web Deploy
Manually install Web Deploy 3.6 from here: https://www.microsoft.com/en-us/download/details.aspx?id=43717
Remove this item from the Prerequisites.json file:
"InstallWebDeploy3.6": {
"Type": "StartProcess",
"Params": {
"FilePath": "[variable('WebPlatformCmd')]",
"ArgumentList": "/Install /AcceptEULA /SuppressReboot /Products:WDeploy36PS",
"Wait": true
},
"Skip": "[variable('WebDeploy.Version.Compare')]"
},
| SIA Prerequisite Install Error - Unable to parse [variable('WebDeploy.Version.Compare')]
When setting up a new machine and using Sitecore Install Assistant (SIA) to install the Prerequisites for Sitecore 10.1.1 on Windows 10 64 bit, you may receive the following (abridged) error:
Unable to parse [variable('WebDeploy.Version.Compare')] -
Exception calling "Evaluate" with "2" argument(s):
"The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop
| |
Quick answer
You can populate it in the field "Type" of your template's field item.
Still confusing?
Here is an image to help you
The image above shows how the type is set in the default image field, pay attention the RawValues is checked, it's just a text value, go to your field item and add the value you want.
If you uncheck raw values to see if your custom field is being shown as an option in the Droplist you should make sure you have a FieldType item created under "/sitecore/system/Field types" in core database.
Detailed answer
Firstly, do you really need a custom field type?
If what you need is to change the rendered HTML for image fields, all you need is a pipeline processor.
Some advice:
Pay attention to the processor's invoking order
Disable all other processors for a while
So, to me your best option is extending the GetImageFieldValue processor and make it recognize your custom field type.
So let's make a few changes.
The processor
public class GetResponsiveImageFieldValue : GetImageFieldValue
{
public virtual void Process(RenderFieldArgs args)
{
Assert.ArgumentNotNull(args, nameof(args));
if (!this.ShouldExecute(args)) return;
base.Process(args);
}
public bool ShouldExecute(RenderFieldArgs args)
{
if(!this.IsImage(args))
return false;
if (!Sitecore.Context.PageMode.IsNormal)
return false;
if (Sitecore.Context.Site == null)
return false;
if (Sitecore.Context.Item == null)
return false;
if (args.Result != null && string.IsNullOrEmpty(args.Result.FirstPart))
return false;
return true;
}
protected override bool IsImage(RenderFieldArgs args) => args.FieldTypeKey == "image" || args.FieldTypeKey == "responsive image";
}
The config patch
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
<sitecore>
<pipelines>
<renderField>
<processor patch:instead="processor[@type='Sitecore.Pipelines.RenderField.GetImageFieldValue, Sitecore.Kernel']" type="Sitecore.MyCompany.Foundation.MVC.Pipelines.GetResponsiveImageFieldValue, Sitecore.MyCompany.Foundation.MVC"/>
</renderField>
</pipelines>
</sitecore>
</configuration>
And the last but not least, if at some point you need to bring images from Content Hub you'll probably have to change your approach.
My main question for you is, do you really need a custom field?
If the answer for that is no, a new processor for RenderField pipeline is enough.
This article is about an issue related to RenderField pipeline and a ContentHub instance, it might give you some insights.
| Custom field type has empty string for FieldTypeKey in RenderPipelineArgs; how to populate?
I'm creating a custom field type for our responsive image implementation in Sitecore 10.1 and I need a way to display the image using Html.Sitecore().Field("field_name"). I think I'm mostly there but I'm stuck on getting the renderField pipeline to recognize when it's dealing with my custom field type.
The work I've done borrows heavily from the native ImageRenderer class and GetImageFieldValues processor on the pipeline, and the way they handle that is to check args.FieldTypeKey for a value of "image." Unfortunately, that property is an empty string for my custom field and I can't figure out how to get a value in there.
Does anyone know how to populate the RenderPipelineArgs.FieldTypeKey value for a custom field type? Or, alternatively, can anyone suggest a different method for my renderField processor to identify when the field is my custom type?
I can add a field of my custom type to a data template and the control for it renders correctly in Content Editor (i.e., it uses a modified droptree and that functions as expected to select a value). But when I attempt to view the page (Editing mode, Preview mode, or live site) the field isn't included in the rendering.
What I've done so far
Created a custom field type in the core database under sitecore/system/Field Types/Custom Fields
Created a class in my project (ResponsiveImage.cs) to implement the field, and set the Assembly and Class properties of the custom field type to point to it
Created a custom RenderFieldPipeline processor (GetResponsiveImageFieldValue.cs) to render the field and a config file (ResponsiveImage.config) to add it to the renderField pipeline
Added an entry in the <fieldTypes> config node for my custom field type
Published everything
Code
GetResponsiveImageFieldValue.cs
public class GetResponsiveImageFieldValue
{
public virtual void Process(RenderFieldArgs args)
{
Assert.ArgumentNotNull(args, nameof(args));
if (!IsResponsiveImage(args)) return;
ResponsiveImageRenderer renderer = this.CreateRenderer();
ConfigureRenderer(args, renderer);
SetRenderFieldResults(renderer.Render(), args);
}
protected virtual bool IsResponsiveImage(RenderFieldArgs args) => args.FieldTypeKey == "responsive image";
protected virtual ResponsiveImageRenderer CreateRenderer() => new ResponsiveImageRenderer();
protected virtual void ConfigureRenderer(RenderFieldArgs args, ResponsiveImageRenderer renderer)
{
renderer.Item = args.Item;
}
protected virtual void SetRenderFieldResults(RenderFieldResult result, RenderFieldArgs args)
{
args.Result.FirstPart = result.FirstPart;
args.Result.LastPart = result.LastPart;
args.WebEditParameters.AddRange(args.Parameters);
args.DisableWebEditContentEditing = true;
args.DisableWebEditFieldWrapping = true;
args.WebEditClick =
"return Sitecore.WebEdit.editControl($JavascriptParameters, \"webedit:chooseresponsiveimage\")";
}
}
ResponsiveImages.config
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
<sitecore>
<commands>
<command name="webedit:chooseresponsiveimage" type="Sitecore.MyCompany.Foundation.MVC.CustomSitecore.ChooseResponsiveImage, Sitecore.MyCompany.Foundation.MVC" />
</commands>
<overrideXmlControls>
<override xmlControl="Sitecore.Shell.Applications.Media.ResponsiveMediaBrowser" with="/sitecore/client/applications/Dialogs/SelectResponsiveMediaDialog" />
</overrideXmlControls>
<pipelines>
<renderField>
<processor type="Sitecore.MyCompany.Foundation.MVC.Pipelines.GetResponsiveImageFieldValue, Sitecore.MyCompany.Foundation.MVC"
patch:before="processor[@type='Sitecore.MyCompany.Foundation.MVC.Pipelines.CustomGetImageFieldValue, Sitecore.MyCompany.Foundation.MVC']" />
</renderField>
</pipelines>
<fieldTypes>
<fieldType name="Responsive Image" type="Sitecore.MyCompany.Foundation.MVC.CustomFields.ResponsiveImage, Sitecore.MyCompany.Foundation.MVC" />
</fieldTypes>
</sitecore>
</configuration>
(Note: opted to not include a listing of ResponsiveImage.cs because it just extends our modified droptree class and overwrites the Source property, and it should be irrelevant to the problem at hand.)
Similar SO questions
The only existing question I could find that comes close to this is: How to change the source from an image field programmatically?
The answers to that come very close to where my problem is but don't quite address the FieldTypeKey field itself.
| |
For jss media you should override jss media handler and patch the same in the config
public class ConvertImageToWebp : Sitecore.JavaScriptServices.Media.MediaRequestHandler{
protected override bool DoProcessRequest(HttpContext context, MediaRequest request, Media media){
if ((context?.Request.QueryString?["extension"]?.Contains("webp") ?? false) || (!Helpers.CdnEnabled && context.BrowserSupportsWebP()))
{
request.Options.CustomOptions["extension"] = "webp";
}
return base.DoProcessRequest(context, request, media); }
}
| Getting Dianoga to work with the jssmedia urls
I've been at it a couple of days now and gotten Dianoga working, converting all of our "old media" images to shiny new webp format images. It works great for the standard ~/media url requests. I see that there is a separate ~/jssmedia set of services, and those are not working. Is there some other change in the configs I have to make, like the one in web.config, or anything else to make it work? I did find that I'm supposed to enable CDN support, which I did, but that made no difference.
Ok, sorry, a teensy bit more info on this.
We are on Sitecore 9.3 and attempting this with Dianoga 5.4.1.
Well, thank you in advance for any suggestions you can make.
| |
NPM to JSS version
I may have misunderstood part of the question, but from my understanding, the NPM version and the JSS version are the same thing, so the compatibility matches the NPM version. This means if JSS 13 is what is compatible with your version, then you should be using NPM version 13.
Compatibility by Sitecore XP version
You can review the compatibility of JSS up to version 9.3 on this compatibility document: https://support.sitecore.com/kb?id=kb_article_view&sysparm_article=KB0541788
From that doc, these are the compatibility of JSS versions up to 9.3:
JSS 9.0 Tech Preview: 9.0
JSS 11.0: 9.0, 9.1
JSS 12.0: 9.2
JSS 13.0: 9.3
JSS 14.0: Not compatible with 9.3
For versions after 9.3, you can review this article: https://support.sitecore.com/kb?id=kb_article_view&sysparm_article=KB1000576
From that doc, JSS version compatibility is as follows:
JSS 14.0: 10.0
JSS 15.0: 10.0
JSS 16.0: 10.1
JSS 18.0: 10.1
JSS 19.0: 10.2
Note on JSS vs Headless Services
With Headless Services it is more than just JSS and now includes ASP.NET Core as well. Newer releases are referred to as Headless Services instead of JSS. You can find the downloads for Headless Services here: dev.sitecore.net/Downloads/Sitecore_Headless_Rendering.aspx
| What version of sitecore jss is compatible with a given sitecore-jss npm package
I am trying to find some sort of compatibility matrix that will tell me what version of JSS https://dev.sitecore.net/Downloads/Sitecore_JavaScript_Services/ is compatible with the sitecore-jss npm package https://www.npmjs.com/package/@sitecore-jss/sitecore-jss
At the moment we are locked into JSS 13 due to our Sitecore version (9.3), but I'm trying to see if I can bump our sitecore-jss npm package past 13.0.
Where can I find some documentation linking Sitecore package versions with npm package versions?
| |
I agree it is confusing, but this article is only applicable to the scenario when you want to separate Content Delivery and Expired session processing roles.
Your desired setup (2 CDs and no dedicated session expiration server) can be achieved with the following configuration:
Both CDs should be included in load balancing
Both CDs should have private and shared session configured
Both CDs should have pollingEnabled="true" (if this parameter is omitted, "true" will be used by default)
This type of setup comes out-of-the-box with Sitecore XP Scaled packages as by default all CD instances can serve content and process expired sessions.
| Sitecore session expiration with multiple CDs
I'm having a very hard time understanding the terribly written official Sitecore documentation surround session expiration here:
https://doc.sitecore.com/xp/en/developers/102/platform-administration-and-architecture/configure-a-dedicated-expired-session-processing-server.html
It states (emphasis my own):
The Sitecore Experience platform supports a dedicated server for expired session processing. This means that if you have an environment using a cluster of CD servers, you can configure some of the servers to only serve content, but not to process the expired session state data by using the pollingEnabled setting. The pollingEnabled setting specifies whether to enable processing of expired sessions (default value is true). For example, you can enable it on the CD servers that are dedicated to expired sessions processing and disabled it on the live CD servers, (that serve content to visitors).
And then goes on to warn:
Important
You must ensure the servers that are dedicated to expired session processing are not serving content to visitors. For example, if you have configured a load balancer for CD servers, you must ensure requests do not redirect to servers that are dedicated to expired sessions processing.
What on earth is going on here? Can I have 1 or multiple instances processing expired sessions? It's as clear as mud.
Out of the box, a CD serves content. That's why it is called a Content Delivery server. Out of the box, a CD also has pollingEnabled set to true. This means that Sitecore have configured, by default, a CD to also process expired sessions.
But then they say that a CD that is serving content to users must not also process expired sessions, which entirely contradicts the out of the box default setting. It also fails to explain why they have issued this warning. What's going to happen if I fail to prevent their own default settings doing this?
Rant over, here's my question:
What I'm supposed to do in the following scenario:
2 load-balanced CD servers that are serving content
Both CDs use redis for private and shared session state
No dedicated session expiration server
My deduction is that I should have a single CD with pollingEnabled="true" so that both CDs aren't trying to process the same sessions and submit them to xConnect. Is this right or am I missing something?
| |
I wound up using the approach recommended by @AnnaGevel and added a boosted keywords field. While I don't think this is quite as precise as the Query Elevation Component would be, it's maintainable by content editors without needing to write a custom add-on.
| Solr QueryElevationComponent being ignored
I'm trying to set up "best bets" in a Sitecore 9.3 environment.
I set up the Solr Query Elevation Component following the instructions at this URL:
https://solr.apache.org/guide/6_6/the-query-elevation-component.html
It seems to work in Solr.
However, Sitecore won't honor that setting. When I search for a term I know we have results ("product X"), it doesn't appear at the top of the list like it should. Right now it's the 10th result. Based on what I set in the elevate.xml file, it should be the first result for the query "product X."
Is this component even supported? I don't see anything explicitly spelled out either way, but if anyone has successfully implemented it, how did you do it?
Do Sitecore configs need to change? How about the search code itself?
Elevate.xml file
<elevate>
<query text="my query">
<doc id="sitecore://master/{top result guid}?lang=en&amp;ampver=1&amp;ampndx=myindex_boosted" /> <!-- Product page -->
<doc id="sitecore://master/{second result guid}?lang=en&amp;ampver=1&amp;ampndx=myindex_boosted" /> <!-- Product 2 -->
</query>
</elevate>
Search log
8008 08:30:35 INFO Warming and Caching your search indexes
8008 08:30:35 INFO /******* Warming Queries ********/
8008 08:30:35 INFO /*************************/
25112 08:31:13 INFO Solr Query - ?q=((computedcontents_t:(*product*) OR _content:(*product*)) AND (computedcontents_t:(*name*) OR _content:(*name*)))&start=0&rows=10&fl=*,score&fq=(((-hidefromsearch_b:(True) *:*) AND (-notinsearch_b:(True) *:*)) AND _language:(en))&fq=_indexname:(my_index_index_boosted)&wt=xml
25112 08:31:14 INFO Solr Query - ?q=__solr_norm_field_name_t:(_lastestversion)&start=0&rows=1&fq=_template:({template ID})&fq=_indexname:(my_index_index_boosted)&wt=xml
25112 08:31:14 INFO Solr Query - ?q=__solr_norm_field_name_t:(_url)&start=0&rows=1&fq=_template:({template ID})&fq=_indexname:(my_index_index_boosted)&wt=xml
25112 08:31:14 INFO Solr Query - ?q=((computedcontents_t:(*product*) OR _content:(*product*)) AND (computedcontents_t:(*name*) OR _content:(*name*)))&start=0&rows=5&fl=*,score&fq=((((computedtitle_t:("product name\*") AND _fullpath:(\/sitecore/content/product/home/products*)) AND (-hidefromsearch_b:(True) *:*)) AND (-notinsearch_b:(True) *:*)) AND _language:(en))&fq=_indexname:(my_index_index_boosted)&wt=xml
25112 08:31:14 INFO Solr Query - ?q=__solr_norm_field_name_t:(_lastestversion)&start=0&rows=1&fq=_template:({template ID})&fq=_indexname:(my_index_index_boosted)&wt=xml
25112 08:31:14 INFO Solr Query - ?q=__solr_norm_field_name_t:(_url)&start=0&rows=1&fq=_template:({template ID})&fq=_indexname:(my_index_index_boosted)&wt=xml
25112 08:31:14 INFO Solr Query - ?q=((computedcontents_t:(*product*) OR _content:(*product*)) AND (computedcontents_t:(*name*) OR _content:(*name*)))&start=0&rows=1&fl=*,score&fq=((((computedtitle_t:("\*product name\*") AND _fullpath:(\/sitecore/content/product/home/trial*)) AND (-hidefromsearch_b:(True) *:*)) AND (-notinsearch_b:(True) *:*)) AND _language:(en))&fq=_indexname:(my_index_index_boosted)&wt=xml
25112 08:31:14 INFO Solr Query - ?q=__solr_norm_field_name_t:(_lastestversion)&start=0&rows=1&fq=_template:({template ID})&fq=_indexname:(my_index_index_boosted)&wt=xml
25112 08:31:14 INFO Solr Query - ?q=__solr_norm_field_name_t:(_url)&start=0&rows=1&fq=_template:({template ID})&fq=_indexname:(my_index_index_boosted)&wt=xml
| |
Sitecore support got back to me a lot quicker than I anticipated. They pointed out that I was not using the IAR deployment package for Powershell Extensions located here:
https://sitecoredev.azureedge.net/~/media/D1EDF3410DA34E109CBACAFD424952EC.ashx?date=20211103T111147
Once I updated my module parameters to use the correct web deploy package, I was able to get my environment successfully provisioned.
{
"name": "sxa",
"templateLink": "https://raw.githubusercontent.com/Sitecore/Sitecore-Azure-Quickstart-Templates/master/SXA%2010.2.0/xm0/azuredeploy.json",
"parameters": {
"cmSxaMsDeployPackageUrl" : "https://XXXXXXX/Sitecore Experience Accelerator XM 10.2.0 rev. 04247.scwdp.zip",
"speMsDeployPackageUrl" : "https://XXXXXXX/Sitecore.PowerShell.Extensions-6.3 - IAR.scwdp.zip",
"solrCorePrefix" : "sitecore"
}
}
| Deploying SXA 10.2 XM Single with Sitecore Azure Toolkit 2.7 - The path '' is not valid for the 'dbDacFx' provider
When I attempt to deploy a Sitecore 10.2 XM0 topology with JSS 19.0 and SXA 10.2 configured as modules, I receive this error during the SXA deployment step:
{
"status": "failed",
"error": {
"code": "Failed",
"message": "Package deployment failed\r\nARM-MSDeploy Deploy Failed: 'Microsoft.Web.Deployment.DeploymentException: The path '' is not valid for the 'dbDacFx' provider. ---&gt; System.ArgumentNullException: Value cannot be null.\r\nParameter name: value\r\n --- End of inner exception stack trace ---\r\n at Microsoft.Web.Deployment.DeploymentProviderOptions.set_Path(String value)\r\n at Microsoft.Web.Deployment.ManifestProvider.&lt;GetPostProvidersHelper&gt;d__0.MoveNext()\r\n at Microsoft.Web.Deployment.WebDeployEventHelper.EventWriteManifest(String sessionId, DeploymentObjectProvider provider)\r\n at Microsoft.Web.Deployment.DeploymentObject.SyncToInternal(DeploymentObject destObject, DeploymentSyncOptions syncOptions, PayloadTable payloadTable, ContentRootTable contentRootTable, Nullable`1 syncPassId, String syncSessionId)\r\n at Microsoft.Web.Deployment.DeploymentObject.SyncTo(DeploymentProviderOptions providerOptions, DeploymentBaseOptions baseOptions, DeploymentSyncOptions syncOptions)\r\n at Microsoft.Web.Deployment.WebApi.AppGalleryPackage.Deploy(String deploymentSite, String siteSlotId, Boolean doNotDelete)\r\n at Microsoft.Web.Deployment.WebApi.DeploymentController.&lt;DownloadAndDeployPackage&gt;d__25.MoveNext()'"
}
}
This answer in another, related question: https://sitecore.stackexchange.com/a/9280/3053, suggests that the issue is related to the wrong topology being used. For this reason I've included my obfuscated module parameters in case I have lost my mind:
{
"name": "sxa",
"templateLink": "https://raw.githubusercontent.com/Sitecore/Sitecore-Azure-Quickstart-Templates/master/SXA%2010.2.0/xm0/azuredeploy.json",
"parameters": {
"cmSxaMsDeployPackageUrl" : "https://XXXXXXX/Sitecore Experience Accelerator XM 10.2.0 rev. 04247.scwdp.zip",
"speMsDeployPackageUrl" : "https://XXXXXXX/Sitecore.PowerShell.Extensions-6.3.scwdp.zip",
"solrCorePrefix" : "sitecore"
}
}
I tried to install Sitecore 10.1.1 XM0 with SXA 10.1 and got the exact same error, which leads me to believe that either:
I don't know what I'm doing with these ARM templates
SAT 2.7 has a problem and I should try SAT 2.6
SXA isn't designed to be deployed in the XM0 topology
| |
Since you mentioned in one of the comments that you're using Solr Cloud with 3 nodes, I just wanted to share the setup I've found working well for most scenarios:
Use just the onPublishEndAsyncSingleInstance strategy on the web-related indexes, such as sitecore_web_index. Skip the remoteRebuild. Set the strategy to manual on non-indexing servers and ensure one server is assigned to handle the indexing. Usually I let the CM server do the indexing, since a bit of extra load on that machine doesn't affect the site performance for visitors.
The Sitecore config parts handling the indexing strategies could end up something like this:
<strategies hint="list:AddStrategy">
<strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/onPublishEndAsyncSingleInstance" role:require="Standalone OR (ContentManagement AND Indexing) OR (ContentDelivery AND Indexing)" />
<strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/manual" role:require="(ContentManagement AND !Indexing) OR (ContentDelivery AND !Indexing)" />
</strategies>
You AppSettings can thereby be kept as-is, <add key="role:define" value="Standalone"/>, for local development and in production/multi-server roles, you can define CM as ContentManagement, Indexing (and potentially Processing and Reporting if it suits your infra architecture) and the CD as just ContentDelivery.
Solr Cloud also works very well with switching indexes. It is essential that just machine is responsible for building each index. Otherwise they may overwrite each other, and with switching indexes they may fight over what index should be the primary one.
| sitecore_web_index index is not getting updated upon publish on remote Solr servers
I am hoping to understand the cause of this and hopefully find a solution - I have looked at every possible solution, but haven't been able to fix it.
Sitecore v10.0.2 using Solr 8.4.
In my current set up, Core DB is shared between CM and CD servers.
Index update strategy for web dB is onPublishEndAsyncSingleInstance
combined with remoteRebuild.
I created a new item and published it. Item was published to the web
db, but the item didn't appear in the index(but item was updated in the index when I
set up the solr as local standalone instance).
I thought perhaps core db might have a play in this. So, I checked
the event queue settings to see if it was set to true & it is.
When we trigger sitecore web index rebuild from sitecore
interface(control panel) then only remote solr instances indexes are
getting updated.
All the events are processed in the event queue according to
EventQueueStats.aspx & in the event queue table as well.
What could be the cause of it?
| |
For me the issue was resolved by changing the isolation process within the docker-compose.yml that the traefik container utilises .
isolation: ${TRAEFIK_ISOLATION}
to
isolation: ${ISOLATION}
In my .env file, ${TRAEFIK_ISOLATION} was configured to "hyperv" which was causing issues.
${ISOLATION} on the other hand was set to use the "default" isolation process.
| Cannot start service traefik: The virtual machine could not be started because a required feature is not installed
I am trying to install Sitecore 10.1.1 with Docker. I am able to successfully pull all docker images with docker-compose pull but when I am trying to do docker-compose up -d, All containers are up successfully except Traefik. I am getting below error for Traefik,
ERROR: for sitecore-xp0_traefik_1 Cannot start service traefik: hcsshim::CreateComputeSystem 308577a1486d02db2b661905e61dd40134cb7cc9467b3ab9c87d1ef69a43ac67: The virtual machine could not be started because a required feature is not installed.
(extra info: {"SystemType":"Container","Name":"308577a1486d02db2b661905e61dd40134cb7cc9467b3ab9c87d1ef69a43ac67","Owner":"docker","IgnoreFlushesDuringBoot":true,"LayerFolderPath":"C:\\ProgramData\\Docker\\windowsfilter\\308577a1486d02db2b661905e61dd40134cb7cc9467b3ab9c87d1ef69a43ac67","Layers":[{"ID":"9b15f101-0b16-5ad0-b113-37fd6cda2cda","Path":"C:\\ProgramData\\Docker\\windowsfilter\\8d2b7f10c0a1f09636b33d901e90a60fd5b61ac6be2d26d1431b034995379a74"},{"ID":"1189eb85-39bc-5018-842b-c447ad5be861","Path":"C:\\ProgramData\\Docker\\windowsfilter\\c84a78ec1ce4a0975fbb4dac5aaf89a193db1aacf426777edfa043679b563008"},{"ID":"ac12ad31-aaeb-58c9-aea9-68abd0a79253","Path":"C:\\ProgramData\\Docker\\windowsfilter\\adacf7881fb76bb334c39b03b84eaf3666f4f1143e6c15c509940e92bdfaa770"},{"ID":"7dff9674-b5ac-5880-a3a7-abd449a6c918","Path":"C:\\ProgramData\\Docker\\windowsfilter\\5a5fdf078c49e388d5888a7e3c4a24c0a4c8f42c7f4e7e96c5520a40fff25b08"},{"ID":"162a392d-8dd7-5eff-baf9-ebde9433eab8","Path":"C:\\ProgramData\\Docker\\windowsfilter\\080121d15c04dfda3f6fa0d2917f481026ed6c9750baa1f9a4e2e13b4b343600"},{"ID":"31999afe-be9f-59fb-8e5f-53a8084f756a","Path":"C:\\ProgramData\\Docker\\windowsfilter\\2c4e3f747749152df194939cd8b34ccbc79158ac0ab9eefd16052c9a0bf52e53"},{"ID":"7dc50d19-d834-56cb-8d1c-d81d769ccd44","Path":"C:\\ProgramData\\Docker\\windowsfilter\\0851a79a12e5ca3eefbd1cd2cc22fafddfd9b994726ccfd116eaa925a692710e"}],"HostName":"308577a1486d","MappedDirectories":[{"HostPath":"c:\\sc_install_10.1\\compose\\ltsc2019\\xp0\\traefik","ContainerPath":"c:\\etc\\traefik","ReadOnly":false,"BandwidthMaximum":0,"IOPSMaximum":0,"CreateInUtilityVM":false}],"MappedPipes":[{"HostPath":"\\\\.\\pipe\\docker_engine","ContainerPipeName":"docker_engine"}],"HvPartition":true,"EndpointList":["16C184DE-A071-4EDB-91BB-45E16712CD83"],"HvRuntime":{"ImagePath":"C:\\ProgramData\\Docker\\windowsfilter\\2c4e3f747749152df194939cd8b34ccbc79158ac0ab9eefd16052c9a0bf52e53\\UtilityVM"},"AllowUnqualifiedDNSQuery":true})
Below are the configurations of my VM,
Windows Edition - Windows Server 2019 Standrad
Version - 1809
OS Build - 17763.1879
Docker Desktop version - 3.3.3
I have HyperV enabled in my machine and Docker desktop is configured to run Windows Container.
Attaching screenshot of the error,
Can someone please help me understand what other feature am I missing here.
Thanks
| |
This is commonly because your Docker Desktop is configured to "Compose V2" mode. Open up Docker Desktop, go to "Settings" and Uncheck "Use Docker Compose V2".
For other typical problems you might run into, a few good community resources should be helpful:
https://errorcotidianam.wordpress.com/2021/09/14/sitecore-docker-common-issues-on-installation/
https://doc.sitecore.com/xp/en/developers/100/developer-tools/troubleshooting-docker.html
| Developer's Fundamentals 10 Collection ( Sitecore Certification )
I am getting this error when executing
.\up.ps1
Status: pull access denied for myproject-dotnetsdk, repository does not exist or may require 'docker login': denied: requested access to the resource is denied, Code: 1
Where do i set the docker login ?
=============================================================
I am trying to follow steps in
Walkthrough: Using the Getting Started template
https://doc.sitecore.com/xp/en/developers/101/developer-tools/walkthrough--using-the-getting-started-template.html
=============================================================
3 errors occurred:
Status: pull access denied for myproject-dotnetsdk, repository does not exist or may require 'docker login': denied: requested access to the resource is denied, Code: 1
Status: pull access denied for myproject-dotnetsdk, repository does not exist or may require 'docker login': denied: requested access to the resource is denied, Code: 1
Status: pull access denied for myproject-solution, repository does not exist or may require 'docker login': denied: requested access to the resource is denied, Code: 1
| |
This is caused by a combination of a couple of things.
A large xDB contact database (60+ million).
The need to execute a segmentation rule against that database.
The need to execute a lot of segmentation rules at the same time (because you are looking at a list of segmentation lists so the rule has to run for all it is trying to show in the UI).
All this together means the system (SOLR) cannot execute and return the counts of all the lists with their segmentation rules applied fast enough to provide a count to the UI. So far the only answer has been a smaller database or bigger hardware.
| List Counts show pending for long duration of time (hours)
We are seeing an issue where the majority of a our lists counts now just show counts of "pending". 1 out of 10 refreshes will shows 50% of the lists with counts but with another refresh almost all go back to a count of "Pending". indexer shows no errors, xConnect shows no errors. Any thoughts on what is going on?
| |
To make a change in the JS file,
Go to that particular JS item and select it. You'll see the option to download the file.
Open the downloaded file, make changes and save it.
Now go to the same item again in Sitecore and click on attach and select this file to upload.
Note: You should not directly make changes in the Optimized JS file, this file is auto-generated based on other uploaded JS files.
| How to upload single file into theme
I wanted to change one js file from theme so I downloaded it.
Now when I made those changes I am not able to see any option to upload it. Can someone please guide me on this?
Update
As Raman suggested I went to the file directly but there is no download option in Media field as shown in the image. How can I see file to download.
| |
Got this working, if anyone else stuck on this, they can follow the below steps to resolve this issue:
Sync content items: When you add a new Commerce content item or make changes to an existing one in the Commerce Control Panel (in the Sitecore Content Editor), you must synchronize the content item (defined in the Sitecore Content Editor) with the data in the Commerce Engine database. Refer to this doc.
Restart IIS and Commerce Engine instances.
You must flush the Redis cache (use the flushall command in Redis).
After following the above steps, you can check fulfilment options using Get all fulfillment methods Postman API requests:
{{ServiceHost}}/{{ShopsApi}}/GetFulfillmentMethods()
| New fulfillment Method not visible on storefront website
Sitecore XC: 9.3
We are trying to create a new fulfilment method named 3-days delivery under the Ship Items option (/Sitecore/Commerce/Commerce Control Panel/Shared Settings/Fulfillment Options/Ship items).
We have followed all the steps mentioned in the official doc:
Created a new fulfilment method:
Created a commerce term:
Published the site and perform an IIS reset, still new shipping method not visible on the website.
Any help is much appreciated.
| |
Sitecore Experience Profile allows you to monitor the behaviour of users that have interacted with your Sitecore website(s). All the marketing data associated with a user like visited pages, triggered goals, time spent on each page, total interaction duration etc. is being held in a Contact business entity and stored in Sitecore xDB. Contacts can be of two types - Anonymous and Known. Unlike the Anonymous Contacts that have no any registered identifiers the Known Contacts have registered identifiers such username, email or other unique Id.
If there is a requirement to extend the standard Contact model with specific data properties (for example, site specific user fields / properties) you can easily create a custom Facet - a Contact attribute, read more about how to create and set custom facets for contacts.
The Sitecore's Tracker is responsible for recording all contact’s activity during a web session, then on the session end event the captured analytical data is being converted into an xConnect interaction and submitted to xConnect through the xConnect Client API. Read more about tracking contacts here.
By default, if you do not configure any experience marketing functionality, you will only see general information about Contacts, such as the external keywords used and general session information. Read more here about how to preconfigure Sitecore for the Experience Profile.
To extend the tracking functionality you can trigger the built-in events such as goals, page visits, outcomes etc. or create a custom event and capture custom data with the help of the Tracker and xConnect.
| Track users based on certain credentials
I would like to track user activity based on some of the details that they provided. Eg. internal sites that they have visited, number of logged in times, amount of time that they have spent of different sites. May I know how this can be done with the experience profile?
| |
Using asterix at the end of your placeholder key in Scriban will solve your issue. (It works well in SXA 10.1)
{{ sc_placeholder "myplaceholderkey*" }}
| SXA Scriban Dynamic Placeholders
I am trying to render a dynamic placeholder with the Scriban as follows:
{{ sc_placeholder 'section' }}
and I would expect it to add a number to the key i.e. section-3, etc, but this is what I see as a result:
which is not what I expected.
P.s. I have the IsRenderingsWithDynamicPlaceholders property set to true on my rendering item.
Is there anything I am missing?
| |
So this is what I ended up coming up with, with the help of the above response.
query:./ancestor-or-self::*[@@templateid='{AD55B888-20A7-43A3-B487-6FE5658F9DAC}']//*[@@templatename='Country']
So Richard thanks for helping me in the right direction.
| Need help with a Query to select a data source context, for each site
I have a page template where when the site was setup it referenced the folder(Item ID), but now I have multiple sites and need it to reference ONLY the sites folders not just the main site. I am trying to run a query that will just select this folder from the selected site. So I have site Red and a site blue and a site green, under the sites I have the corresponding datasources and that is what I need to call in with this query. So site red needs to point to its corresponding red datasource with the countries folder under it, SAMPLE is the second image, trying to point to that countries folder.
| |
You may notice on the IPoi items that they now inherit from the template /sitecore/templates/System/Geospatial/Coordinate. If you created custom items which inherit from this template or perhaps you used the OOTB template you should see multiple latitude/longitude fields.
Use the following script as an example on how to migrate the field data.
Example: The following finds descendant items at a specific root and then copies the field data. Here we are dealing with items representing jobs on our Career site.
# Change to the root ID for items which use the IPoi template
# Careers
#$rootId = "{B8208D4B-C25E-4381-A183-4177E47A9310}"
# POIs
$rootId = "{60365D59-F2F2-4C49-91DA-9C7B046178CF}"
# Change to the template ID of the items inheriting from IPoi
# Job
#$filterId = "{0CB1F725-2A60-49D9-8BC4-867F5FDF73FA}"
$filterId = "{6EBB38CE-04FC-425C-895B-3C81FA4A7B5C}"
$items = Get-ChildItem -Path "master:" -ID $rootId -Recurse |
Where-Object { $_.TemplateId -eq $filterId }
foreach($item in $items) {
$item.Editing.BeginEdit()
# SXA does not have a constant available for the Latitude/Longitude fields so we use the hardcoded ID.
$item.Fields[[Sitecore.ContentSearch.Utilities.Constants]::Latitude].Value = $item.Fields["{94969C59-C4B8-43ED-9C92-3FBF930C0ACF}"].Value
$item.Fields[[Sitecore.ContentSearch.Utilities.Constants]::Longitude].Value = $item.Fields["{8C1AEA63-2E5E-4FEE-B413-D3B1E050DD26}"].Value
$item.Editing.EndEdit() > $null
}
Note: Be sure to crawl all the content again now that the new fields contain data.
Bonus
Example: The following snippet shows a scriban template for the Place object using schema.org.
{{ poi = sc_follow i_page "POI" }}
<div itemscope="" itemtype="http://schema.org/Place">
<div itemprop="geo" itemscope="" itemtype="http://schema.org/GeoCoordinates">
<meta itemprop="latitude" content="{{ poi | sc_field "Latitude" }}">
<meta itemprop="longitude" content="{{ poi | sc_field "Longitude" }}">
</div>
</div>
| How do you copy Latitude Longitude from the old SXA fields to the new Coordinate fields?
We are upgrading from an older SXA for Sitecore 8.2.7 to SXA 9.3. We would like to keep the Latitude and Longitude values intact but we have hundreds of items with this data.
How can I migrate these values over using SPE to get our search working again?
| |
I have found the use of SPE to be great for this kind of thing. Here is an example on how to render a scriban template.
Example: The following uses Sitecore PowerShell Extensions to render a scriban template.
$testTemplate = @"
i_item Title: {{ i_item.title }}
i_page Title: {{ i_page.title }}
"@
$item = Get-Item -Path "master:" -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}"
$pageContext = New-Object Sitecore.Mvc.Presentation.PageContext
$pageContext.Item = $item
[Sitecore.Mvc.Common.ContextService]::Get().Push($pageContext) > $null
$instance = [Sitecore.DependencyInjection.ServiceLocator]::ServiceProvider
$scribanRenderer = $instance.GetType().GetMethod('GetService').Invoke($instance, [Sitecore.XA.Foundation.Scriban.Services.IScribanTemplateRenderer])
$scribanTemplate = $scribanRenderer.Parse($testTemplate, "testTemplate")
$renderingParams = New-Object Sitecore.XA.Foundation.Mvc.Models.RenderingWebEditingParams
$templateContext = $scribanRenderer.GetTemplateContext($false, $renderingParams)
$scriptObject = New-Object Scriban.Runtime.ScriptObject
$scriptObject.Add("i_item", $item)
$templateContext.PushGlobal($scriptObject)
$scribanRenderer.Render($scribanTemplate, $templateContext)
Example: The following demonstrates how to sort item titles and generate an unordered list. The ~ was used to get rid of the extra whitespace generated by the template.
Template
{{~ titles = [] ~}}
{{~ for i_child in (sc_query i_page "query:./*[@@templatename='Primary Topic Landing']")
if ( i_child.Title != "")
titles = titles | array.add (sc_field i_child 'Title')
end
end~}}
<ul>
{{~ for i_child in titles | array.sort ~}}
<li>{{ i_child }}</li>
{{~ end ~}}
</ul>
Output
<ul>
<li>About Us</li>
<li>Consultation</li>
<li>Contact Us</li>
<li>test</li>
<li>Welcome</li>
</ul>
| Is there a way to render scriban templates without the use of SXA Rendering Variants?
I would like to do some quick prototyping of scriban templates but have found constantly changing the rendering variant and refresh the page to be more time consuming than I would like.
Is there a convenient way to render the templates from code? Perhaps using SPE?
| |
To achieve this, you can use the below regular expressions code to remove all the occurrences of \n,\r (new line) or \t (tab) from the string.
string replacement = Regex.Replace(s, @"\t|\n|\r", "");
So, in your code, you can use it like below:
foreach (DataColumn column in dt.Columns)
{
//Add the Data rows.
string colData= Regex.Replace(row[column.ColumnName].ToString(), @"\t|\n|\r", "");
strbld.Append(colData.Replace(",", ";") + ',');
}
| How to add a multiline text fields values in a single cell of excel in Sitecore MVC
I am using Sitecore 8.0 . We have one Export of data feature using Excel. For all the fields the data is getting exported in a cell properly ,but for the Multiline text field the text is getting shifted to a next line of the cell .
Here is the code to generate excel file data:
public static string GetCSVFile(DataTable dt)
{
//Build the CSV file data as a Comma separated string.
string csv = string.Empty;
StringBuilder strbld = new StringBuilder();
foreach (DataColumn column in dt.Columns)
{
//Add the Header row for CSV file.
strbld.Append(column.ColumnName + ',');
}
//Add new line.
strbld.Append("\r\n");
foreach (DataRow row in dt.Rows)
{
foreach (DataColumn column in dt.Columns)
{
//Add the Data rows.
strbld.Append(row[column.ColumnName].ToString().Replace(",", ";") + ',');
}
//Add new line.
strbld.Append("\r\n");
}
csv = strbld.ToString();
return csv;
}
Below is the screenshot of generated excel file for the multiline text field highlighted in yellow:
Can anyone please tell how to do place this multiline text field in a single cell .
Thanks
| |
I think it is because of caching policy of Sellable items.
Go to PlugIn.Caching.PolicySet-1.0.0.json (C:\inetpub\wwwroot\CommerceAuthoring\wwwroot\data\Environments), open it and search for SellableItem, you will notice it has Expiration set to 7200000, which is in milliseconds that means 120 minutes or 2 hours, try to reduce it and then do Bootstrap and check.
{
"$type": "Sitecore.Commerce.Core.EntityCachingPolicy, Sitecore.Commerce.Core",
"EntityFullName": "Sitecore.Commerce.Plugin.Catalog.SellableItem",
"AllowCaching": true,
"Priority": "Normal",
"Expiration": 7200000,
"HasNegativeCaching": true,
"CacheName": "SellableItems",
"EntityIdPrefix": "Entity-SellableItem"
},
| Products take 2-5 minutes to appear on site
I am working in a Sitecore Commerce 10. When I add a new product to the catalog, I can only see the new products after 2-5 minutes on the published site. Is there any way to reduce the time it takes to display the products on published site?
| |
It doesn't exist OOTB this functionality.
You need to build your own Rest API functionality to create Roles.
Please have a look on this PDF : https://doc.sitecore.com/xp/en/SdnArchive/upload/sitecore6/60/security_api_cookbook_sc60_and_later-a4.pdf and you will find how to manage roles programmatically.
| Sitecore Role creation API
Is there a Sitecore Role creation API similar to item creation ? Can I map user to roles using Sitecore REST API?
| |
There is an OOTB call that handles this now.
protected virtual bool InheritsTemplate(Item candidate, string templateIdentifier)
{
if (candidate == null || string.IsNullOrEmpty(templateIdentifier))
return false;
var t = TemplateManager.GetTemplate(candidate);
var y = TemplateManager.GetTemplate(templateIdentifier, candidate.Database);
if (y == null)
throw new Exception($"Invalid Template Identifier: \'{templateIdentifier}\'");
return t.InheritsFrom(y.ID);
}
The important parts of this code being:
// Get the template of the Item you want to check
var t = TemplateManager.GetTemplate(candidate);
// Get the template you want to check for
var y = TemplateManager.GetTemplate(templateIdentifier, candidate.Database);
// then use the OOTB call
t.InheritsFrom(y.ID)
templateIdentifier could be anything you can normally send to Sitecore; e.g. an ID or a template path user defined/common folder or whatever.
| What is the best way to check if the Item is being inherited from a template?
I am using Sitecore 10.1 and I am upgrading my code from the Sitecore 8.2 solutions.
I want to know the best practice to check if the Item is being inherited from a template? The requirement is to use a method (maybe OOTB) that should not reduce the performance. Please suggest.
| |
In one of my recent Sitecore project I had created a custom API by inheriting "System.Web.Http.ApiController". In this I used "Sitecore.Context" without any issue.
I was just calling this custom api using my Sitecore site hostname like https://local.sc.com/api/customapi
Please check this blog https://techsitecore.wordpress.com/2020/12/31/sitecore-secure-custom-api-in-sitecore/
This may help how to configure custom api.
| Sitecore Role Management customization
How to Access the sitecore.Context from my custom web api to manage the Roles? I am trying to connect to sitecore context using custom APIs.
| |
If you need Unicorn to publish to two different databases then yes, adding it to the list of TargetDatabases is the way to go.
As with anything Sitecore, I would not recommend modifying the configuration file directly, rather to patch the value in.
Also be mindful that a few compatibility issues snuck in on recent Sitecore releases, so you should aim to get onto at least Unicorn 4.1.6 to avoid any quirks in the publishing processes.
| Trying to add publishing database for Unicorn Sync when building
So I have two CD servers setup and seems like our Unicorn syncing is not completely setup because in the config it currently just has "web".
So I need to add our "web_uk" CD to this and just wanted to get your take on if this was the right way to do it or not.
Or should I switch to <web_uk>?? What is everyones thoughts, thank you!
| |
I agree NuGet Packages for Layout Services are confusing here. But You need to use sc-packages - Sitecore.LayoutService 7.1.0 here.
PM> Install-Package Sitecore.LayoutService -Version 7.1.0 -Source https://sitecore.myget.org/F/sc-packages/api/v3/index.json
This is the correct version for you. You will find below details for dll -
| Sitecore.LayoutService.dll version mismatch between NuGet and Headless Services package
On Sitecore 10.1.1, I've got Sitecore Headless Services Server XP 18.0.0 rev. 00473 installed. According to documentation, that's the correct version. The package brings Sitecore.LayoutService.dll with version 7.1.0:
Now I'd like to extend the LayoutService API. I referenced the latest available Sitecore.LayoutService NuGet pachage which has version 10.1.0. But now, when I try to reach the data via API, I receive error:
2396 11:41:16 ERROR Exception during Layout Service RenderItem (configuration: jss, item: {A843B9EF-04E4-4631-A2F0-EE4C6F2277E7})
cm_1 | Exception: System.InvalidOperationException
cm_1 | Message: Could not find type 'Sitecore.LayoutService.Serialization.Pipelines.GetFieldSerializer.GetIntegerFieldSerializer, Sitecore.LayoutService'
I checked the assembly delivered via NuGet and the type is indeed missing there. The LayoutService assembly version is 7.0.0, not 7.1.0:
Am I missing smth? How do I reference the proper 7.1 version via NuGet?
| |
By default, Sitecore services can be accessed from the local host machine only without log in (ServicesLocalOnlyPolicy). ServicesOnPolicy will allow you to log in through "/sitecore/api/ssc/auth/login" and get the necessary token/cookie depending on your setup. If you want to bypass this behavior you can add your controller to allowed controllers section.
<api>
<services>
<configuration type="Sitecore.Services.Infrastructure.Configuration.ServicesConfiguration, Sitecore.Services.Infrastructure">
<allowedControllers hint="list:AddController">
<allowedController desc="MyController">MyNamespace, MyDll</allowedController>
</allowedControllers>
</configuration>
</services>
</api>
| Sitecore services client 403 when login called from different web application
TL;DR: Sitecore services client 403 when login called from a different web application (IIS process), but not when called from Postman
PROBLEM:
RESTful Web API (web service) written in C# running on IIS/Azure (different machine than Sitecore) calling Sitecore services client. Calling the endpoint /sitecore/api/ssc/auth/login over the network via HTTP always returns HTTP status code 403 Forbidden.
To be clear: I am using the Sitecore Restful API directly. Not using JavaScript. Not using SPEAK components.
SYMPTOMS:
Calling /sitecore/api/ssc/auth/login works with Postman and a console test app I wrote to POST data. These work after I changed the "Sitecore.Services.Client.config" file from the default "ServicesLocalOnlyPolicy" to "ServicesOnPolicy".
Worked with Sitecore v8.x, but stopped working once we upgraded to Sitecore v9.x
WHAT I'VE TRIED:
Other settings changed, but have no affect, in the Sitecore services client config:
<setting name="Sitecore.Services.AllowToLoginWithHttp" value="true" />
<setting name="Sitecore.Services.AllowAnonymousUser" value="true" />
Searched Google, StackExchange, StackOverflow, and I read the Sitecore documentation ("Developer's Guide to Sitecore.Services.Client"), but no resolution.
I checked IIS logs for more detail on the 403, but nothing.
Nothing in the Sitecore logs - I don't see anything regarding this error.
What else should I check?
| |
If it happens only when you select the "Publish related items" option in the "Publish Item" dialogue, then it must be related to the deep scan feature. Starting from version 9 the deep scan setting is enabled by default.
When the deep scan feature is used, it affects publishing speed of related items. Sitecore documentation says:
The deep scan setting determines if related items are published recursively, that is, whether to publish related items of related items):
If deep scan is enabled, related items are published recursively - that is, related items of related items are also published. Deep scan is enabled by default.
If deep scan is disabled, only directly related items are published.
You can disable deep scan to reduce the number of publishing operations and improve performance.
You may want to disable the deep scan setting to revert back to the publishing logic you had in Sitecore 8.2. It can be done by adding the following config patch:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<sitecore role:define="ContentManagement">
<settings>
<setting name="Publishing.DeepScanRelatedItems" value="false"/>
</settings>
</sitecore>
</configuration>
| Sitecore 10.1 publishing stuck
We upgraded to Sitecore 10.1 from Sitecore 8.2. I am facing publishing issues.
I have migrated master database content in Sitecore 10.1. The publishing of some sites to the web database are fine. Some sites take few hours to publish but they finish successfully without any errors.
Some of the content stuck after number of items. For example, I published an item with child items (around 60 child items) and it was stuck after 46 items. There were no errors in the log and after stuck on the same 46 item, If I leave the page open for couple of hours then the page redirects to the login page. Some of the successful published items which take few hours to publish don't result in redirecting to the login page. This is just happening with the stuck items.
Its very difficult to figure out the issue because there are no failures in the log. Most of the content published fine but this is happening with very few items.
I cleared the publishing queue, restarted website several times and published the items with Smart/ Republish optons.
Any recommendations?
| |
As I can see you are using GlassMapper 5 version and in GlassMapper 5 version SitecoreContext, GlassView, GlassController are obsolete. On behalf of SitecoreContext you can Use either IRequestContext, IMvcContext or IWebFormsContext.
Or you can use SitecoreContext as well, by initializing it first then use it.
var objSitecoreContext = new SitecoreContext();
var currentPage = objSitecoreContext.GetCurrentItem<BasePage>();
It will work for you.
| SitecoreContext throwing error after Sitecore upgrade
I upgraded my dev instance from Sitecore 8.2 to Sitecore 9.3.
My upgrade was successful but I am getting errors when I am trying to access my page.
In our solution for getting the current page, we are using SitecoreContext.
Here my code:
var currentPage = SitecoreContext.GetCurrentItem<BasePage>();
and by using this code on the page I am getting the error, shown in below screenshot
We are using the following glass mapper version
<package id="Glass.Mapper.Sc.93.Core" version="5.8.171" targetFramework="net48" />
<package id="Glass.Mapper.Sc.93.Mvc" version="5.8.171" targetFramework="net48" />
| |
You can add your site to sitecore/mediaLibrary/requestProtection/ignoreSites config node.
By default in 9.1.0 that setting is in App_Config\Sitecore\CMS.Core\Sitecore.Media.RequestProtection.config
<sitecore role:require="Standalone or ContentDelivery or ContentManagement">
<mediaLibrary>
<requestProtection>
<!-- IGNORE SITES
Specifies a list of site names for which the media protection module should not sign image ULRs with a hash value. When
Sitecore processes an incoming media request for these sites, it does not check if there is a valid hash value.
-->
<ignoreSites>
<site name="shell"/>
<site name="login"/>
<site name="admin"/>
<site name="service"/>
<site name="scheduler"/>
<site name="system"/>
<site name="publisher"/>
</ignoreSites>
Make sure you add your changes via Sitecore config patch file. Something like this should do the trick:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
<sitecore role:require="Standalone or ContentDelivery or ContentManagement">
<mediaLibrary>
<requestProtection>
<ignoreSites>
<site name="my-custom-site">
<!-- I disabled media protection for my-custom-site-on-purpose -->
</site>
</ignoreSites>
</requestProtection>
</mediaLibrary>
</sitecore>
</configuration>
| Supress MediaRequestProtection errors at site level
I have a multisite setup in sitecore 9.1 and getting the below error on
ERROR MediaRequestProtection: An invalid/missing hash value was encountered. The expected hash value
I know the reason for this error and Instead we want to suppress this for one website alone. All other websites should still report in logs. Is there any config/ setup for this? Thanks in advance.
| |
I found your experience in Partner Sandbox, and as I see you have incorrect syntax in API response in Freemarker (in line 3 you have "{ <#-- Freemarker will go here --> }" that duplicates "{..}"). So just delete line 3:
1. <#-- Construct the API response using Freemarker -->
2. <#-- For your Experience to run your API tab must have, at a minimum, open and closing brackets -->
3. { <#-- Freemarker will go here --> } // DELETE this line
4.
5.{
6. "Messages":[
7. {
8. "From": {
9. "Email": "[email protected]",
10. "Name": "Test user"
11. },
12. "To": [
13. {
14. "Email": "[email protected]",
15. "Name": "test receiver"
16. }
17. ],
18. "Subject": "My first Mailjet Email!",
19. "TextPart": "Greetings from Mailjet!",
20. "HTMLPart": "<h3>Dear passenger 1, welcome to <a href=\"https://www.mailjet.com/\">Mailjet</a>!</h3><br />May the delivery force be with you!"
21. }
22. ]
23. }
| Email Trigger In sitecore CDP
In sitecore CDP ,I have created connection for send email. this connection is triggerd but status is error. can anyone suggest me the way to run this email trigger successfully?
My request is
{
"Messages": [
{
"From": {
"Email": "[email protected]",
"Name": "mymail"
},
"To": [
{
"Email": "[email protected]",
"Name": "mymail"
}
],
"Subject": "My first Mailjet Email!",
"TextPart": "Greetings from Mailjet!",
"HTMLPart": "<h3>Dear passenger 1, welcome to <a href=\"https://www.mailjet.com/\">Mailjet</a>!</h3><br />May the delivery force be with you!"
}
]
}
Here is my response of this email trigger
"responsePayload": {
"headers": "null",
"body": "{\"body\":\"{\\n \\\"statusCode\\\" : 400,\\n \\\"reason\\\" : \\\"Bad Request\\\",\\n \\\"responseBody\\\" : {\\n \\\"ErrorIdentifier\\\" : \\\"f36854a5-0199-40c8-945b-dda96dd9c3fd\\\",\\n \\\"ErrorCode\\\" : \\\"mj-0003\\\",\\n \\\"StatusCode\\\" : 400,\\n \\\"ErrorMessage\\\" : \\\"Missing mandatory property.\\\",\\n \\\"ErrorRelatedTo\\\" : [ \\\"Messages\\\" ]\\n },\\n \\\"url\\\" : \\\"https://api.mailjet.com/v3.1/send\\\"\\n}\"}",
"statusCode": null
},
"statusCode": 400,
"errorData": "{\n \"statusCode\" : 400,\n \"reason\" : \"Bad Request\",\n \"responseBody\" : {\n \"ErrorIdentifier\" : \"f36854a5-0199-40c8-945b-dda96dd9c3fd\",\n \"ErrorCode\" : \"mj-0003\",\n \"StatusCode\" : 400,\n \"ErrorMessage\" : \"Missing mandatory property.\",\n \"ErrorRelatedTo\" : [ \"Messages\" ]\n },\n \"url\" : \"https://api.mailjet.com/v3.1/send\"\n}",
"executionTimeMs": 104,
"connectionUrl": "https://api.mailjet.com/v3.1/send",
"mappingResult": null
| |
If you go into ImageField.MediaItem getter, you'll notice that the MediaDatabase.GetItem() method uses 3 parameters including language and version:
this.mediaItem = this.MediaDatabase.GetItem(mediaId, this.MediaLanguage, this.MediaVersion);
In your test you mock another overload of the GetItem() method that uses ID only:
database.GetItem(new ID("12345678-1234-1234-1234-123456789012")).Returns(mediaItem);
So, in order to pass this particular line, you have to update the GetItem call with smth like this (I assume it does not really matter in this scenario which language/version is used so we can use any):
database.GetItem(new ID("12345678-1234-1234-1234-123456789012"),
Arg.Any<Language>(), Version.Latest).Returns(mediaItem);
| How to mock an ImageField in Sitecore using nSubstitute and xUnit
I am in the process of setting up some unit tests for a Sitecore project (using this guide as a starting point: https://www.codeflood.net/blog/2020/05/17/logicless-view-itemless-model/)
I have come across a problem when trying to mock returning an ImageField.
This is the method I would like to test:
public string GetImageUrl(Item item, string fieldName, MediaUrlBuilderOptions options = null)
{
if (item == null)
return String.Empty;
if(string.IsNullOrWhiteSpace(fieldName))
return String.Empty;
var imgField = (ImageField)item.Fields[fieldName];
if (imgField != null && imgField.MediaItem != null)
{
return (options != null) ?
HashingUtils.ProtectAssetUrl(_mediaManager.GetMediaUrl(imgField.MediaItem, options)) :
HashingUtils.ProtectAssetUrl(_mediaManager.GetMediaUrl(imgField.MediaItem));
}
return String.Empty;
}
The code I have so far works to some degree, when I make the call for item.Fields[fieldName], it returns the raw value< image mediaid='{12345678-1234-1234-1234-123456789012}' /> which casts into an ImageField. However, the MediaItem property of this ImageField is always null, thus I cant proceed to mock calling getMediaUrl.
[Fact]
public void GetImageUrl_KnownFieldName_ReturnsValue()
{
// arrange
var item = CreateItem();
SetItemField(item, "Some Known Field", "<image mediaid='{12345678-1234-1234-1234-123456789012}' />");
var mediaManager = Substitute.For<BaseMediaManager>();
var sut = new ImageTaxonomy(mediaManager);
// act
var results = sut.GetImageUrl(item, "Some Known Field");
// assert
Xunit.Assert.Equal("Desired value", results);
}
private Item CreateItem()
{
var database = Substitute.For<Database>();
var mediaItem = Substitute.For<Item>(ID.NewID, ItemData.Empty, database);
database.GetItem(new ID("12345678-1234-1234-1234-123456789012")).Returns(mediaItem);
var item = Substitute.For<Item>(ID.NewID, ItemData.Empty, database);
var fields = Substitute.For<FieldCollection>(item);
item.Fields.Returns(fields);
return item;
}
private void SetItemField(Item item, string fieldName, string fieldValue)
{
var field = Substitute.For<Field>(ID.NewID, item);
field.Value = fieldValue;
field.Database.Returns(item.Database);
item.Fields[fieldName].Returns(field);
}
As you can see I tried mocking the call to database.GetItem(), with the intent of returning the desired mediaItem, but that didnt do the trick.
Any advice on how to proceed would be much appreciated.
EDIT: Updated Solution
This is the updated code with correctly mocked media item.
Note: there is still an issue with my use of BaseMediaManager, but that will be focus of another question. (How to mock MediaManager in Sitecore using nSubstitute and xUnit)
public void GetImageUrl_KnownFieldName_ReturnsValue()
{
// arrange
var database = Substitute.For<Database>();
var item = CreateItem(database);
SetItemField(item, "Some Known Field", $"<image mediaid='{mediaItemIDString}' />");
var mediaItem = CreateMediaItem(database);
database.GetItem(mediaItemID, Arg.Any<Language>(), Sitecore.Data.Version.Latest).Returns(mediaItem);
var mediaManager = Substitute.For<BaseMediaManager>();
mediaManager.GetMediaUrl(mediaItem).Returns("/a/path/to/an/image.jpg");
var sut = new ImageTaxonomy(mediaManager);
// act
var results = sut.GetImageUrl(item, "Some Known Field");
// assert
Xunit.Assert.Equal("/a/path/to/an/image.jpg", results);
}
private Item CreateItem(Database database = null)
{
var item = Substitute.For<Item>(ID.NewID, ItemData.Empty, database);
var fields = Substitute.For<FieldCollection>(item);
item.Fields.Returns(fields);
return item;
}
private Item CreateMediaItem(Database database = null)
{
var definition = new ItemDefinition(mediaItemID, "Mock Media Item", ID.Null, ID.Null);
var data = new ItemData(definition, Language.Current, Sitecore.Data.Version.First, new FieldList());
var mediaItem = new Item(mediaItemID, data, database);
return mediaItem;
}
private void SetItemField(Item item, string fieldName, string fieldValue)
{
var field = Substitute.For<Field>(ID.NewID, item);
field.Value = fieldValue;
field.Database.Returns(item.Database);
item.Fields[fieldName].Returns(field);
}
| |
You can add role on your configuration into your patch config.
For example I created a patch config for setting up site definition for prod environment.
<site name="website1"
env:require="PROD"
role:require="ContentDelivery"
patch:before="site[@name='website']"
hostName="test.com"
targetHostName="test.com"
virtualFolder="/"
physicalFolder="/"
rootPath="/sitecore/content"
startItem="/home"
domain="extranet"
allowDebug="false"
cacheHtml="false"
htmlCacheSize="10MB"
disableClientData="false"
contentLanguage="en"
content="master"
language="en"
/>
I think this example may help to understand adding patch configuration according to environment.
In web.config we need to add these settings as well
<!-- SUPPORTED ENVIRONMENTS
Specify the environment that you want this server to perform. A server can perform single environment. The supported environments are:
LOCAL
DEV
TEST
STAGE
PROD
Default value: Local
-->
<add key="env:define" value="PROD" />
| Adding a patch config file ONLY to my production server
I have another question where I needed to add another target database to my sync in unicorn. However I only need the patch to take affect in my production environment since my local errors out on the unicorn sync since I don't need the target database on local. So my DBs are web and web_uk but they are only on production environments. Is there any way I can get around the error on local environments?
| |
Change
mediaManager.GetMediaUrl(mediaItem).Returns("/a/path/to/an/image.jpg");
to
mediaManager.GetMediaUrl(Arg.Is<MediaItem>(mi => mi.ID == mediaItem.ID)).Returns("/a/path/to/an/image.jpg");
Looks like there happens something with object references in the background so that's not the same object anymore and in result the equality comparer thinks it's a different object.
| How to mock MediaManager in Sitecore using nSubstitute and xUnit
I am in the process of setting up some unit tests for a Sitecore project (using this guide as a starting point: https://www.codeflood.net/blog/2020/05/17/logicless-view-itemless-model/)
I have come across a problem when trying to mock call MediaManager.GetMediaUrl(MediaItem).
This is the method I would like to test:
public string GetImageUrl(Item item, string fieldName, MediaUrlBuilderOptions options = null)
{
if (item == null)
return String.Empty;
if(string.IsNullOrWhiteSpace(fieldName))
return String.Empty;
var imgField = (ImageField)item.Fields[fieldName];
if (imgField != null && imgField.MediaItem != null)
{
return (options != null) ?
HashingUtils.ProtectAssetUrl(MediaManager.GetMediaUrl(imgField.MediaItem, options)) :
HashingUtils.ProtectAssetUrl(MediaManager.GetMediaUrl(imgField.MediaItem));
}
return String.Empty;
}
I have tried updating the code to pass in BaseMediaManager through DI:
public ImageTaxonomy(BaseMediaManager mediaManager)
{
Assert.ArgumentNotNull(mediaManager, "mediaManager");
_mediaManager = mediaManager;
}
...
_mediaManager.GetMediaUrl(imgField.MediaItem)
And then used the following nSubstitute code in my unit test:
var mediaItem = CreateMediaItem(database);
var mediaManager = Substitute.For<BaseMediaManager>();
mediaManager.GetMediaUrl(mediaItem).Returns("/a/path/to/an/image.jpg");
var sut = new ImageTaxonomy(mediaManager);
...
private Item CreateMediaItem(Database database = null)
{
var definition = new ItemDefinition(mediaItemID, "Mock Media Item", ID.Null, ID.Null);
var data = new ItemData(definition, Language.Current, Sitecore.Data.Version.First, new FieldList());
var mediaItem = new Item(mediaItemID, data, database);
return mediaItem;
}
However the call to _mediaManager.GetMediaUrl(imgField.MediaItem) always returns an empty string.
I am guessing the reason is, I shouldnt be mocking the BaseMediaManager class, as it doesnt contain virtual members? Even though this Sitecore page indicates that it should be virtual (https://doc.sitecore.com/xp/en/developers/93/sitecore-experience-manager/build-item-and-media-urls.html).
If that is indeed the case, how would you normally approach creating unit tests for cases that call the GetMediaUrl() function? I would have thought this is quite a common scenario to test.
Note: this is a continuation on from this previous question (which has more info on unit test being carried out): How to mock an ImageField in Sitecore using nSubstitute and xUnit
| |
PageOrMediaPredicate
If you check Settings item under your SXA site root, you will find 2 fields there: Associated Media and Associated Content.
If PageOrMediaPredicate is used on your site, only items (or media) selected in those 2 fields will be returned in search results. For content items there is another requirement: they must inherit from _Searchable or _SearchableWithoutRelatedItems template.
LatestVersionPredicate
It must be the latest version of an item. From what I remember, for web database it's always true, but best check on your own.
LanguagePredicate
You pass a list of language names. Only versions of items in one of the languages are returned.
GeolocationPredicate
If I understand it correctly, it returns items which are points of interests and which are selected in Associated Content setting (see above)
| What is PageOrMediaPredicate and other Predicate in Sitecore SXA search library
We have customized SXA search in our project. There are few predicates from SearchService of Sitecore.XA.Foundation.Search dll used.
To enhance the performance I was trying to cache query to avoid database latency (since data hardly change) and suddenly PageOrMediaPredicate predicate stopped fetching data. I reverted my changes and it worked again.
There is something wrong when I get query from cache. I am completely blank about what that predicate does. I went to declaration (in meta) but there is no comment explaining it. I literally found only one page in google search this predicate and that doesn't explain it either. Do someone know what these predicates are?
PageOrMediaPredicate
LatestVersionPredicate
LanguagePredicate
GeolocationPredicate
As a new Sitecore developer I don't know where to find explanations for such thing, is there any developer's guide available where they have explained all libraries?
Update If I debug the query that is fetching data from cache it shows same number of results but where query.WherePageOrMediaPredicate(searchQueryModel.Site)) is called, it gives no data. searchQueryModel.Site is null in both cases, when it works and when it doesn't.
| |
Leading up to this installation, I recalled that I had some trouble getting previous prerequisites installed; specifically those mentioned here.
Even more specifically:
Adding IIS via “Add / Remove Features” dialog
Installing Web Deploy 3.6 for Hosting Servers (Use Web Platform Installer to install)
It turns out that due to a group policy setting on my machine, installation of .NET 3.5 was failing.
The fix is outlined here:
Temporarily bypass WSUS server using the following registry edit (requires administrator privileges).
Right-click Start, and click Run
Type regedit.exe and click OK
Go to the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU
In the right-pane, if the value named UseWUServer exists, set its data to 0
Exit the Registry Editor
Restart the Windows Update service or restart the PC.
After performing these actions I was able to install everything necessary without any more errors.
| Sitecore 9.3 SIA Prerequisites Installation Fails
After completing some of the initial developer environment setup, I downloaded the Sitecore 9.3 "Graphical setup package for XP Single" from here. I ran the .exe, and while attempting to install the prerequisites I saw this error (0x800f0954):
| |
This flowchart <Link here> helps make the decision in most cases on when to go for custom renderings.
In view of Maps I see your need to make the fields UnShared which would still fall into the category of Datasource customization as it is never a good practice to change the XA templates in first place.
It is ok to create a new template copy and then create a new Map Localized Rendering (cloned) with one edit on Datasource Template to point to your new template.
Keeping this simple not only gives benefit to extend the Maps to serve your purpose but also keeps your upgrades safe and easy serving the sxa core purpose of reusability and speed to production.(although not DRY :))
| Best practice to create a template similar to existing but with different "Shared" value
I am using SXA Map component on my page and using one template "Office POI". This template have shared fields like Street, City, Pin etc. Items created on this template works perfectly on Map but now I have a requirement where I need to show offices in different component and this component should support multilingual POIs. Since existing template have shared field it can't create multilingual POIs so I am considering to create a new template with fields that are not shared. I can duplicate existing template and uncheck Shared checkbox but that looks like violating "DRY" principle. Is there any better way to create such template?
| |
You can use something really simple if you not have many items :
$itemsWithMatchingDefaultWorkflow = Get-Item -Path master: -Query "/sitecore/media library/*[@__Workflow='{0729C93B-888A-4765-8486-8F1AE86A3894}']"
foreach ($item in $itemsWithMatchingDefaultWorkflow)
{
Write-Host " -" $item.ID $item.Paths.FullPath
}
If you have huge amount of items I suggest to query in the search indexes.
| How do we get list of items in a workflow using powershell script
I need to get list of items/pages and all its associated contents in a workflow using the powershell script. Is there any possibility to achieve the same?
| |
I contacted the Sitecore Support who say that there is no official way to do this by now.
So we solved it manually:
Overwrite/replace the AccountInformation bar at the top and add the information if a user is admin
Core Database: /sitecore/client/Business Component Library/version 2/Layouts/Renderings/Authentications/AccountInformation
The cshtml file is virtual and can be found in Sitecore.Speak.Components.Web.dll
When using a different path for your new cshtml, you need to have a copy of the JS file found here: \sitecore\shell\client\Business Component Library\version 2\Layouts\Renderings\Authentications\AccountInformations, and name it like your cshtml
Hide the form element in the design panel by using CSS (display:none)
Show the form element in the design panel by checking the admin information in the top bar with JS and setting display:flex
CSS and JS can be found here: \sitecore\shell\client\Applications\FormsBuilder\Pages\FormDesigner
Of course this does not prevent sneaky editors from adding it to the page, but as they cannot edit it (deny rights on the template fields), it's ok for us.
| Disabling Form elements for non-administrators
We want to disable specific Form elements in Sitecore Forms for all users that aren't administrators.
I tried to do so by setting the read permission to deny on the field type (under /sitecore/system/Settings/Forms/Field Types) for the sitecore/Everyone role.
This hides the Form element from the design panel and the form itself in the forms editor, but if the user saves a form that has the element, the element gets removed.
Is there a way to just hide it from the design panel, so users cannot add it?
The editing is already disabled by setting the field write permission on the template field to deny.
| |
We had a similar challenge some time ago and we contacted Sitecore Support.
Sitecore support summary:
The Edge schema provider doesn't actually use the "fieldTypeMappings" configuration node. The field type mapping is done using a separate "IFieldTypeFactoryStore" service that is registered in "Sitecore.Services.GraphQL.EdgeContent.config". The mapping is hardcoded and doesn't depend on the configuration. The reason behind this is that the Edge preview endpoint should mirror the schema and behavior of Sitecore Experience Edge for XM. If any changes are done to the preview endpoint, it will behave differently from the actual Delivery Experience Edge endpoint which will make the development and testing unreliable.
If you don't plan to use Sitecore Experience Edge for XM, please consider creating a new GraphQL endpoint and using it instead of "edge":
https://doc.sitecore.com/xp/en/developers/hd/200/sitecore-headless-development/start-using-sitecore-graphql-api.html
This new endpoint can use the default "systemContent" which will allow you to use custom field mapping.
It means that there is no "right and clean" way to achieve what you ask for. The right way will be usage GraphQL endpoint that is based on "content", which is more extendable.
As we don't plan to use Sitecore Experience Edge for XM, we implemented our own
Sitecore.Services.GraphQL.EdgeSchema.TemplateGeneration.FieldMapping.IFieldTypeFactoryStore and added FieldMapping there. This approach works, but doesn't look great.
| Extend GraphQL schema for custom field
I'm working on a 10.2 solution with JSS & NextJS using the GraphQL (edge) endpoint. I already noticed this endpoint is sometimes quite different compared to others and now I would like to extend it. We are also using SXA and I wanted to use a treelist with tokens in the datasource so I created a custom field for that - which is pretty easy to do.
Our problem now is that the data from that field is fetched as string and not as a Multilist field (which would give us an item array). And as GraphQL is used to fetch all data that is an issue...
My first attempt was adding my field in the config (identical as the Treelist) to /sitecore/api/GraphQL/defaults/content/fieldTypeMappings/standardTypeMapping in the config as this is mentioned in the edgeContent schema provider. That doesn't work.
I did find 2 ways I can extend the schema:
Apparently all fields are added to a list and attached to a GraphType in Sitecore.Services.GraphQL.EdgeSchema.TemplateGeneration.FieldMapping.DefaultFieldTypeFactoryStore. I can create my own version of this factory and inject instead - this works but somehow I don't think this is the correct way to extend this as the class doesn't seem to be made to be extended.
I was able (as a test) to extend existing GraphType's (eg the ImageFieldGraphType) with extra properties by creating a SchemaExtender. This feels like the more official way to extend things as it is also mentioned in the SC documentation (although not for 10.2). But.. this way I managed to extend existing types, but I don't know how to tell the schema that my "Tokened Treelist" is actually just a MultilistGraphType with such an extender.
So, my question is: how can I use my custom field in the GraphQL schema as Multilist? Can this be done with a SchemaExtender, and if so - how? Should I overwrite the FieldTypeFactoryStore?
| |
This is a long known issue with Solr, where if a field is stored / has analyzers / is tokenized, it returns incorrect results. This is vaguely mentioned on the documentation here.
It was blogged about years ago by Rich Seal here who said that you can add a copyField with parameters indexed="true" stored="false" and then sort by that field.
This method works well, however it is somewhat of a pain to modify the managed schema manually for this, and then there's always the likelihood that someone will click "Populate managed schema" in Sitecore and overwrite it.
So I have updated the SmartSolrSchema module to include a sortable date computed field that you can use to quickly add any date fields that you need to sort by, which works nicely with the normal "Populate managed schema" in Sitecore.
| Sorting by date with Solr is returning an incorrect sort order
If I run a normal search query via the content search API, sorted by an indexed date field, it is not sorting the results correctly. I have checked that the sort field on the Solr managed schema is in fact a date field (pdate), and the managed schema populate is generating it as indexable=true.
What else is there to check / steps to resolve this issue?
| |
Sitecore introduced Items as Resources (IAR) in 10.1
Starting with 10.2 it was also done for SPE (because SXA moved to IAR)
You might be wondering why - because it's necessary (SXA has a dependency on SPE). You can read more about it here
Here is where problems might occur
SPE is delivered right now as:
SPE-NORMAL - regular package - items will be stored in SQL - Sitecore.PowerShell.Extensions-6.3.zip
SPE-IAR - IAR enabled package - items will be stored as *.dat files - Sitecore.PowerShell.Extensions-6.3-IAR.zip
If you pick the wrong for your case, you will have problems (missing items, broken SXA scaffolding). It happens because item provider takes items from both sources (SQL, *.dat) which might led to unpredictable results.
Rules
Here are rules you should follow when upgrading/installing SPE/SXA for 10.2+.
NO SXA
FRESH INSTALLATION - install SPE-NORMAL or SPE-IAR - IAR is better for future upgrades (no leftovers in SQL) - I recommend it,
UPGRADE - install SPE-NORMAL - installing SPE-IAR is possible but you would have to cleanup items from SQL after that. With SXA it's done by upgrade script, you would have to do similar thing.
WITH SXA - for 10.2+ SPE-IAR is a must
FRESH INSTALLATION - install SPE-IAR before SXA,
UPGRADE - install SPE-IAR before you install SXA, then after you run SXA upgrade scripts (it will cleanup items for SXA and SPE form SQL so they are consumed from *.dat files)
| Powershell Reports menu not appearing
We upgraded a Sitecore site from 9.1 to 10.2. After the upgrade we installed the latest SPE. Everything works as expected except the SPE Reports submenu; it doesn't show, even for the admin user.
We tried granting access to the Sitecore Client Authoring but that didn't help.
What debugging steps can we do to find the cause of this issue?
| |
That's the whole point of Unversioned media items. Unversioned means that there are no separate language versions. It's one shared.
If you set one in English, it will be same for any other language. If you change something in Spanish, it will be applied to all languages, including English.
If you want language specific media items, use Versioned template.
It's a bit confusing as when it comes to fields it's Shared checkbox which states whether field should have only single value shared for all languages, and Unversioned field checkbox has another meaning. Naming Unversioned for media items suggests something else. But still, this is how it works.
| Sitecore 10.0.1 Unversioned Images not rendering across languages
I created an image in Media library using Sitecore Unversioned Media Template.
After addign image in say En, if I add a diffrent image for Spanish and come back and check English image, it shows the Spanish one. Similarly all language versions of the image field is showing the same last updated language image.
| |
No big limitations but it all depends on your application. Here are some guides to help you out
https://blog.vitaliitylyk.com/guide-on-refactoring-your-sitecore-solution-to-sitecore-jss/
http://joost-sitecore.blogspot.com/2019/11/get-off-my-lawn-journey-from-sitecore.html
https://doc.sitecore.com/xp/en/developers/hd/190/sitecore-headless-development/limitations-and-workarounds-for-static-generation-of-mvc-apps-with-jss.html
| Sitecore WebForms/MVC site migration to JSS
Can somebody share known pitfalls when migrating WebForms or MVC site that uses Personalization/AB Testing/Analytics/Sitecore Forms/EXM/SXA etc. to JSS?
Any known limitations?
Sitecore versions: 9.2 and higher.
| |
I'm afraid your assumption is incorrect.
That would require an event handler which would check all the references and change other items in web database directly. And direct changes in web database are not recommended.
Otherwise, if the change (datasource removal) would happen in master database, all linking items would have to be published. And you don't know if they are really ready to be published or maybe there is some work in progress happening there.
You need to make sure your code checks if item chosen as datasource really exists. And e.g. hide component if it doesn't.
| Elapsed Datasources Remain and Return Null in Web DB
quick question. On my current project, content authors can select an expiration date for when a datasource item will become unpublishable. We are encountering an issue where once this date has elapsed, the datasource item will indeed be unpublished from the web database; however, the broken link guid will remain in the rendering component's datasource property on web (see below). This has been resulting in a null datasource error for our team.
Has anyone else encountered this? The publishing expiration date feature should be OOTB Sitecore, and thus, I'd assume should remove all links to an automatically unpublished item on web.
| |
To use a Gallery component in SXA, you need to first create a Gallery item using the Gallery template
which will look like this in the content editor Data folder:
Then you can add media items under this folder:
Select Gallery folder as data source while rendering component, it should render like this:
--------------------------------------------------- UPDATE -----------------------------------------------
If we try to add Gallery images directly from the Experience editor, then getting the same error as you reported in the original question. Seems like this is a bug in Sitecore 9.3 and from what I can see this issue is resolved in SXA 10.0 and later. As a workaround in SXA 9.3, consider either using the content editor or alternatively if you need to edit through Experience Editor, consider utilizing the Edit the related item button:
which should allow you to add or modify images and videos in the gallery.
| SXA out of the box Gallery component is not working as expected
I am using Sitecore 9.3 and SXA 9.3.
I am trying to add SXA Gallery rendering to a page but I am unable to add images from experience editor into the gallery component.
Step1: Dropped the rendering on the page
Step2: Clicked on "+" to add a gallery image. Getting the below screen after adding 1 gallery image and click save.
I am unable to add a picture from media library to Gallery Image and also unable to add more slides to gallery (gallery images). It gives a message "Image not found: #", as shown above. Unable to do anything after that from experience editor. Can anyone please help me with the same ?
| |
Simple answer is you cannot.
I believe you meant pre-optimized-min not pre-minified.
pre-optimized-min - they are not reversible. Items/files with this name were/should be created outside of Sitecore by FE developers. Read about it here. They are responsible for creating output file using preferred methods. You can think of it as single output file. What SXA/Sitecore does in this case is simply treating it like regular jss/css
[CE] When you export your site with theme you export assets (css/jss), in your case the only one you have is pre-optimized-min.
optimized-min - these are auto-generated by SXA using content of your theme (css/jss), on the same level where assets live. Read this article to find out when it will be used depending on AO options and pre-optimized-min presence.
[CE] When you export your site with theme you export assets (css/jss)
but optimized-min is skipped
| Exporting a theme in a non-minified way
When I am trying to export the theme site in Sitecore 9.3 I get the pre-minified version of css, and pre-minified version of js. How can i export the theme that would contain the normal version of the assets files such as css and js
| |
LanguageFallbackDataService was marked as obsolete in 9.3.
No replacement was provided in obsolete info.
This kb article describes a bug which is strictly related to GetDescendantsByTemplateWithFallback extension method
Replacement
I tracked how previous usages in Sitecore were updated and I found one. Here is a code example:
before
result = property.GetDescendantsByTemplateWithFallback(Templates.PropertyPageTemplateID)
after
var templateID = new TemplateID(ID.Parse(Templates.PropertyPageTemplateID));
result = property.Axes.GetDescendants().Where(i => i.TemplateID == templateID)
You can create your own extension method and put this implementation there.
Hope it helps.
| GetDescendantsByTemplateWithFallback in Sitecore 10.1
We are upgrading from Sitecore 8.2 to Sitecore 10.1.
The method GetDescendantsByTemplateWithFallback exist in Sitecore.ConentSearch.dll Version 2 but this method is missing in Sitecore.ConentSearch.dll Version 8.
property.GetDescendantsByTemplateWithFallback(Templates.PropertyPageTemplateID);
Is there any alternative to GetDescendantsByTemplateWithFallback that can be used in Sitecore 10.1?
| |
If you have a multi-line text field with multiple lines in it, lines in the value of the field are separated with \r\n line endings. When you render them in html, they will never convert automatically into <br /> tags, which means they will not cause line breaks in html.
I can only assume that you have custom processor in renderField pipeline which converts line breaks into <br /> tags. And when you call i_item.Address.raw (which is the correct approach to what you need), that pipeline is not executed as you're using raw extension.
Standard approach here would be to use Rich Text field instead of multi-line field. That would just work without any customization when calling .raw method.
What you can try instead (if you cannot change the type of your field) is calling string.replace after .raw (see https://github.com/scriban/scriban/blob/master/doc/builtins.md#stringreplace ).
Something like this should do the trick, but I haven't tested it:
{{ i_item.Address.raw | string.replace "\r\n" "<br />" }}
| Disable webedit for sc_field in Scriban?
I have a multi-line text field that I am rendering using scriban.
the Field Content is an address
some building, some floor
some street
PO box somePOboxNumber
somecountry
How can I render this field as uneditable in experience editor while keeping the line breaks intact?
I have tried sc_raw i_item "Address" and i_item.Address.raw but this renders the field as a string without the line breaks so the entire address shows in a single line.
Line breaks render correctly when I am using sc_field i_item "Address" but this is editable in experience editor.
Sitecore version: 10.1
| |
At this point it is possible to use this approach below for nextjs app if it is needed to use Sitecore capabilities:
jss start:connected
After that, you can open the home page in Experience Editor, etc.
| Current project does not support file deployment into Sitecore instance
I've created a sample nextjs app using jss cli, but when I try to deploy it using:
jss deploy app
it deploys items successfully, but not files and throws the message below:
The current project does not support file deployment into the Sitecore
instance. You should use an HTTP POST based integration for Experience
Editor support. See SDK documentation for details.
The same happens when I try to deploy files only via:
jss deploy files
But this works for react app, I'm experiencing this mentioned issue for nextjs app only.
| |
I checked SegmentDeployedEventHandler functionality and digged in the code deep enough to find that it calls IReferenceDataClient.EnsureDefinitionType.
In my case it was using ReferenceDataHttpClient to get the data from Sitecore Reference Data Service and that service site was for some reason stopped on IIS Server.
So instead of returning json response it was a 404 response from IIS.
After starting XRef site again, exception while deleting items was gone.
| 'Unexpected character encountered while parsing value' exception while deleting an item
While deleting any item in Content Editor I'm getting
Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
I checked log files and the full stack trace is as follows:
ERROR Error while deleting items
Exception: System.AggregateException
Message: One or more exceptions occurred while processing the subscribers to the 'item:deleted' event.
Source: Sitecore.Kernel
at Sitecore.Events.Event.EventSubscribers.RaiseEvent(String eventName, Object[] parameters, EventResult result)
at Sitecore.Events.Event.RaiseEvent(String eventName, Object[] parameters)
at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
at Sitecore.Data.Engines.EngineCommand`2.RaiseEvent[TArgs](EventHandler`1 handlers, Func`2 argsCreator)
at Sitecore.Data.Engines.DataEngine.RaiseDeletedItem(Item item, ID parentId, Boolean result)
at Sitecore.Data.Archiving.SqlArchive.DoArchiveItems(IEnumerable`1 items, ID archivalId)
at Sitecore.Data.DataProviders.NullRetryer.Execute[T](Func`1 action, Action recover)
at Sitecore.Data.Archiving.SqlArchive.ArchiveItem(Item item)
at Sitecore.Shell.Framework.Pipelines.DeleteItems.Delete(List`1 items)
at Sitecore.Shell.Framework.Pipelines.DeleteItems.Execute(ClientPipelineArgs args)
Nested Exception
Exception: Newtonsoft.Json.JsonReaderException
Message: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
Source: Sitecore.Xdb.Common.Web
at Sitecore.Xdb.Common.Web.Synchronous.SynchronousExtensions.SuspendContextLock[TResult](Func`1 taskFactory)
at Sitecore.ExperienceAnalytics.Core.Repositories.ReferenceData.ExperienceAnalyticsSegmentReader.GetDefinitionTypeKey()
at Sitecore.ExperienceAnalytics.Core.Repositories.ReferenceData.ExperienceAnalyticsSegmentReader.Get(Guid key, NameValueCollection readingPreferences)
at Sitecore.ExperienceAnalytics.Client.Deployment.Events.SegmentDeployedEventHandler.DeleteSegment(Item deletedItem)
at Sitecore.Events.Event.EventSubscribers.RaiseEvent(String eventName, Object[] parameters, EventResult result)
Does anyone have any idea what can be the reason?
| |
The recommended way to use facets in your search components is to define a "Taxonomy definition"
For Facets - you need a Taxonomy definition. Taxonomy definition "allows for it to be searchable as a filter/ facet or in advanced search query options on the different search pages"
After you have defined your Taxonomy item, you can then add a taxonomy relation to your entity definition (your Taxonomy definition is Parent to your Entity definition)
| Sitecore Content Hub non-taxonomy facets not visible
I've created an entity with relation to other entity (which is not a taxonomy). How can I configure search facets to search by that relation (relative entity's name in that example)?
I've tried to add facet with:
Facet type - Field
Definition - Relative
Property - Name (Relative.Name)
Also I've tried that facet (just to be sure it's not my case):
Facet type - Taxonomy
Taxonomy item - Relation (Relative)
Both ways didn't show me any facet for that relation.
| |
Yes, you will need to resolve your dependencies explicitly as shown below:
public string GetRobotsForItem()
{
var mvcContext = DependencyResolver.Current.GetService<IMvcContext >();
var homeItem = mvcContext.GetHomeItem<ISitecoreItem>();
...
...
return <some text>;
}
Hope this helps
If you getting same issue, you need to share how you are invoking this service please?
| Error processing robots.txt
I occasionally see the below error in my logs
Error processing robots.txt
Exception: Glass.Mapper.MapperExceptioMessage: Service has been disposed, cannot create object
My code in Robotservice is as below
#region Injected
//DI Implementation
private readonly IMvcContext _mvcContext;
public RobotsService(IMvcContext mvcContext)
{
_mvcContext = mvcContext;
}
#endregion
public string GetRobotsForItem()
{
var homeItem = _mvcContext.GetHomeItem<ISitecoreItem>();
...
...
return <some text>;
}
While debugging, I see that the data source is null for _mvcContext and hence Glass is complaining about this. When I searched(blogs, pages, etc) for this error, I see that DI should be implemented and is the solution for this error. But I already have DI Implemented and working in almost all scenarios. Any thoughts or ideas on this?
Thanks in Advance!
| |
We have not gone into the full editing experience, but we use APIs with security tokens to do work in Sitecore. Then use Ghost inspector to analyze the work. Whether it is a visual pixel by pixel screenshot evaluation or an json API where we interrogate the response. Finally we delete the changes and report any errors.
| Seeking Wisdom on Automated Integration Testing Through all Environments, from Local Dev to Production
I want to run tests in all of My Environments, that are not unit tests but Integration tests to confirm
Well in this case that Security is setup correctly on all items and that the users we in Roles we have designed can do all of the things...
Insert an item into a Site...
Add a Rendering...
View a node in the Content Tree...
All of these sorts of things need to Run in the actual Sitecore Context
I want to run these tests, build them, in C# and then install them into the webroot as I go up the environments and then run them in such a way that I can capture the effect in a Circle CI workflow (CI/CD) and see what is up
And also run them from my local Development Environment (from my build.ps1 script)
Had anybody done this, or does anybody have any examples or suggestions...
We are in containers so theoretically I should be able to do this in a docker file or something the way the build is done
Any experience anybody has had testing Sitecore, integration testing in the actual Sitecore context, please share as I am just not sure how to proceed here...
Thanks
Baxter
| |
Thanks @Marek, your suggestion got worked out.
Check DeviceEditor control (sitecore\shell\Applications\Layouts\DeviceEditor\DeviceEditor.xml)
Change CodeBeside to your custom class inheriting from the original Sitecore.(Shell.Applications.Layouts.DeviceEditor.DeviceEditorForm)
Overwrite OnLoad method to hide PlaceholdersTab from the DeviceEditor.xml
Here is the custom logic to restrict the access to specific role:
public class DeviceEditorForm : Sitecore.Shell.Applications.Layouts.DeviceEditor.DeviceEditorForm
{
protected override void OnLoad(EventArgs e)
{
Assert.ArgumentNotNull(e, "e");
base.OnLoad(e);
if (!Context.ClientPage.IsEvent && Sitecore.Context.User.IsInRole(ContentAuthor))
{
Placeholders.Visible = false;
}
}
}
| Need to have a Role based security access to Device Editor section at Presentation page
I need to configure Role-based access for the Placeholder settings section, how to achieve this?
Any suggestion would be helpful.
| |
Debug mode enables visibility of all the data and configuration stored in Sitecore CDP and Sitecore Personalize.
Go to the name of your tenant, then your name, then Feature Flags. There is a feature flag for debug mode that can be switched on to see the underlying data structure in the CDP.
After enabling debug mode, you will see an orange cog on most pages in the platform. You can click this orange cog to see all the data in the CDP being represented on that page.
| How can I enable debug mode in Sitecore CDP and Sitecore Personalize?
In Sitecore CDP and Sitecore Personalize, debug mode can be turned on to see all the configuration and data in the platform. How can this mode be turned on in the platform?
| |
Target Endpoint
An issue with the Target Endpoints results in a HTTP 401 unauthorised error when trying to send stream events.
The target endpoint is an input in the settings when loading the JavaScript. There are different target endpoints depending on the geographical region of the data centre where your tenant is hosted. To determine the geographical location of your tenant, go to the platform and check the URL. If the URL is ‘app.boxever.com’ then the environment is hosted in EU region. If the URL is ‘app-ap.boxever.com’ then the environment is hosted in the APJ region. If the URL is ‘app-us.boxever.com’ then the environment is hosted in the US region.
See the different target endpoints at: https://doc.sitecore.com/cdp/en/developers/sitecore-customer-data-platform--data-model-2-1/javascript-tagging-examples-for-web-pages.html
Browser Id
An issue with the Browser Id results in a HTTP 404 not found error when trying to send stream events.
The browser id must be retrieved from the platform when sending stream events.
When using the JavaScript Library:
The following function can be used to get the browser Id when using the JavaScript Library:
Boxever.getID()
For details see: https://doc.sitecore.com/cdp/en/developers/sitecore-customer-data-platform--data-model-2-1/javascript-tagging-examples-for-web-pages.html.
When sending server-side stream events:
The browser id must be retrieved from the platform when sending stream events. Please refer to the following documentation: https://doc.sitecore.com/cdp/en/developers/sitecore-customer-data-platform--data-model-2-1/create-a-browser-reference-in-sitecore-cdp.html
Browser vs Event Endpoint
When sending server side stream events, an issue with using the browser endpoint instead of the event endpoint results in a HTTP 400 bad request error when trying to send stream events.
There are two different endpoints browser, for getting the browser id, and event ,for all other stream events. For details see: https://doc.sitecore.com/cdp/en/developers/sitecore-customer-data-platform--data-model-2-1/create-a-browser-reference-in-sitecore-cdp.html and https://doc.sitecore.com/cdp/en/developers/sitecore-customer-data-platform--data-model-2-1/send-an-event-as-an-http-get-request.html
Cant find Guest in CDP
If you are successfully sending stream event (i.e. without getting an error response) but you cannot see these events in the Sitecore CDP, this may be for the following reasons:
Finding your Guest in the Sitecore CDP
To find the correct guest in the Sitecore CDP, you can search for the guest using the Browser Id. See our documentation for more details: https://sitecore.cdpknowledgehub.com/docs/web-tagging-testing-and-troubleshooting#looking-for-your-guest
Point of Sale
For a stream event to be stored in the Sitecore CDP, the point of sale (the field called ‘pos’) on the event must be a point of sale which has been setup in your tenant. See our documentation: https://doc.sitecore.com/cdp/en/users/sitecore-customer-data-platform/manage-points-of-sale-in-sitecore-cdp.html
| Why are my Sitecore CDP and Personalize stream events failing?
What are some common issues that can cause my stream events to fail?
| |
The following are some common causes of a failing batch import:
Upload file is failing
If the following error is being returned when trying to import file: “The request signature we calculated does not match the signature you provided. Check your key and signing method”, this issue is likely to be related to the checksum, size and content-Md5 values not matching the imported file. Try using the following online tools for the checksum and content-Md5:
Checksum: https://emn178.github.io/online-tools/md5_checksum.html
Content-Md5: https://base64.guru/converter/encode/hex
The status is error after the file is imported with no link to a log file
Check if the import file you are importing is GZIPPED. Import files must be GZIPPED, not ZIPPED.
The status is error after the file is imported with a link to a log file
After clicking on the error log file, the details of any errors will be shown. The error log file contains a line for each row in the import. Using the ref in the import file find the row that contains the error and read the details of the log. Generally errors are related to data model in the import file see, for the data models for orders and guests in the import files:
https://doc.sitecore.com/cdp/en/developers/sitecore-customer-data-platform--data-model-2-1/sitecore-cdp-guest-data-model-for-batch-api.html and https://doc.sitecore.com/cdp/en/developers/sitecore-customer-data-platform--data-model-2-1/sitecore-cdp-order-data-model-for-batch-api.html.
Some difficult to debug errors are:
Failed to parse import file: if the date of birth is the date
format "YYYY-MM-DDT00:00:00.000Z" not "YYYY-MM-DDT00:00:00Z"
Corrupted file: the JSON in the import file is invalid
Not enough identifying information: the identifier being used for
identity resolution in the tenant (i.e. the identity rules for the tenant) is not
being passed in the import file.
Link to github repo with Batch Import postman collection:
https://github.com/soreilly6/TechnicalTrainingCourse/blob/main/Batch%20Imports%20%26%20Audience%20Sync.postman_collection.json
| Why is my batch import for Sitecore CDP failing?
When trying to use Batch Import, if the upload fails what are some common issues that cause this?
| |
This function can be used in Advanced Page Targeting to allow an experience to trigger on every virtual page load, rather than only on full page loads. It can be used along with other page targeting functions to trigger experiences after a delay or on hover over an element etc.
(function () {
targetingPassed();
var pushState = history.pushState;
history.pushState = function() {
pushState.apply(history, arguments);
targetingPassed();
};
})();
Example of on hover, Advanced Page Targeting functions:
// Triggers the experience when user moves their mouse over the specified HTML element
(function () {
const targetElementPath = "body"; // Edit here to change to target element
let targetElement;
function waitForElement() {
targetElement = document.querySelector(targetElementPath);
if (targetElement) {
console.log(targetElement);
targetElement.addEventListener("mouseover", triggerExperience);
}
else {
setTimeout(waitForElement, 100);
}
}
function triggerExperience() {
targetingPassed();
targetElement.removeEventListener("mouseover", triggerExperience);
}
waitForElement();
})();
For more page targeting examples see our GitHub repo: https://github.com/boxever/configurations/tree/master/Web%20Experiences/Page%20Targeting
| How can I use Sitecore Personalize web experiences on single page applications?
If I want to run a Sitecore Personalize web experience (or web experiment) on a single page application, how can I achieve this?
| |
You can find the official documentation for CDP and Personalize over on the Docs site: https://doc.sitecore.com/cdp/
General Sitecore CDP resources for developers can be found on the Developer Portal here: https://developers.sitecore.com/customer-data-management/cdp
For your specific question about logging in, there are Sitecore CDP docs on doing a Log in to Sitecore CDP. They have these instructions:
If this is your first time accessing the Sitecore CDP, you'll receive an email from inviting you to join the account. If you haven't
received an email, request access from your Sitecore CDP Administrator
with the Enterprise Admin role. If you've logged into the Sitecore CDP
app before, proceed to Step 6.
Open the invitation email.
Click the Get Started button. The Sign up screen displays.
Complete the following fields:
Full name: Enter your first and last name.
New password: Enter the password you want to associate with
this account. Your password must be at least 10 characters with at
least one uppercase letter, one lowercase letter, and one number.
Confirm new password: Re-enter the password you want to
associate with this account.
Click the Sign up button.
The Login screen displays.
Enter your email address in the first field.
Select the Remember Me checkbox to save your username and password the next time you login.
Click the Next button. The password field displays if you entered the correct email address associated with your account.
Enter the password associated with your account, as shown in the following image. Your password must be at least 10 characters with at
least one uppercase letter, one lowercase letter, and one number.
Click the Login button. The Sitecore CDP homepage displays.
| How to log in or get access to Sitecore CDP instance?
I am new to Sitecore CDP. Where can I find the official documentation to help me learning it and guide on how to get access & log in to a Sitecore CDP instance?
| |
It is not currently possible to output a List from a decision model, in the settings of a programmable ‘List’ is not one of the available output Types in the settings.
If a list is returned from a programmable it will be transformed into a Map as shown below.
List returned as Map from a decision model programmable:
"output": {
"0": "list1",
"1": "list2",
"2": "list3"
},
If you are using your decision model in a Full Stack experience, you can transform the Map output of your decision model back into a List using FreeMarker.
FreeMarker for transforming decision model Map into List:
{
"list": [
<#list MyObject?keys as key>
"${MyObject[key]}"<#sep>, </#sep>
</#list>
]
}
This FreeMarker snippet can also be seen in the snippets section on the right hand side when building an API Response or Webhook in a Full Stack Experience.
Output from FreeMarker for Transformed List:
| Why can’t I output Lists from my Sitecore Personalize decision model?
Using a programmable in a Sitecore Personalize decision model, I want to return a List but List is not an available type in the dropdown.
| |
Hit policy is an option on the top right-hand corner of the decision table which determines how many rules can be simultaneously satisfied. Therefore, using hit policy your decision model can be setup to return multiple outputs or have multiple rules satisfied.
For more details on hit policy see our documentation: https://doc.sitecore.com/cdp/en/users/sitecore-cdp-and-personalize/applying-a-hit-policy-to-a-decision-table.html
Below is an example for hit policy:
The following decision table is returning a product based on gender.
Hit Policy: Unique
If the Hit Policy is set to unique this decision model will fail because more than one rule is satisfied. For a Unique hit policy only one rule can be satisfied in a decision table.
Hit Policy: First
If the Hit Policy is set to first, the first stratified rule in the decision table will be returned.
In this case the gender of the guest I am testing with is Male, so the result returned is rule 2.
Hit Policy: Any
If the Hit Policy is set to any this decision model will fail because the hit policy assumes that if two rules are true, then two results will be returning the same value.
Hit Policy: Collect List
If the Hit Policy is set to collect, there are multiple options available on how the results will be collected together. In this example I have selected list, so all the rules that successful in the decision table will be returned in a list.
In this case the gender of the guest I am testing with is Male, so the result returned is a list of rule 2 and rule 4.
Hit Policy: Rule Order
If the Hit Policy is set to Rule Order, all the rules that successful in the decision table will be returned in a list in the same order as the rules are defined in the decision table.
In this case the gender of the guest I am testing with is Male, so the result returned is a list of rule 2 and rule 4.
| How can I return multiple outputs from a Sitecore Personalize decision table?
If I am returning content, offers or products from a Sitecore Personalize decision table how can I return more than 1 content/offer/product?
| |
The following are some common causes of a failing audience sync:
Data is not mapped correctly
To ensure that the data you are trying to export exists and is mapped as expected, test your flow using workbench https://app.boxever.com/#/flows/workbench. Workbench also contains a section at the bottom called debug context, this section displays the data model that is being used for the Audience Sync.
Please note that this is the URL for the workbench if the data centre for your tenant is in Europe. If the data centre for your tenant is in APJ or the US, then the root of the URL above needs to be updated to match the URL when you are using the platform (e.g. https://app-us.boxever.com/#/flows/workbench for a US tenant).
Data is missing for one guest in the segment
After the Audience Sync runs a success and an error report file will be available in the platform when you open the Audience Sync. In the error report file, details of any errors will be included.
Segment does not exist
Ensure that the segment you are using the Audience Sync exists and is Live. Batch Segments are created and updated every 24 hours. Therefore after creating your segment, you will need to wait 24 hours until this segment can be exported. The date of when your segment will be updated can be seen in the details section of the segment in the platform. Your segment is ready to be exported when the status moves from Scheduled to Live.
For details on batch segmentation see: https://doc.sitecore.com/cdp/en/users/sitecore-customer-data-platform/introducing-batch-segmentation.html
Dataset date is incorrect
When triggering an Audience Sync manually, the dataset date needs to be included in the request. The dataset date needs to be for a date that the segment exists and has been built.
For details on triggering the Audience Sync see: https://sitecore.cdpknowledgehub.com/docs/batch-flows-best-practices. Here is a link to a github repo with a postman collection for triggering Audience Sync through the endpoints: https://github.com/soreilly6/TechnicalTrainingCourse/blob/main/Batch%20Imports%20%26%20Audience%20Sync.postman_collection.json
| Why is Sitecore CDP Audience Sync failing?
I am trying to export a segment on a regular schedule using Sitecore CDP Audience Sync. What are some common issues that can cause this to fail?
| |
Additional data can only be added to a guest in the following ways:
data extension on an guest
data extension on an order
data extension on an order item
custom event
an event with additional attributes
The overall structure of the Sitecore CDP data model (i.e. guests, sessions, events, orders, order Items) cannot be changed.
In addition to these options data can also be retrieved in real-time for decisioning or personalization from an external data system using a decision model. Link to documentation: https://doc.sitecore.com/cdp/en/users/sitecore-customer-data-platform/managing-data-systems-in-sitecore-cdp.html
Links to the documentation:
guest data extensions:
https://doc.sitecore.com/cdp/en/developers/sitecore-customer-data-platform--data-model-2-1/sending-additional-guest-data-to-sitecore-cdp-using-batch-api.html
order data extensions: (for more details see:
https://doc.sitecore.com/cdp/en/developers/sitecore-customer-data-platform--data-model-2-1/sending-additional-order-data-to-sitecore-cdp-using-batch-api.html
order item data extensions:
https://doc.sitecore.com/cdp/en/developers/sitecore-customer-data-platform--data-model-2-1/sitecore-cdp-order-item-extension-data-model-for-batch-api.html
custom events: https://doc.sitecore.com/cdp/en/developers/sitecore-customer-data-platform--data-model-2-1/send-a-custom-event-to-sitecore-cdp.html
events with additional attributes: https://doc.sitecore.com/cdp/en/developers/sitecore-customer-data-platform--data-model-2-1/send-additional-event-data-to-sitecore-cdp.html
| What additional or custom data can be stored in Sitecore CDP?
What parts of the Sitecore CDP data model are fixed? Which entities can be updated to have new additional values?
| |
Replace DescendantsOnly with ItemAndDescendants inside rules like that:
{
"name": "dictonary",
"path": "/sitecore/content/Dictionary",
"scope": "ItemAndDescendants",
"allowedPushOperations": "CreateAndUpdate",
"rules": [
{
"path": "*",
"scope": "ItemAndDescendants",
"allowedPushOperations": "CreateOnly"
}
]
}
With this config, Dictionary item will be always updated and all descendants of Dictionary will be only created and never updated
| Serialize parent as CreateAndUpdate but descendants as CreateOnly
I'm trying to serialize a parent folder as CreateAndUpdate but the descendants as CreateOnly.
I found a similar question (Sitecore Content Serialization to include parent item as create only) but the question and answer both split the includes into separate objects in the JSON file... I'd like to avoid this if possible as I don't want to screw up the existing file structure...
I've set my include/rules as follows:
{
"name": "dictonary",
"path": "/sitecore/content/Dictionary",
"scope": "ItemAndDescendants",
"allowedPushOperations": "CreateAndUpdate",
"rules": [
{
"path": "*",
"scope": "DescendantsOnly",
"allowedPushOperations": "CreateOnly"
}
]
}
Will the DescendantsOnly rule override the CreateAndUpdate allowedPushOperation from it's parent?
If not, is there a way to achieve this without splitting the include up in to separate items?
Cheers,
Dan
| |
If you want to debug TypeScript/Javascript code:
When you star jss start:connected, you will get message in the console:
Debugger listening on ws://127.0.0.1:9229/6c4c93c2-ea5e-4022-8ff6-b6fb31c7157f. It means that there is opened 9229 port, where you can attach using a debugger.
If you use Visual Studio Code, you need Run and Debug tool (Ctrl+Shift+D) and attach it to the process. For other IDEs process is the same, you need to attach to the process.
If you have a custom layout service and want to debug it when JSS app consumes it in connected mode
In Visual Studio, select Debug > Attach to Process (or press Ctrl+Alt+P). Find w3wp process and attach to it.
| Is there any way to debug Sitecore JSS connected mode?
We have developed Json rendering using existing Sitecore templates and also created JSS components from the JSS application. Somehow in between development facing some issue in code.
As a developer, looking to debug the JSS component in connected mode. Is there any way to debug, please help?
| |
Firstly, ensure you are sending identity events are described in the following documentation: https://doc.sitecore.com/cdp/en/developers/sitecore-customer-data-platform--data-model-2-1/send-an-identity-event-to-sitecore-cdp.html
If the Identity event is still not changing your visitor into a customer this is likely due to the identity rules in the tenant. If you are not sending the required identifier in the identity event, the identity event will not change the visitor into a customer.
Identity Rules
When setting up a new tenant, one of the required pieces of configuration are the identity rules. The Identity rules determine how guest profiles are merged together using a deterministic matching.
When a person interacts with your brand, the CDP compares the person to all Guest Profiles using an identifier (e.g. an email, a customer ID, a loyalty number, a phone number, etc). The identifier that is used to merge customer profiles is setup in the identity rules. Organisations can also have multiple hierarchical identity rules.
To see the identity rules that have been configured in your tenant you can go to System Settings and then Company Information. Using debug mode open the orange cog on the right hand side of the page beside the save button. In a section identityIndexConfigurations the identifiers being used or identity resolution are defined. At least one of the identifiers are defined in this section need to be included in the identity event.
Example
If the identity rules in Company Information are defined as follows:
"identityIndexConfigurations": [
{
"name": "customerID",
"fields": [
"identifiers.customerID "
]
}
]
Then an identity event with the following structure needs to be sent:
{
"channel": "WEB",
"type": "IDENTITY",
"language": "EN",
"currency": "EUR",
"page": "home page",
"pos": "retailsite123.com",
"browser_id": "56860bff-94ba-4d84-aa37-2b5a83d5411b",
"identifiers": [
{
"provider": "customerID",
"id": "abc123"
}
]
}
Please note that if you are using the Partner Sandbox, you may not have access to the Company Information tab. In Partner Sandbox the identity rules are using email, therefore the field ‘email’ needs to be sent in the identity event.
| Why is my identity event not changing my visitor into a customer in Sitecore CDP/Sitecore Personalise?
When a guest logins in I want their guest profile in Sitecore CDP to move from visitor to customer and have the profile merged with any existing matching profile.
| |
The most common reason for issues when using the Preview is if the web_flow_target hasn’t been set where the JavaScript Library is being loaded.
You need to set the web flow target in the settings where your Sitecore CDP JavaScript Library is being loaded.
// Define the Boxever queue
var _boxeverq = _boxeverq || [];
// Define the Boxever settings
var _boxever_settings = {
client_key: '{{clientKey}}', // Replace with your client key
target: '{{apiTargetEndpoint}}', // Replace with your API target endpoint specific to your data center region
cookie_domain: '{{cookieDomain}}' // Replace with the top level cookie domain of the website that is being integrated e.g ".example.com" and not "www.example.com"
web_flow_target: "https://d35vb5cccm4xzp.cloudfront.net",
pointOfSale: "{{pointOfSale}}" // Replace with the point of sale you have configured in your tenant
};
// Import the Boxever library asynchronously
(function() {
var s = document.createElement('script'); s.type = 'text/javascript'; s.async = true;
s.src = 'https://d1mj578wat5n4o.cloudfront.net/boxever-{{clientVersion}}.min.js';
var x = document.getElementsByTagName('script')[0]; x.parentNode.insertBefore(s, x);
})();
For loading the JS Library see: First of all the Sitecore CDP JavaScript Library most be loaded on the website, see https://doc.sitecore.com/cdp/en/developers/sitecore-customer-data-platform--data-model-2-1/javascript-tagging-examples-for-web-pages.html
| Why is Preview not working in my Web Experience/Experiment in Sitecore Personalize?
After creating a web experience or web experiment I want to use the Preview button to see what my content will look like on the website before going live. Why is Preview not working on my website?
| |
Code below does what you need.
You set 2 variables first
$rootPath for the root item where the script should start from
$fieldName it's the name of your rich text field which you want to update
It goes through the whole tree under rootPath, checks if the field you want to clean contains any * character (otherwise no need to proceed for sure) and uses HtmlAgilityPack library to cleanup content of the field.
Sample input:
<div>
<a href="https://www.skillcore.net" _target="blank">marek musielak</a>
<p>some text</p>
<p style="margin-right: 197.5pt;">
<span>
*<span style="letter-spacing: -0.1pt;"> </span>
*<span style="letter-spacing: -0.05pt;"> </span>*<span style="letter-spacing: -0.1pt;">
</span>*<span style="letter-spacing: -0.05pt;"> </span>*<span style="letter-spacing: -0.1pt;"> </span>* * *
<span style="letter-spacing: -0.1pt;"> </span>*<span style="letter-spacing: -0.05pt;"> </span>*
</span>
</p>
</div>
Sample output:
<div>
<a href="https://www.skillcore.net" _target="blank">marek musielak</a>
<p>some text</p>
</div>
Powershell script:
$rootPath = "master:\content\home"
$fieldName = "Text"
function RemoveAsteriskNodes {
param(
[HtmlAgilityPack.HtmlNode]$node
)
$childNodes = [System.Linq.Enumerable]::ToList($node.ChildNodes);
if ($childNodes.Count -gt 0) {
$childNode = $childNodes[$childNodes.Count - 1]
if ($childNode.InnerText.Contains("*") -and [System.Text.RegularExpressions.Regex]::IsMatch($childNode.InnerText, "^[\s*]+$")) {
$childNode.Remove();
}
else {
RemoveAsteriskNodes $childNode;
}
}
}
$items = @()
$items += Get-Item -Path $rootPath
$items += Get-ChildItem -Path $rootPath -Recurse
foreach ($item in $items) {
$fieldValue = $item[$fieldName]
if ($fieldValue.Contains("*")) {
$doc = New-Object HtmlAgilityPack.HtmlDocument
$doc.LoadHtml($fieldValue);
RemoveAsteriskNodes $doc.DocumentNode
$newFieldValue = $doc.DocumentNode.OuterHtml;
if ($fieldValue -ne $newFieldValue) {
Write-Host $item.Paths.FullPath
$item.Editing.BeginEdit()
$item[$fieldName] = $newFieldValue
$item.Editing.EndEdit() | out-null
}
}
}
| Sitecore powershell bulk edit rich text fields to remove lines
I have a bunch of items with an rich text field from which I need to remove the last line of it's content if it consists of a chain of * (the chains can vary in length, but are always composed by asterisks and there are other lines with chains of asterisks in the content that's supposed to stay).
also worth noting that in html is being rendered like so:
<p style="margin-right: 197.5pt;"><span>*<span style="letter-spacing: -0.1pt;"> </span>*<span style="letter-spacing: -0.05pt;"> </span>*<span style="letter-spacing: -0.1pt;"> </span>*<span style="letter-spacing: -0.05pt;"> </span>*<span style="letter-spacing: -0.1pt;"> </span>* * *<span style="letter-spacing: -0.1pt;"> </span>*<span style="letter-spacing: -0.05pt;"> </span>*</span></p>
All items are under the same path but the amount makes editing them manually unviable, is there a way to bulk-edit the values as a txt file (ie remove the last line if it starts with an * or something like it) using a PowerShell script?
Thanks for the help
| |
So I tracked the issue done to our Application gateway and that is the IP getting passed to the service. The answers above helped a lot with tracking this down so I appreciate the help.
If anyone has any experience with this issue of allowing the IP through please reach out, thank you!
| Sitecore IP Geolocation only works on CM, NOT CD
So I am having an issue with my Geolocation on my CD server, it only comes back with US regardless if trying it from India, Australia or anywhere. CM comes back with the correct country code. I have read through the ticket from 2018 and tried to do everything on that thread as well as I have updated what the sitecore docs have:
Analytics.PerformLookup = true
subscribed to the service we are using
Sucuri as our firewall and load balancer, I allowed both of the
service urls geoIp-ces.cloud.sitecore.net and
Discovery-ces.cloud.sitecore.net on sucuri. We have an app gateway on
azure that I havent set up anything for.
Analytics.ForwardedRequestHttpHeader = X-Forwarded-For
Is there anything else that is not setup correctly that I am missing or where I can find more settings that need updated? Like I said seems like the service is running since I get "US" back for everything but that is the broken part as well. Thank you for the help.
| |
Orders created via stream events or Batch Import can be updated using Batch Import using the UPSERT mode, the reference_id and contact on the order is used to determine which order to update.
For details on how to create order via stream events see: https://doc.sitecore.com/cdp/en/developers/sitecore-customer-data-platform--data-model-2-1/sending-orders-in-sitecore-cdp.html.
For details on how to update orders using Batch Import see: https://doc.sitecore.com/cdp/en/developers/sitecore-customer-data-platform--data-model-2-1/sitecore-cdp-order-data-model-for-batch-api.html
Related questions:
Can an order be updated using Stream events?
No an order cannot be updated using Stream events.
If you are creating an order using ADD, CONFIRM and CHECKOUT using a reference_id that already exists in the CDP, a new order will be created with a duplicate reference_id.
If you are creating an order using ORDER_CHECKOUT using a reference_id that already exists in the CDP, no new order will be created.
| How can I update orders in Sitecore CDP?
After I have created an order in Sitecore CDP how can this order be updated?
| |
To add dynamic path parameters into a connection, add the path parameter using FreeMarker. E.g. GET https://api.com/products/${productId}
An example is shown in the screen shot below
Path parameters and Decision Models
If you are using a Data System in a decision model, the path parameter can be passed in the request from the output of programmable or a decision table.
Steps:
Connect your programmable or decision to the Data System.
Setup your programmable or decision table to output the required parameter.
Below is an example of a decision table setting the product_id based
on the city of the guest.
Open your data system and enter the name of your output as the request input for your path parameter. When you start entering the name of your output, typeahead will appear based on the programmable/decision table connected to your data system.
Below is an example of the product_id being set from the output a decision table.
When your decision model runs the path parameter will now be passed in as an input from the programmable or decision table. The response from the data system can now be used for further decisioning or personalization.
| How can I use path parameters in my connection in Sitecore Personalize?
When i'm integrating with a connection that has a path parameter such as GET https://api.com/products/123 How can I setup my connection in Sitecore Personalize to pass in the product Id (e.g. 123) as a dynamic variable?
| |
The above code is for Using EditFrames in the SXA component. EditFrames in the Experience Editor is a feature that you can use to give users front-end access to fields that are not directly accessible, either because they are not visible or they are of a type that are not directly front-end editable.
In above code code, slide.Id.ToString() is your Item's ID on which you want to edit the fields, "Image" is the EditFreame button name which you can find in core database under WebEdit section-
Applications > WebEdit > and Model.Attribute is checking is component is editable or not.
See this article for reference - https://www.linkedin.com/pulse/editing-your-sitecore-experience-accelerator-sxa-list-jen-pearson/
| What this code means when I duplicate a rendering
Can someone please explain me on some example, what these lines of code means. I duplicated the rendering and now I see this code, and I am so confused by it.
What is the meaning of Html.Sxa().BeginEditFrame, and what these parameters means in general, it does not have to be precise slide.Id.ToString() and etc.
This Model.Attributes what is the meaning of it?
| |
When a triggered full stack experience/experiment is using a decision model, the decision model must return an offer. If an offer is not returned from the decision model connected to your the full stack triggered experience will fail with the error NO_DECISION.
To avoid the NO_DECISION error, return any offer from your decision model. This can be a dummy offer that is not used in your full stack triggered experience.
This is not the case for Full Stack Interactive experiences/experiments or Web experiences/experiments. For Full Stack Interactive or Web experiences a decision model can be used that is not returning an offer.
| Why is my full stack triggered experience in Sitecore Personalize failing with the error NO DECISION?
When I have created a Full Stack Triggered Experience in Sitecore Personalise that is using a Decision Model. The Full Stack Triggered Experience is failing when it is triggered with the error NO DECISION in the execution report.
| |
Sitecore recommended using SIF to reinstall the services and changing their configs to use the correct DBs. Rather than fighting against moving the services I just did that, and got it working again.
| IndexWorker database connection issue
I have a working Sitecore local site that I needed to move to a new drive.
The site comes up fine, I can log in, and it works great. I'm having trouble with the IndexWorker service.
The connection string is set up like the others, accessing a local SQL Server DB. I can use the username and password in the connection string connect to the DB and view data/tables with the credentials.
When I try starting the IndexWorker service, I see this error in my log:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) ---> System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionPool.WaitForPendingOpen()
My research says this is because the connection string is wrong, but the connection was find on the old drive. Maybe this is permissions related?
Has anyone else been through moving the services to a new drive?
Is there a way to reinstall the services without installing a whole new Sitecore instance?
| |
You had this almost correct.
Instead of checking if current version of your item is 1 (version index) you should check number of versions (and pick these where it's not equal 0)
? { $_.Versions.Count -ne 0 }
Anyway, there is much easier way to do the same:
Get-ChildItem -Path $folder -Recurse -Language "en"
With this method you get what you want without additional checks.
| How to check if item language version exists in Sitecore PowerShell?
I am trying to get a list of items which have created version in "en" language in PowerShell script. I am using the following code:
$items = Get-ChildItem -Path $folder -recurse | Where-Object { $_.Language -eq "en" -and $_.Version -eq 1}
My understanding was that if the version will be existing this is the version in "en" language so my query should work, but I see that it returns also items that do not have "en" language version created so I am confused now.
Could someone please explain how can I check if the particular language version exists in an item?
| |
Finally I was able to resolve this issue. All changes are marked with comment sections. Correct index configuration is:
<customIndexConfiguration ref="contentSearch/indexConfigurations/defaultCloudIndexConfiguration">
<initializeOnAdd>true</initializeOnAdd>
<fieldMap ref="contentSearch/indexConfigurations/defaultCloudIndexConfiguration/fieldMap" >
<fieldNames hint="raw:AddFieldByFieldName">
<!-- Configuration of fields was updated -->
<field fieldName="category" cloudFieldName="category_sm" searchable="YES" retrievable="YES" facetable="YES" filterable="YES" sortable="NO" boost="1f" type="System.GUID[]" settingType="Sitecore.ContentSearch.Azure.CloudSearchFieldConfiguration, Sitecore.ContentSearch.Azure"/>
<field fieldName="entry_date" cloudFieldName="entry_date_dt" boost="2f" type="System.DateTime" format="yyyy-MM-ddTHH:mm:ss.fffZ" searchable="YES" retrievable="YES" facetable="YES" filterable="YES" sortable="YES" settingType="Sitecore.ContentSearch.Azure.CloudSearchFieldConfiguration, Sitecore.ContentSearch.Azure"/>
</fieldNames>
</fieldMap>
<documentOptions type="Sitecore.ContentSearch.DocumentBuilderOptions, Sitecore.ContentSearch" >
<!-- Indexing of all fields was disabled -->
<indexAllFields>false</indexAllFields>
<include hint="list:AddIncludedField">
<Custom_Item>{FD160A2F-CB96-4751-A777-0E289035D61B}</Custom_Item>
<!-- Fields were added here -->
<Category>{5B96A84A-98BE-4E24-A2B0-0754500D027C}</Category>
<Entry_Date>{430D661D-01E4-4D6D-A2E0-7EA0B2653A9D}</Entry_Date>
</include>
<exclude hint="list:AddExcludedTemplate">
<patch:delete />
</exclude>
</documentOptions>
</customIndexConfiguration>
| How to migrate custom index configuration from Solr to Azure Cognitive Search?
I am trying to switch from Solr to Azure Cognitive Search in Sitecore 9.1, but for some reason my fields are not shown in custom index after migration.
Solr custom index configuration:
<customIndexConfiguration ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration">
<initializeOnAdd>false</initializeOnAdd>
<fieldMap ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration/fieldMap" >
<typeMatches hint="raw:AddTypeMatch">
<typeMatch typeName="guidCollection" type="System.Collections.Generic.List`1[System.Guid]" fieldNameFormat="{0}_sm" multiValued="true" settingType="Sitecore.ContentSearch.SolrProvider.SolrSearchFieldConfiguration, Sitecore.ContentSearch.SolrProvider" />
</typeMatches>
<fieldNames hint="raw:AddFieldByFieldName">
<field fieldName="category" returnType="guidCollection" storageType="YES" indexType="TOKENIZED" vectorType="NO" boost="1f" type="System.String"/>
<field fieldName="entry_date" returnType="text" storageType="YES" indexType="TOKENIZED" vectorType="NO" boost="2f" type="System.String"/>
</fieldNames>
</fieldMap>
<fieldReaders ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration/fieldReaders"/>
<documentOptions ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration/documentOptions" >
<include hint="list:AddIncludedField">
<Custom_Item>{FD160A2F-CB96-4751-A777-0E289035D61B}</Custom_Item>
</include>
<exclude hint="list:AddExcludedTemplate">
<patch:delete />
</exclude>
</documentOptions>
</customIndexConfiguration>
Category is Multilist field of Custom_Item in sitecore, Entry Date is Datetime field of Custom_Item.
Updated Azure Custom Index config:
<customIndexConfiguration ref="contentSearch/indexConfigurations/defaultCloudIndexConfiguration">
<initializeOnAdd>true</initializeOnAdd>
<fieldMap ref="contentSearch/indexConfigurations/defaultCloudIndexConfiguration/fieldMap" >
<fieldNames hint="raw:AddFieldByFieldName">
<field fieldName="category" boost="1f" type="System.Guid[]" settingType="Sitecore.ContentSearch.Azure.CloudSearchFieldConfiguration, Sitecore.ContentSearch.Azure"/>
<field fieldName="entry_date" boost="2f" type="System.String" settingType="Sitecore.ContentSearch.Azure.CloudSearchFieldConfiguration, Sitecore.ContentSearch.Azure"/>
</fieldNames>
</fieldMap>
<documentOptions type="Sitecore.ContentSearch.DocumentBuilderOptions, Sitecore.ContentSearch" >
<include hint="list:AddIncludedField">
<Custom_Item>{FD160A2F-CB96-4751-A777-0E289035D61B}</Custom_Item>
</include>
<exclude hint="list:AddExcludedTemplate">
<patch:delete />
</exclude>
</documentOptions>
</customIndexConfiguration>
| |
Items as resources rely on the CompositeDataProvider class which was added in 10.1. As this is a "data provider" it is subject to the same caching mechanisms as other data providers- specifically the prefetch cache.
Thus, if the application is running and you add a resource file that targets an item with the same ID that has previously been loaded by Sitecore (it's in the prefetch cache) then Sitecore does not think it needs to go back to the database (i.e. resource file in this case). So to fix the problem, after adding the new resource file, recycle the app. Alternatively, clear the cache via /sitecore/admin/Cache.aspx. CORRECTION: Only an app pool recycle correctly refreshes the items.
I go into more detail regarding the Sitecore item caching flow in my blog.
Surprisingly, Sitecore does not include the App_Data\items directory in its list of watchers. Adding this directory would also solve the problem.
| Sitecore Not Showing New Item Fields in Items Resource File
I am leveraging items as resource files. While my app is running, if I try to update the *.dat file (the resource file) and then view one of the items in Content Editor, I do not see the expected field-level changes on the item.
Sitecore 10.2
Folder structure: \App_Data\items\master\myitemfile.dat
| |
Firstly, you need to run the PowerShell in Admin mode and check the path of the license file. you need to add "license.xml". As shown in below screenshot.
Hope this helps!
Thanks,
Yamini
| When creating a new solution do I have to run the .\init.ps1 command again to prepare the container environment?
I am going through the Developer Fundamentals training for Sitecore 10 on the SiteCore website. I created a solution prior to starting the training following my companies documentation. When creating that solution, I ran .\init.ps1, init2.bat, and docker-compose up -d. As I am going through the training, getting-started-template, I ran this command .\init.ps1 -InitEnv -LicenseXmlPath "<path to your license.xml file>" -AdminPassword "<your Sitecore administrator password>" My powershell appears to be stuck at this part, Created a new local CA at "C:\Users\theRestOfMyPath". I don't know if it is stuck because a certificate was already created the first time I ran the command for the other solution. Do I just open a new Administrator Powershell window and run the rest of the commands?
| |
to make a field empty you can do it using:
$item.Editing.BeginEdit()
$item["__Workflow state"]=""
$item.Editing.EndEdit()
| How we can update droptree value of an item using PowerShell query
Does anyone know how to Update droptree field values through Powershell?
We have the bulk of items, which one of the field values as __Workflow state under workflow section[while we can see enable standard template].
we need to update as a state(__Workflow state) as empty for all the items. could you please suggest how we can write a query in Powershell.
$sourcepath="master:/sitecore/content/TestFolder";
$items= Get-ChildItem -path $sourcepath -Recurse
function Update-Item{
foreach($item in $items)
{
if($item.TemplateId -eq "{292FD0AD-CE76-4867-B43B-A58FC8F36530}")
{
Write-host "Updating Item Name and AGE:" $item.ID "";
$rawIds = [Sitecore.Data.Fields.ReferenceField]$item.Fields["__Workflow state"]
$item.Editing.BeginEdit()
$item.Editing.EndEdit()
}
}
$items = Update-Item
Close-Window
| |
Solution: The issue was resolved by disabling TLS 1.3 over TCP.
New-Item 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Server'
-Force | Out-Null
New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Server'
-name 'Enabled' -value '0' -PropertyType 'DWord' -Force | Out-Null
New-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Server'
-name 'DisabledByDefault' -value 1 -PropertyType 'DWord' -Force | Out-Null
| Failed to start the Marketing Automation Engine service - Sitecore 10 installation failed on Windows 11
Failed to start the Marketing Automation Engine service - Sitecore 10 installation failed on Windows 11
Starting Marketing Automation Engine...
2022-02-07 15:54:34 ERR Error initializing XConnect client.
System.AggregateException: One or more errors occurred. ---> Sitecore.XConnect.XdbCollectionUnavailableException: An error occurred while sending the request. ---> Sitecore.Xdb.Common.Web.ConnectionTimeoutException: A task was canceled. ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
| |
Below are some common issues that cause a CHECKOUT event to fail, resulting in no order being created in Sitecore CDP/Sitecore Personalize.
item_id is in the CONFIRM event, but there is no corresponding ADD event for this item id. For example, if in CONFIRM event, products
with item id ITEM_1, ITEM_2 and ITEM_3 are included. Then
there should be a corresponding ADD event for each with item_id
ITEM_1, ITEM_2 and ITEM_3. If an ADD event is missing for one
of these item_ids in the CONFIRM event, the CHECKOUT event will fail.
Missing/Invalid ADD event (check all values supplied are valid
against the API documentation, such as using strings instead of
numbers). See our documentation: https://doc.sitecore.com/cdp/en/developers/sitecore-customer-data-platform--data-model-2-1/send-an-add-event-to-sitecore-cdp.html
Missing/invalid CONFIRM event. See our documentation: https://doc.sitecore.com/cdp/en/developers/sitecore-customer-data-platform--data-model-2-1/send-a-confirm-event-to-sitecore-cdp.html
Missing/invalid CHECKOUT event . See our documentation: https://doc.sitecore.com/cdp/en/developers/sitecore-customer-data-platform--data-model-2-1/send-a-checkout-event-to-sitecore-cdp.html
For more information see our knowledge hub: https://sitecore.cdpknowledgehub.com/docs/web-tagging-testing-and-troubleshooting#orders-not-created
| Why is my CHECKOUT stream event failing in Sitecore CDP/Sitecore Personalize?
When trying to create an order in Sitecore CDP/Sitecore Personalize, I am sending in an ADD, CONFIRM and CHECKOUT event but my checkout event is continuously failing. Why are some reasons that a CHECKOUT event might fail?
| |
It looks like you just need to add on line one a version number, it'll default to version 1 if not present. Ex.
version: "2.4"
services:
traefik:
(obviously truncating the rest of the document).
Here's a sample of a Docker Compose file (for reference): https://github.com/Sitecore/container-deployment/blob/master/compose/sxp/10.0/ltsc2019/xp0/docker-compose.yml
| Why is there a version mismatch between my docker-compose.yml and the docker-compose.override.yml?
I am going through the tutorial, https://doc.sitecore.com/xp/en/developers/100/developer-tools/walkthrough--using-the-getting-started-template.html and am on step 7. When I run the command, .\up.ps1, I get an error Version mismatch: file .\docker-compose.yml specifies version 1 but extension file .\docker-compose.override.yml uses version 2.2. I opened both files and do not see a version number in the docker-compose.yml file. I changed the version within the .\docker-compose.override.yml to version 1 but then got an error, version in .\docker-compose.ovrride.yml is invalid. I think I need to change the version of the docker-compose.yml to be verison 2.4 but do not see a way to do that...This is what I have in the docker-compose.yml file
services:
traefik:
isolation: ${TRAEFIK_ISOLATION}
image: ${TRAEFIK_IMAGE}
command:
- "--ping"
- "--api.insecure=true"
- "--providers.docker.endpoint=npipe:////./pipe/docker_engine"
- "--providers.docker.exposedByDefault=false"
- "--providers.file.directory=C:/etc/traefik/config/dynamic"
- "--entryPoints.websecure.address=:443"
- "--entryPoints.websecure.forwardedHeaders.insecure"
ports:
- "443:443"
- "8079:8080"
healthcheck:
test: ["CMD", "traefik", "healthcheck", "--ping"]
volumes:
- source: \\.\pipe\docker_engine
target: \\.\pipe\docker_engine
type: npipe
- ./traefik:C:/etc/traefik
depends_on:
id:
condition: service_healthy
cm:
condition: service_healthy
mssql:
isolation: ${ISOLATION}
image: ${SITECORE_DOCKER_REGISTRY}nonproduction/mssql-developer:2017-${SITECORE_VERSION}
environment:
SA_PASSWORD: ${SQL_SA_PASSWORD}
ACCEPT_EULA: "Y"
ports:
- "14330:1433"
volumes:
- type: bind
source: .\mssql-data
target: c:\data
mssql-init:
isolation: ${ISOLATION}
image: ${SITECORE_DOCKER_REGISTRY}sitecore-xp1-mssql-init:${SITECORE_VERSION}
environment:
SQL_SERVER: ${SQL_SERVER}
SQL_ADMIN_LOGIN: ${SQL_SA_LOGIN}
SQL_ADMIN_PASSWORD: ${SQL_SA_PASSWORD}
SITECORE_ADMIN_PASSWORD: ${SITECORE_ADMIN_PASSWORD}
POST_DEPLOYMENT_WAIT_PERIOD: 300
healthcheck:
test: ["CMD", "powershell", "-command", "if ([System.Environment]::GetEnvironmentVariable('DatabasesDeploymentStatus', 'Machine') -eq 'Complete') { exit 0 } else { exit 1}"]
start_period: 300s
interval: 5s
depends_on:
mssql:
condition: service_healthy
solr:
isolation: ${ISOLATION}
image: ${SITECORE_DOCKER_REGISTRY}nonproduction/solr:8.8.2-${SITECORE_VERSION}
ports:
- "8984:8983"
volumes:
- type: bind
source: .\solr-data
target: c:\data
environment:
SOLR_MODE: solrcloud
healthcheck:
test: ["CMD", "powershell", "-command", "try { $$statusCode = (iwr http://solr:8983/solr/admin/cores?action=STATUS -UseBasicParsing).StatusCode; if ($$statusCode -eq 200) { exit 0 } else { exit 1} } catch { exit 1 }"]
solr-init:
isolation: ${ISOLATION}
image: ${SITECORE_DOCKER_REGISTRY}sitecore-xp0-solr-init:${SITECORE_VERSION}
environment:
SITECORE_SOLR_CONNECTION_STRING: http://solr:8983/solr
SOLR_CORE_PREFIX_NAME: ${SOLR_CORE_PREFIX_NAME}
depends_on:
solr:
condition: service_healthy
id:
isolation: ${ISOLATION}
image: ${SITECORE_DOCKER_REGISTRY}sitecore-id6:${SITECORE_VERSION}
environment:
Sitecore_Sitecore__IdentityServer__SitecoreMemberShipOptions__ConnectionString: Data Source=${SQL_SERVER};Initial Catalog=Sitecore.Core;User ID=${SQL_SA_LOGIN};Password=${SQL_SA_PASSWORD}
Sitecore_Sitecore__IdentityServer__AccountOptions__PasswordRecoveryUrl: https://${CM_HOST}/sitecore/login?rc=1
Sitecore_Sitecore__IdentityServer__Clients__PasswordClient__ClientSecrets__ClientSecret1: ${SITECORE_IDSECRET}
Sitecore_Sitecore__IdentityServer__Clients__DefaultClient__AllowedCorsOrigins__AllowedCorsOriginsGroup1: https://${CM_HOST}
Sitecore_Sitecore__IdentityServer__CertificateRawData: ${SITECORE_ID_CERTIFICATE}
Sitecore_Sitecore__IdentityServer__PublicOrigin: https://${ID_HOST}
Sitecore_Sitecore__IdentityServer__CertificateRawDataPassword: ${SITECORE_ID_CERTIFICATE_PASSWORD}
Sitecore_License: ${SITECORE_LICENSE}
healthcheck:
test: ["CMD", "pwsh", "-command", "C:/Healthchecks/Healthcheck.ps1"]
timeout: 300s
depends_on:
mssql-init:
condition: service_healthy
labels:
- "traefik.enable=true"
- "traefik.http.routers.id-secure.entrypoints=websecure"
- "traefik.http.routers.id-secure.rule=Host(`${ID_HOST}`)"
- "traefik.http.routers.id-secure.tls=true"
cm:
isolation: ${ISOLATION}
image: ${SITECORE_DOCKER_REGISTRY}sitecore-xp0-cm:${SITECORE_VERSION}
depends_on:
id:
condition: service_started
xconnect:
condition: service_started
environment:
Sitecore_ConnectionStrings_Core: Data Source=${SQL_SERVER};Initial Catalog=Sitecore.Core;User ID=${SQL_SA_LOGIN};Password=${SQL_SA_PASSWORD}
Sitecore_ConnectionStrings_Security: Data Source=${SQL_SERVER};Initial Catalog=Sitecore.Core;User ID=${SQL_SA_LOGIN};Password=${SQL_SA_PASSWORD}
Sitecore_ConnectionStrings_Master: Data Source=${SQL_SERVER};Initial Catalog=Sitecore.Master;User ID=${SQL_SA_LOGIN};Password=${SQL_SA_PASSWORD}
Sitecore_ConnectionStrings_Web: Data Source=${SQL_SERVER};Initial Catalog=Sitecore.Web;User ID=${SQL_SA_LOGIN};Password=${SQL_SA_PASSWORD}
Sitecore_ConnectionStrings_Messaging: Data Source=${SQL_SERVER};Initial Catalog=Sitecore.Messaging;User ID=${SQL_SA_LOGIN};Password=${SQL_SA_PASSWORD}
Sitecore_ConnectionStrings_Xdb.Processing.Pools: Data Source=${SQL_SERVER};Initial Catalog=Sitecore.Processing.pools;User ID=${SQL_SA_LOGIN};Password=${SQL_SA_PASSWORD}
Sitecore_ConnectionStrings_Xdb.Referencedata: Data Source=${SQL_SERVER};Initial Catalog=Sitecore.Referencedata;User ID=${SQL_SA_LOGIN};Password=${SQL_SA_PASSWORD}
Sitecore_ConnectionStrings_Xdb.Processing.Tasks: Data Source=${SQL_SERVER};Initial Catalog=Sitecore.Processing.tasks;User ID=${SQL_SA_LOGIN};Password=${SQL_SA_PASSWORD}
Sitecore_ConnectionStrings_ExperienceForms: Data Source=${SQL_SERVER};Initial Catalog=Sitecore.ExperienceForms;User ID=${SQL_SA_LOGIN};Password=${SQL_SA_PASSWORD}
Sitecore_ConnectionStrings_Exm.Master: Data Source=${SQL_SERVER};Initial Catalog=Sitecore.Exm.master;User ID=${SQL_SA_LOGIN};Password=${SQL_SA_PASSWORD}
Sitecore_ConnectionStrings_Reporting: Data Source=${SQL_SERVER};Initial Catalog=Sitecore.Reporting;User ID=${SQL_SA_LOGIN};Password=${SQL_SA_PASSWORD}
Sitecore_ConnectionStrings_Sitecore.Reporting.Client: http://xconnect
Sitecore_ConnectionStrings_Cortex.Processing.Engine: http://xconnect
Sitecore_ConnectionStrings_Solr.Search: http://solr:8983/solr;solrCloud=true
Sitecore_ConnectionStrings_SitecoreIdentity.Secret: ${SITECORE_IDSECRET}
Sitecore_ConnectionStrings_XConnect.Collection: http://xconnect
Sitecore_ConnectionStrings_Xdb.MarketingAutomation.Operations.Client: http://xconnect
Sitecore_ConnectionStrings_Xdb.MarketingAutomation.Reporting.Client: http://xconnect
Sitecore_ConnectionStrings_Xdb.ReferenceData.Client: http://xconnect
Sitecore_License: ${SITECORE_LICENSE}
Sitecore_Identity_Server_Authority: https://${ID_HOST}
Sitecore_Identity_Server_InternalAuthority: http://id
Sitecore_Identity_Server_CallbackAuthority: https://${CM_HOST}
Sitecore_Identity_Server_Require_Https: "false"
Sitecore_Analytics_Forwarded_Request_Http_Header: X-Forwarded-For
SOLR_CORE_PREFIX_NAME: ${SOLR_CORE_PREFIX_NAME}
MEDIA_REQUEST_PROTECTION_SHARED_SECRET: ${MEDIA_REQUEST_PROTECTION_SHARED_SECRET}
healthcheck:
test: ["CMD", "powershell", "-command", "C:/Healthchecks/Healthcheck.ps1"]
timeout: 300s
labels:
- "traefik.enable=true"
- "traefik.http.middlewares.force-STS-Header.headers.forceSTSHeader=true"
- "traefik.http.middlewares.force-STS-Header.headers.stsSeconds=31536000"
- "traefik.http.routers.cm-secure.entrypoints=websecure"
- "traefik.http.routers.cm-secure.rule=Host(`${CM_HOST}`)"
- "traefik.http.routers.cm-secure.tls=true"
- "traefik.http.routers.cm-secure.middlewares=force-STS-Header"
xconnect:
isolation: ${ISOLATION}
image: ${SITECORE_DOCKER_REGISTRY}sitecore-xp0-xconnect:${SITECORE_VERSION}
ports:
- "8081:80"
depends_on:
mssql-init:
condition: service_healthy
solr-init:
condition: service_started
environment:
Sitecore_License: ${SITECORE_LICENSE}
Sitecore_ConnectionStrings_Messaging: Data Source=${SQL_SERVER};Initial Catalog=Sitecore.Messaging;User ID=${SQL_SA_LOGIN};Password=${SQL_SA_PASSWORD}
Sitecore_ConnectionStrings_Processing.Engine.Storage: Data Source=${SQL_SERVER};Initial Catalog=Sitecore.Processing.Engine.Storage;User ID=${SQL_SA_LOGIN};Password=${SQL_SA_PASSWORD}
Sitecore_ConnectionStrings_Processing.Engine.Tasks: Data Source=${SQL_SERVER};Initial Catalog=Sitecore.Processing.Engine.Tasks;User ID=${SQL_SA_LOGIN};Password=${SQL_SA_PASSWORD}
Sitecore_ConnectionStrings_Reporting: Data Source=${SQL_SERVER};Initial Catalog=Sitecore.Reporting;User ID=${SQL_SA_LOGIN};Password=${SQL_SA_PASSWORD}
Sitecore_ConnectionStrings_Xdb.Marketingautomation: Data Source=${SQL_SERVER};Initial Catalog=Sitecore.Marketingautomation;User ID=${SQL_SA_LOGIN};Password=${SQL_SA_PASSWORD}
Sitecore_ConnectionStrings_Xdb.Processing.Pools: Data Source=${SQL_SERVER};Initial Catalog=Sitecore.Processing.pools;User ID=${SQL_SA_LOGIN};Password=${SQL_SA_PASSWORD}
Sitecore_ConnectionStrings_Xdb.Referencedata: Data Source=${SQL_SERVER};Initial Catalog=Sitecore.Referencedata;User ID=${SQL_SA_LOGIN};Password=${SQL_SA_PASSWORD}
Sitecore_ConnectionStrings_Collection: Data Source=${SQL_SERVER};Initial Catalog=Sitecore.Xdb.Collection.ShardMapManager;User ID=${SQL_SA_LOGIN};Password=${SQL_SA_PASSWORD}
Sitecore_ConnectionStrings_SolrCore: http://solr:8983/solr/${SOLR_CORE_PREFIX_NAME}_xdb;solrCloud=true
Sitecore_Sitecore:XConnect:CollectionSearch:Services:Solr.SolrReaderSettings:Options:RequireHttps: 'false'
Sitecore_Sitecore:XConnect:CollectionSearch:Services:XConnectSolrHealthCheckServicesConfiguration:Options:RequireHttps: 'false'
Sitecore_Sitecore:XConnect:SearchIndexer:Services:Solr.SolrReaderSettings:Options:RequireHttps: 'false'
Sitecore_Sitecore:XConnect:SearchIndexer:Services:Solr.SolrWriterSettings:Options:RequireHttps: 'false'
healthcheck:
test: ["CMD", "powershell", "-command", "C:/Healthchecks/Healthcheck.ps1"]
timeout: 300s
xdbsearchworker:
isolation: ${ISOLATION}
image: ${SITECORE_DOCKER_REGISTRY}sitecore-xp0-xdbsearchworker:${SITECORE_VERSION}
depends_on:
xconnect:
condition: service_healthy
restart: unless-stopped
environment:
Sitecore_ConnectionStrings_Collection: Data Source=${SQL_SERVER};Initial Catalog=Sitecore.Xdb.Collection.ShardMapManager;User ID=${SQL_SA_LOGIN};Password=${SQL_SA_PASSWORD}
Sitecore_ConnectionStrings_SolrCore: http://solr:8983/solr/${SOLR_CORE_PREFIX_NAME}_xdb;solrCloud=true
Sitecore_License: ${SITECORE_LICENSE}
Sitecore_Sitecore:XConnect:SearchIndexer:Services:Solr.SolrReaderSettings:Options:RequireHttps: 'false'
Sitecore_Sitecore:XConnect:SearchIndexer:Services:Solr.SolrWriterSettings:Options:RequireHttps: 'false'
Sitecore_Sitecore:XConnect:CollectionSearch:Services:XConnectSolrHealthCheckServicesConfiguration:Options:RequireHttps: 'false'
healthcheck:
test: ["CMD", "powershell", "-command", "C:/Healthchecks/Healthcheck.ps1 -Port 8080"]
timeout: 300s
xdbautomationworker:
isolation: ${ISOLATION}
image: ${SITECORE_DOCKER_REGISTRY}sitecore-xp0-xdbautomationworker:${SITECORE_VERSION}
depends_on:
xconnect:
condition: service_healthy
restart: unless-stopped
environment:
Sitecore_ConnectionStrings_XConnect.Collection: http://xconnect
Sitecore_ConnectionStrings_Xdb.Marketingautomation: Data Source=${SQL_SERVER};Initial Catalog=Sitecore.Marketingautomation;User ID=${SQL_SA_LOGIN};Password=${SQL_SA_PASSWORD}
Sitecore_ConnectionStrings_Xdb.Referencedata: Data Source=${SQL_SERVER};Initial Catalog=Sitecore.Referencedata;User ID=${SQL_SA_LOGIN};Password=${SQL_SA_PASSWORD}
Sitecore_ConnectionStrings_Messaging: Data Source=${SQL_SERVER};Initial Catalog=Sitecore.Messaging;User ID=${SQL_SA_LOGIN};Password=${SQL_SA_PASSWORD}
Sitecore_License: ${SITECORE_LICENSE}
healthcheck:
test: ["CMD", "powershell", "-command", "C:/Healthchecks/Healthcheck.ps1 -Port 8080"]
timeout: 300s
cortexprocessingworker:
isolation: ${ISOLATION}
image: ${SITECORE_DOCKER_REGISTRY}sitecore-xp0-cortexprocessingworker:${SITECORE_VERSION}
depends_on:
xconnect:
condition: service_healthy
restart: unless-stopped
environment:
Sitecore_ConnectionStrings_Processing.Engine.Storage: Data Source=${SQL_SERVER};Initial Catalog=Sitecore.Processing.Engine.Storage;User ID=${SQL_SA_LOGIN};Password=${SQL_SA_PASSWORD}
Sitecore_ConnectionStrings_Processing.Engine.Tasks: Data Source=${SQL_SERVER};Initial Catalog=Sitecore.Processing.Engine.Tasks;User ID=${SQL_SA_LOGIN};Password=${SQL_SA_PASSWORD}
Sitecore_ConnectionStrings_XConnect.Collection: http://xconnect
Sitecore_ConnectionStrings_XConnect.Configuration: http://xconnect
Sitecore_ConnectionStrings_XConnect.Search: http://xconnect
Sitecore_ConnectionStrings_Reporting: Data Source=${SQL_SERVER};Initial Catalog=Sitecore.Reporting;User ID=${SQL_SA_LOGIN};Password=${SQL_SA_PASSWORD}
Sitecore_License: ${SITECORE_LICENSE}
healthcheck:
test: ["CMD", "powershell", "-command", "C:/Healthchecks/Healthcheck.ps1 -Port 8080"]
timeout: 300s
| |
Full Stack Triggered experience/experiment
When you create a full stack Triggered experience/experiment, the Webhook Composer allows you to design the payload that will be sent to your destination (e.g. email service provider) when your triggered experience is executed.
Full Stack Interactive experience/experiment
When you create a full stack interactive experience/experiment, the API Response allows you to design the response that will be returned when a request is received for your interactive experience.
FreeMarker
In the Webhook Composer/API Response section of the experience build, the payload is shown in JSON and starts an empty body (i.e. with {}) . To add dynamic fields, such as data from the CDP or from a decision model, a markdown language called FreeMarker is used. For details on FreeMarker see: https://freemarker.apache.org/
Resources
To help you create the payload, use the panel on the right-hand side of the Webhook Composer/API Response screen. In this panel there are three tabs:
Data: This tab allows you to search for a guest in the Sitecore CDP and see all the data in the CDP against this guest. For each of these fields there is a copy button where the fields can be copied as FreeMarker. Once a field is copied as FreeMarker it will be dynamically populated when the Full Stack Experience is executed.
The data tab also shows the data from any decision models connected to the experience and the payload of the experience you are developing. If your response is not returning valid JSON an error will also be shown in this tab.
Snippets: This tab displays library of helpful FreeMarker code snippets that you can copy into your payload. Snippets are particularly helpful when using decision models with your Full Stack Experience.
Help: This tab gives links to the documentation and helpful advice.
| In Sitecore Personalize what is API Response? What is Webhook Composer? What is FreeMarker?
When creating a full stack experience (or experiment) in Sitecore Personalize, I need to write FreeMarker either an API Response or Webhook. What is FreeMarker?
| |
Experiments are for running AB tests, in which a variant is compared against a control group. Experiences are for always on personalisation or operational use cases.
In practical terms, when an experiment is created:
a control group is automatically created by the platform
the sample size can be calculated in the details tab, this sample size is used to determine when the experiment is complete and the performance results can be interpreted.
When an experience is created:
there is no control group automatically created
there is no sample size to be calculated as there is no test running
| In Sitecore Personalize, what is the difference between experiences and experiments?
I want to show some personalized content to customers using Sitecore Personalize. How can I tell whether I should be setting up an experience or an experiment? Both an experience and an experiment seem to have the same functionality.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.