output
stringlengths
34
25.7k
instruction
stringlengths
81
31k
input
stringclasses
1 value
You text contains multiple lines, but it doesn't matter when html is being rendered. What you need to do is either wrap every single line into a separate paragraph (<p>) or replace new lines with <br> tags. Here is sample code for the latter: $item[&quot;Description&quot;] = ($row.'Description' -replace &quot;`r`n&quot;, '<br>') -replace &quot;`n&quot;, '<br>' I don't know if it's both CR + LF characters or just LF so I wrote a code which should take care of both situations ( https://developer.mozilla.org/en-US/docs/Glossary/CRLF ). If you want to wrap your text in paragraphs, you need to add <p> before and </p> after your string and replace every line ending with </p><p> (assuming that your input is not html code already).
How to add space between two paragraph import from csv file through powershell script We have a field under .csv file and that field contain two paragraphs showing in one row : orem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. When we are try to insert this data from Sitecore powershell script then it does not add space between two paragraph in Rich text box. Adding code in powershell script $item.Editing.BeginEdit() $item[&quot;Description&quot;] = $row.'Description' $item.Editing.EndEdit()
Check the following script: $sourceContainer = &quot;/sitecore/content/Home/from&quot;; $destinationContainer = &quot;/sitecore/content/Home/to&quot;; function ProcessItem { param ( [Sitecore.Data.Items.Item]$item ) if((Get-Item -Path ($item.Paths.FullPath -replace $sourceContainer, $destinationContainer) -ErrorAction SilentlyContinue)) { Get-ChildItem $item.Paths.FullPath | ForEach-Object { ProcessItem -item $_ } } else { Move-Item -Path $item.ItemPath -Destination ($item.Parent.Paths.FullPath -replace $sourceContainer, $destinationContainer) } } Get-ChildItem $sourceContainer | ForEach-Object { ProcessItem -item $_ - } What it does, it checks if the item with given name already exists under destination folder. If no, it moves it with its children, otherwise it processes all the children of the source item. After execution is completed, items which were not necessary to be copied will be still there under the source folder.
PowerShell-Sitecore-Combine Folders and Files Under One Folder I have the below code working. $sourceContainer = &quot;/sitecore/content/folder/Home/Topics/To&quot;; $destinationContainer = &quot;/sitecore/content/folder/Home/Topics/From&quot;; Get-ChildItem $sourceContainer | ForEach-Object { Move-Item -Path $_.ItemPath -Destination $destinationContainer; } It carries over all the folders and files in them but will duplicate the folders vs. 1 folder with all the file that pertain to the folders. I am a PShell newbie as in first time today lol. Given this structure: Topics -From --Data ---2019 ----05 -----Page-F ---2020 ----04 -----Page ----06 -----Page -To --Data ---2019 ----05 -----Page-T ---2020 ----07 -----Page ----09 -----Page Combine outcome that I want: Topics -To --Data ---2019 ----05 -----Page-T -----Page-F ---2020 ----04 -----Page ----06 -----Page ----07 -----Page ----09 -----Page
New Relic APM agent collects data at IIS worker process level. Multiple sites running in the same Sitecore instance share the same process and for this reason their APM data is collected under the same application name. Using different New Relic APM application names for sites hosted under the same IIS web application is not possible. You can distinguish the APM data for each site enriching their transaction data with a custom attribute that can be defined and populated using the New Relic APM .NET Agent API in a custom Sitecore processor (that inherits the HttpRequestProcessor class) in the httpRequestBegin Sitecore pipeline after the ItemResolver processor is executed. This is just an example of how this processor can be implemented: class NewRelicCustomAttributesProcessor : HttpRequestProcessor { public override void Process(HttpRequestArgs args) { Item currentItem = Sitecore.Context.Item; if (currentItem == null) return; IAgent agent = NewRelic.Api.Agent.NewRelic.GetAgent(); ITransaction transaction = agent.CurrentTransaction; transaction.AddCustomAttribute(&quot;sc_site&quot;, Sitecore.Context.GetSiteName()); } } Unfortunately the New Relic APM UI doesn't have a filter based on a custom attribute for the data displayed in the OOTB charts and tables. You will need to build your own custom dashboard to display data based on a specific value of your custom attribute. Additional Note The New Relic APM .NET Agent API has a method called SetApplicationName that can be used to set the name of the APM application when the web application starts. This method is meant to be called only once in the application lifecycle (when it starts), as described in the official documentation: Updating the app name forces the agent to restart. The agent discards any unreported data associated with previous app names. Changing the app name multiple times during the lifecycle of an application is not recommended due to the associated data loss.
New Relic application monitoring data collection from Sitecore 9.3 multisite project We have Sitecore multi-site set up where 3 websites are running from single sitecore instance. In new relic we want to track monitoring data for each site individually. If websites are hosted under different root directory then it's simple but how can we achieve the same for Sitecore multisite project where multiple sites are running under same root directory. Sites count may increase to 15 as well.
I am giving you an example of few test cases to give you a gist about the way of writing the Unit Test for your Personalization Rule code: [TestMethod] public void Execute_PageContextIsNull_ThenReturnFalse() { _mockPageContext = null; var ruleStack = new RuleStack(); _sut.Evaluate(new RuleContext(), ruleStack); ruleStack.Pop().Should().Be(false); } [TestMethod] public void Execute_WhenDeliveryTypeIsCashOnDelivery_ThenReturnsTrue() { var deliveryType = DeliveryType.CashOnDelivery; _mockPageContext.Setup(x => x.basketValue).Returns(“customer-xu78yb”); _mockBasketDetailsService.Setup(x => x. GetBasket(“customer-xu78yb”)).Returns(deliveryType); var ruleStack = new RuleStack(); _sut.Evaluate(new RuleContext(), ruleStack); ruleStack.Pop().Should().Be(true); } Here is the above example you can see that Sitecore Rules WhenCondition provide two methods Evaluate and Execute. Sitecore will create RuleStack to push the result of each condition we write in Execute method and we passed the rule stack and context of our condition to Evaluate the method as a parameter. Once evaluate method will execute it will return the expected result in the stack based on the context we passed in the method. From the stack using the pop method, we can check the result with the help of Assertion. From the above two examples, you can write Unit Test for another scenario as well. I hope that helps you. See the blog post for more reference: Unit Test for Sitecore Custom Personalization Rule
Unit Test for Sitecore Personalization Rule I am working on a Unit test(MSTest) with Sitecore 9.3. I have created one personalization rule, below is the sample code: protected override bool Execute(T ruleContext) { if (_pageContext != null &amp;&amp; !string.IsNullOrWhiteSpace(_pageContext.baseketValue)) { var deliveryType = _basketDetailsService.GetBasket(_pageContext.basketValue).deliveryType; if (deliveryType != null &amp;&amp; deliveryType== DeliveryType.CashOnDelivery) { return true; } } return false; } Now I want to create a unit test for this personalization, can anyone guide me?
You need to pass domain name with a user name like below code : string domainUser = @&quot;domain\user&quot;; if (Sitecore.Security.Accounts.User.Exists(domainUser)) { Sitecore.Security.Accounts.User user = Sitecore.Security.Accounts.User.FromName(domainUser,true); user.Delete(); }
Unable to delete user programmatically in sitecore 9 i am trying to delete extranet users through code. (same functionality that is in user manager) Code: User user = User.FromName(username, true); user.Delete(); i am not getting any error but user is also not getting deleted either. any suggestions. thanks,
Item Web API is not available, you can see available downloads here: https://dev.sitecore.net/Downloads.aspx Upon further research, according to the official Sitecore documentation, Item Web API 1.2 is supported by Sitecore version 6.6 to 7.1 while Services.Client is supported by Sitecore version 7.5 and later. https://doc.sitecore.com/en/SdnArchive/Products/Sitecore%20Item%20Web%20API/SitecoreItemWebApi12/Installation.html
Is Sitecore Item Web API v1.2 still available in Sitecore 9? Have a 3rd party connector trying to use the Web API 1.2 to insert media items in to Sitecore. We are on Sitecore 9 and all the URLs are throwing a 404. The URLs start with &quot;/-/item/v1/&quot;. It looks like it was actively developed until 7.1 but was replaced by Item Web API v2. There seems to be a page for downloading the module but it doesn't work: https://doc.sitecore.com/en/SdnArchive/Products/Sitecore%20Item%20Web%20API/SitecoreItemWebApi12.html. Has it been deprecated and deleted?
Found it. In web.config had to change sameSite from None to Lax and requireSsl to False. My CD sites are not SSL. CM site is SSL so it didn't require the change.
Sitecore Form __RequestVerificationToken cookie missing I'm working on a Sitecore 10.1.0 upgrade and getting this issue where the __RequestVerificationToken cookie is not in the request. I think I had the same issue in 9.1.1 but don't recall the solution. I checked that the rendering and parents aren't cacheable.
You can try with Sitecore Powershell Extensions. Packaging with SPE - https://doc.sitecorepowershell.com/modules/packaging Then create a task scheduler to run this powershell script - https://doc.sitecorepowershell.com/modules/integration-points/tasks
How to schedule item backup? We would like to schedule a item backup(package) on specific time. Is it possible to create a package of the items while scheduling it?
Below code worked me - (able to login to public site without breaking sitecore login) public class AzureAdB2CWsFedIdentityProvider : IdentityProvidersProcessor { private readonly string Idp = &quot;idp&quot;; protected override string IdentityProviderName => &quot;AzureAdB2C&quot;; private readonly string AuthenticationType = &quot;ExternalCookie&quot;; private readonly string CookieName = &quot;.AspNet.Cookies&quot;; public AzureAdB2CWsFedIdentityProvider( FederatedAuthenticationConfiguration federatedAuthenticationConfiguration, ICookieManager cookieManager, BaseSettings settings) : base(federatedAuthenticationConfiguration, cookieManager, settings) { } protected override void ProcessCore(IdentityProvidersArgs args) { Assert.ArgumentNotNull(args, nameof(args)); List<SiteInfo> siteInfoList = Factory.GetSiteInfoList(); IEnumerable<WsFederatedSiteInfo> wsFederatedSites = siteInfoList.Select(s => new WsFederatedSiteInfo(s)) .Where(s => s.IsFederated); foreach (WsFederatedSiteInfo site in wsFederatedSites) { // NOTE [ILs] SXA allows adding multiple hostnames to be matched seperated by | foreach (string hostname in site.HostName.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries)) { args.App.UseCookieAuthentication( new CookieAuthenticationOptions() { AuthenticationType = AuthenticationType,\\updated code CookieName = CookieName, \\updated code }); args.App.UseWsFederationAuthentication(CreateOptionsFromWsSiteInfo(site)); } } } private WsFederationAuthenticationOptions CreateOptionsFromWsSiteInfo(WsFederatedSiteInfo site) { return new WsFederationAuthenticationOptions { UseTokenLifetime = true, MetadataAddress = site.MetadataAddress, Wtrealm = &quot;https://&quot; + site.Realm, Wreply = site.ReplyUrl, TokenValidationParameters = new TokenValidationParameters { NameClaimType = site.NameClaimType, ValidAudiences = new List<string> { &quot;https://&quot; + site.Realm.WithPostfix('/') } }, Notifications = new WsFederationAuthenticationNotifications() { SecurityTokenValidated = notification => HandleSecurityTokenValidated(notification, GetIdentityProvider()) } }; } private Task HandleSecurityTokenValidated(SecurityTokenValidatedNotification<WsFederationMessage, WsFederationAuthenticationOptions> notification, IdentityProvider identityProvider) { notification.AuthenticationTicket.Identity.AddClaim(new Claim(Idp, IdentityProviderName)); // transform all claims ClaimsIdentity identity = notification.AuthenticationTicket.Identity; notification.AuthenticationTicket.Identity .ApplyClaimsTransformations(new TransformationContext(FederatedAuthenticationConfiguration, identityProvider)); return Task.CompletedTask; } } Basically I added - args.App.UseCookieAuthentication( new CookieAuthenticationOptions() { AuthenticationType = &quot;ExternalCookie&quot;, CookieName = &quot;.AspNet.Cookies&quot;, });
Federated Authentication with Azure AD - Sitecore 9.3 - .Aspnet .Cookies not getting created We are using Sitecore version 9.3 for our solution. For our CD instance (the public-facing website), we need to use Azure ADB2C with OpenIdConnect for authentication. And for our Sitecore CM instance, we have to use Sitecore Identity only. Below is all the code that we have added to make this work. The authentication with the public website works fine but when we try to login to our Sitecore CM instance, we are getting an error below: Unsuccessful login with the external provider. Please help us in rectifying this issue. Processor public class AzureAdB2CIdentityProvider : IdentityProvidersProcessor { private readonly string Idp = &quot;idp&quot;; protected override string IdentityProviderName => &quot;AzureAdB2C&quot;; public AzureAdB2CIdentityProvider( FederatedAuthenticationConfiguration federatedAuthenticationConfiguration, ICookieManager cookieManager, BaseSettings settings) : base(federatedAuthenticationConfiguration, cookieManager, settings) { } protected override void ProcessCore(IdentityProvidersArgs args) { Assert.ArgumentNotNull(args, nameof(args)); List<SiteInfo> siteInfoList = Factory.GetSiteInfoList(); IEnumerable<OpenIdConnectSiteInfo> sites = siteInfoList.Select(s => new OpenIdConnectSiteInfo(s)) .Where(s => s.UsesOpenIdConnect); IEnumerable<WsFederatedSiteInfo> wsFederatedSites = siteInfoList.Select(s => new WsFederatedSiteInfo(s)) .Where(s => s.IsFederated); CookieAuthentication.ConfigureCookieAuthentication(args.App); foreach (OpenIdConnectSiteInfo site in sites) { // NOTE [ILs] SXA allows adding multiple hostnames to be matched seperated by | foreach (string hostname in site.HostName.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries)) { args.App.UseOpenIdConnectAuthentication(CreateOptionsFromOpenIdSiteInfo(site)); } } foreach (WsFederatedSiteInfo site in wsFederatedSites) { // NOTE [ILs] SXA allows adding multiple hostnames to be matched seperated by | foreach (string hostname in site.HostName.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries)) { args.App.UseWsFederationAuthentication(CreateOptionsFromWsSiteInfo(site)); } } } private WsFederationAuthenticationOptions CreateOptionsFromWsSiteInfo(WsFederatedSiteInfo site) { return new WsFederationAuthenticationOptions { UseTokenLifetime = true, MetadataAddress = site.MetadataAddress, Wtrealm = &quot;https://&quot; + site.Realm, Wreply = site.ReplyUrl, TokenValidationParameters = new TokenValidationParameters { NameClaimType = site.NameClaimType, ValidAudiences = new List<string> { &quot;https://&quot; + site.Realm.WithPostfix('/') } }, Notifications = new WsFederationAuthenticationNotifications() { SecurityTokenValidated = notification => HandleSecurityTokenValidatedWsFederated(notification, GetIdentityProvider()) } }; } private Task HandleSecurityTokenValidatedWsFederated(SecurityTokenValidatedNotification<WsFederationMessage, WsFederationAuthenticationOptions> notification, IdentityProvider identityProvider) { notification.AuthenticationTicket.Identity.AddClaim(new Claim(Idp, IdentityProviderName)); // transform all claims ClaimsIdentity identity = notification.AuthenticationTicket.Identity; notification.AuthenticationTicket.Identity .ApplyClaimsTransformations(new TransformationContext(FederatedAuthenticationConfiguration, identityProvider)); return Task.FromResult(0); } private OpenIdConnectAuthenticationOptions CreateOptionsFromOpenIdSiteInfo(OpenIdConnectSiteInfo site) { return new OpenIdConnectAuthenticationOptions() { MetadataAddress = site.Authority, RedirectUri = site.RedirectUri, PostLogoutRedirectUri = site.PostlogoutRedirectUri, ClientId = site.ClientId, TokenValidationParameters = new TokenValidationParameters { NameClaimType = site.NameClaimType, SaveSigninToken = true, }, Notifications = new OpenIdConnectAuthenticationNotifications() { AuthenticationFailed = context => HandleOpenIdConnectAuthenticationFailed(context, site), RedirectToIdentityProvider = context => HandleOpenIdConnectRedirectToIdentityProvider(context, site), SecurityTokenValidated = notification => HandleSecurityTokenValidated(notification, GetIdentityProvider()), } }; } private Task HandleSecurityTokenValidated(SecurityTokenValidatedNotification<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> notification, IdentityProvider identityProvider) { notification.AuthenticationTicket.Identity.AddClaim(new Claim(Idp, IdentityProviderName)); // transform all claims ClaimsIdentity identity = notification.AuthenticationTicket.Identity; notification.AuthenticationTicket.Identity .ApplyClaimsTransformations(new TransformationContext(FederatedAuthenticationConfiguration, identityProvider)); return Task.FromResult(0); } /* * On each call to Azure AD B2C, check if a policy (e.g. the profile edit or password reset policy) has been specified in the OWIN context. * If so, use that policy when making the call. Also, don't request a code (since it won't be needed). */ private static Task HandleOpenIdConnectRedirectToIdentityProvider(RedirectToIdentityProviderNotification<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> notification, OpenIdConnectSiteInfo site) { string policy = notification.OwinContext.Get<string>(&quot;Policy&quot;); if (!string.IsNullOrEmpty(policy) &amp;&amp; !policy.Equals(site.SignInPolicyId)) { notification.ProtocolMessage.Scope = OpenIdConnectScopes.OpenId; notification.ProtocolMessage.ResponseType = OpenIdConnectResponseTypes.IdToken; notification.ProtocolMessage.IssuerAddress = notification.ProtocolMessage.IssuerAddress.Replace(site.SignInPolicyId, policy); } return Task.FromResult(0); } private static Task HandleOpenIdConnectAuthenticationFailed(AuthenticationFailedNotification<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> context, OpenIdConnectSiteInfo site) { if (context.Exception.Message.Contains(&quot;IDX21323&quot;)) { context.HandleResponse(); context.OwinContext.Authentication.Challenge(); } else { context.HandleResponse(); Log.Fatal(context.Exception.Message, context.Exception, typeof(OpenIdConnectAuthentication)); UrlString errorUrl = new UrlString(site.ErrorUri); errorUrl.Add(&quot;message&quot;, context.Exception.Message); context.Response.Redirect(errorUrl.ToString()); } return Task.FromResult(0); } } Config <configuration xmlns:patch=&quot;http://www.sitecore.net/xmlconfig/&quot;> <sitecore> <pipelines> <owin.identityProviders> <!--This is the custom processor that gets executed when azure AD posts the token to Sitecore--> <processor type=&quot;OurProject.SC.Feature.Login.Providers.AzureAdB2CIdentityProvider, OurProject.SC.Feature.Login&quot; resolve=&quot;true&quot; id=&quot;AzureADB2C&quot; /> </owin.identityProviders> </pipelines> <services> <register serviceType=&quot;Sitecore.Abstractions.BaseAuthenticationManager, Sitecore.Kernel&quot; implementationType=&quot;Sitecore.Owin.Authentication.Security.AuthenticationManager, Sitecore.Owin.Authentication&quot; lifetime=&quot;Singleton&quot; /> <register serviceType=&quot;Sitecore.Abstractions.BaseTicketManager, Sitecore.Kernel&quot; implementationType=&quot;Sitecore.Owin.Authentication.Security.TicketManager, Sitecore.Owin.Authentication&quot; lifetime=&quot;Singleton&quot; /> <register serviceType=&quot;Sitecore.Abstractions.BasePreviewManager, Sitecore.Kernel&quot; implementationType=&quot;Sitecore.Owin.Authentication.Publishing.PreviewManager, Sitecore.Owin.Authentication&quot; lifetime=&quot;Singleton&quot; /> </services> <federatedAuthentication type=&quot;Sitecore.Owin.Authentication.Configuration.FederatedAuthenticationConfiguration, Sitecore.Owin.Authentication&quot;> <!--Provider mappings to sites--> <identityProvidersPerSites> <mapEntry name=&quot;OurProject&quot; type=&quot;Sitecore.Owin.Authentication.Collections.IdentityProvidersPerSitesMapEntry, Sitecore.Owin.Authentication&quot; resolve=&quot;true&quot;> <sites hint=&quot;list&quot;> <site>OurProject_Site_Name</site> </sites> <identityProviders hint=&quot;list:AddIdentityProvider&quot;> <identityProvider ref=&quot;federatedAuthentication/identityProviders/identityProvider[@id='AzureAdB2C']&quot;/> </identityProviders> <externalUserBuilder type=&quot;Sitecore.Owin.Authentication.Services.DefaultExternalUserBuilder, Sitecore.Owin.Authentication&quot; resolve=&quot;true&quot;> <param desc=&quot;isPersistentUser&quot;>false</param> </externalUserBuilder> </mapEntry> </identityProvidersPerSites> <!--Definitions of providers--> <identityProviders hint=&quot;list:AddIdentityProvider&quot;> <identityProvider id=&quot;AzureAdB2C&quot; type=&quot;Sitecore.Owin.Authentication.Configuration.DefaultIdentityProvider, Sitecore.Owin.Authentication&quot;> <param desc=&quot;name&quot;>AzureAdB2C</param> <param desc=&quot;domainManager&quot; type=&quot;Sitecore.Abstractions.BaseDomainManager&quot; resolve=&quot;true&quot; /> <caption>AzureAdB2C</caption> <domain>OurProject_CustomDomain</domain> <transformations hint=&quot;list:AddTransformation&quot;> <transformation name=&quot;Idp Claim&quot; type=&quot;Sitecore.Owin.Authentication.Services.SetIdpClaimTransform, Sitecore.Owin.Authentication&quot;> </transformation> <transformation name=&quot;Name Identifier Claim&quot; type=&quot;Sitecore.Owin.Authentication.Services.DefaultTransformation, Sitecore.Owin.Authentication&quot;> <sources hint=&quot;raw:AddSource&quot;> <claim name=&quot;http://schemas.microsoft.com/identity/claims/objectidentifier&quot; /> </sources> <targets hint=&quot;raw:AddTarget&quot;> <claim name=&quot;http://schemas.microsoft.com/ws/2008/06/identity/claims/role&quot; value=&quot;OurProject\Anonymous&quot;> </claim> <claim name=&quot;http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier&quot; /> </targets> <keepSource>true</keepSource> </transformation> </transformations> </identityProvider> </identityProviders> <!--List of all shared transformations--> <sharedTransformations hint=&quot;list:AddSharedClaimsTransformation&quot;> </sharedTransformations> <!--Property mappings initializer--> <propertyInitializer type=&quot;Sitecore.Owin.Authentication.Services.PropertyInitializer, Sitecore.Owin.Authentication&quot;> </propertyInitializer> </federatedAuthentication> </sitecore> </configuration> Update 1 Upon further analysis, I found out that the issue is with this statement - app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType); This is getting called inside - CookieAuthentication.ConfigureCookieAuthentication(args.App); When I comment it out, I am able to login to Sitecore but login to the public-facing site breaks. Update 2 After commenting on the code as mentioned in Update 1, I can't see &quot;.Aspnet .Cookies&quot; getting created. I only see &quot;.Aspnet .ExternalCookies&quot;. How to get &quot;.Aspnet .Cookies&quot; ? Update 3 Login Controller - [Authorize] public ActionResult Login() { // other logic to get identity information from .AspNet.Cookies and create virtual user, etc but on removing app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType); this Action is not getting hit }
Creating a Layout for EXM is not much different from creating the layout for your normal Sitecore item, To create the layout of your message template: Step 1: Create Layout in Sitecore In the Content Editor, navigate to /sitecore/Layout/Layouts/System/Email/ and insert a new layout, for example, NewsletterLayout. Notice, we have passed the view layout path, that we will create in step 2. Step 2: Create Layout view file in solution Now in your solution, create a razor view file eg. NewsletterLayout.cshtml, @using Sitecore.Mvc @using Sitecore.Mvc.Presentation @model RenderingModel <html style=&quot;opacity: 1;&quot; xmlns=&quot;http://www.w3.org/1999/xhtml&quot;> <head> <meta content=&quot;text/html; charset=utf-8&quot; http-equiv=&quot;Content-Type&quot; /> <meta content=&quot; width=device-width, initial-scale=1, maximum-scale=1&quot; name=&quot;viewport&quot; /> <meta content=&quot;IE=edge&quot; http-equiv=&quot;X-UA-Compatible&quot; /> @Html.Sitecore().Placeholder(&quot;msg-html-title&quot;) @Html.Sitecore().Placeholder(&quot;msg-html-style&quot;) </head> <body> <table bgcolor=&quot;#ffffff&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; width=&quot;100%&quot;> <tbody> <tr> <td align=&quot;center&quot;> @Html.Sitecore().Placeholder(&quot;newsletter-header&quot;) @Html.Sitecore().Placeholder(&quot;newsletter-body&quot;) @Html.Sitecore().Placeholder(&quot;footer&quot;) </td> </tr> </tbody> </table> </body> </html> Step 3: Branch Templates and Data Templates in Sitecore Now you need to create a new branch template or you can duplicate the existing ones from this path: Templates/Branches/System/Email/Messages Assign your custom layout on Message Root. Create a new data template at Templates/System/Email/Messages/Inner Content and add the required field to this template. Refer to this blog for more details.
Exm email body not allowing adding components and links in Email body I am using Simple HTML Message as the Template to create my email. Layout is Text Message Layout. It is not allowing to add components, Images or internal Links. This could be an issue of layout, if I only want to create a new Layout for email, so that the rendering and images and internal links can be added, How do I achieve that. Can anyone provide a sample cshtml for the layout. Thanks
Using the OOTB powershell scripted task schedule, you will not be able to pass the parameters from the Tasks item itself. However, there are 2 possible solutions. 1st Solution You can create a new folder that will host the parameters you want your script to have. From your PowerShell script, you will read that particular folder and then use the value stored as the parameter. For example, you create an item folder named Tasks Parameters and create an item under Tasks Parameters named My Task Parameter. The item My Task Parameter will contain a single-line text field which holds the value to pass to your PowerShell script. Note, you will need to create a template first before being able to create those. So, the pseudo code for your script will be similar to the following: From your script, Navigate to item at path `/sitecore/system/Modules/Tasks Parameters`. Reads the child item `My Task Parameter`. Retrieve the value from the field Use the value from the field as your parameter With this solution, you don't need to have any custom code development but it may be difficult to manage. 2nd Solution You will need to implement a command that will replace the PowerShell command that will trigger the task. Moreover, you will require to create your own template to hold the parameter. Then in your implementation, you can add the parameters to your script. Below are the steps: Step 1 Create a new template which holds your custom command and parameters. You just need to create the field Custom Parameters and then inherits only the Command template (Template ID: {58119A3E-560E-4DA6-97C6-1ACE8A5B1219}) The field Custom Parameters is of type Name Value List. The main reason I am using the Name Value List field type is because it allows you to easily configure more than 1 variable. Step 2 Create an item based on the new template above under the path /sitecore/system/Tasks/Commands. You may create a folder then create your command for a better content tree structure and management. Step 3 Implement your custom command so that it can reads the field Custom Parameters and pass it to the PowerShell Script. Below is my current implementation. using System.Collections.Generic; using Sitecore.Data.Fields; using Sitecore.Data.Items; using Sitecore.Tasks; using Spe; using Spe.Core.Extensions; using Spe.Core.Host; using Spe.Core.Modules; using Spe.Core.Utility; namespace Zerex.Framework.Commands { public class SpeTaskExtension { public void Update(Item[] items, CommandItem command, ScheduleItem schedule) { using (ScriptSession session = ScriptSessionManager.NewSession(&quot;Default&quot;, true)) { foreach (Item obj in items) { ProcessTaskItem(obj, command, session); } } } private static void ProcessTaskItem(Item item, CommandItem command, ScriptSession session) { if (!RulesUtils.EvaluateRules(ModuleManager.GetItemModule(item)?.GetFeatureRoot(&quot;tasks&quot;)?[Templates.ScriptLibrary.Fields.EnableRule], item)) { return; } Queue<Item> objQueue = new Queue<Item>(); objQueue.Enqueue(item); Item obj1; var parameters = (NameValueListField)command.InnerItem.Fields[&quot;Custom Parameters&quot;]; var nameValueList = Sitecore.Web.WebUtil.ParseUrlParameters(parameters.Value); var keys = nameValueList.AllKeys; while (objQueue.Count > 0 &amp;&amp; (obj1 = objQueue.Dequeue()) != null) { if (obj1.IsPowerShellScript()) { if (!string.IsNullOrWhiteSpace(obj1[Templates.Script.Fields.ScriptBody]) &amp;&amp; RulesUtils.EvaluateRules(obj1[Templates.Script.Fields.EnableRule], obj1)) { // Adding the parameters to the PS Script here foreach (var key in keys) { session.SetVariable(key, nameValueList[key]); } session.SetItemLocationContext(obj1); session.ExecuteScriptPart(obj1, true); } } else if (obj1.IsPowerShellLibrary() &amp;&amp; obj1.HasChildren &amp;&amp; RulesUtils.EvaluateRules(obj1[Templates.ScriptLibrary.Fields.EnableRule], obj1)) { foreach (Item obj2 in obj1.Children.ToArray()) { objQueue.Enqueue(obj2); } } } } } } Build and deploy the code. Step 4 You need to update the namespace of your custom command with yours and also, you need to update the scheduled item command. Testing I have created a sample script that will update the Title field of the Sample Item. Your variable name will be the same as the one you used in the command configuration item. In the example I have provided above, the variable will be productId and value. In PowerShell, it is referenced as $productId and $value. Below is the script I have used to test this approach $item = Get-Item -Path &quot;master:/sitecore/content/Home/Sample Item&quot; New-UsingBlock (New-Object Sitecore.SecurityModel.SecurityDisabler) { $item.Editing.BeginEdit() $item.Fields[&quot;Title&quot;].Value = &quot;Prod: $productId and Value: $value&quot; $item.Editing.EndEdit()| Out-Null } Outcome
How to pass parameters in Powershell scripted task scheduler? We would like to pass parameters to powershell script calling from Task scheduler option powershell scripted task schedule. Is there any functionality to pass custom parameters in powershell scripted task schedule under Task scheduler in Sitecore 9.1.1?
Internal link and General link are two different field types in Sitecore, where the Internal link is the system type field (We generally try to avoid the use of it) and the General link is a link type field. Both field stores value in different ways in Sitecore. You can see it by switching the view into raw values. Internal link stores the item path of Sitecore item - /sitecore/content/Home and General link stores value in link tag as below - <link text=&quot;&quot; anchor=&quot;&quot; linktype=&quot;internal&quot; class=&quot;&quot; title=&quot;&quot; querystring=&quot;&quot; id=&quot;{F7A54FFC-68E5-5474-8CB1-D30A6206227F}&quot; /> There may be multiple ways to not losing values after field changes here but I would suggest you, write a script or c# code to update the value of your internal link similar to the general link field, and once all the field will have general link type of value in internal link you can change the field type. You will not lose value in this way. For example- If your internal link has value like /sitecore/content/Home/test1. Your code will first get the ID of the given path item (here test1 item) using its path value in the field. Then add the ID value in the below string and update the value - <link text=&quot;&quot; anchor=&quot;&quot; linktype=&quot;internal&quot; class=&quot;&quot; title=&quot;&quot; querystring=&quot;&quot; id=&quot;Internal Link Path Item's ID&quot; /> Although this is the wrong format in the Internal link but the correct format for the General link field. It is always recommended to take a backup of the databases during these types of updates.
Change the template and retain the field value (internal link to a general link) I have a template and it is inherited. I have a field called website. I need to change the website field from internal link to a general link. When i do that, I loose all the values. How can i retain the values when i change the field from internal link to general link. I thought about this by adding another field(WebsiteTwo) in the template and copying all the values from the Website field to the WebsiteTwo field and then changing the Website field to general link and copy the values from websitetwo to website. I don't know if it is a good way of doing this. Is there a better way?
While the two errors that you experienced have the exact same error message, the reason why each error occurs is different. The error during the SIF installation occurs if you have double quote (&quot;) characters in your connection string value. From your SIF installation screenshot, it looks like you have some double quote characters wrapping the Data Source value in the connection string. The error in the manual execution of the SQL Sharding Deployment Tool command is instead occurring because the order of the input parameters is not correct, as described on the official documentation here: Different operations accept a specific set of parameters in a specific order. The /dbedition input parameter is expected by the tool as third parameter right after the /connectionstring parameter, but in your manual execution is in a different order. Also, your command is missing the /shardMapNames input parameter too. This is an example of command for the create operation: Sitecore.Xdb.Collection.Database.SqlShardingDeploymentTool.exe /operation &quot;create&quot; /connectionstring &quot;Data Source=.;user id=sa;password=12345;&quot; /dbedition &quot;Basic&quot; /shardMapManagerDatabaseName &quot;TestDatabase&quot; /shardMapNames &quot;ContactIdShardMap,DeviceProfileIdShardMap,ContactIdentifiersIndexShardMap&quot; /shardnumber 2 /shardnameprefix &quot;Shard_&quot; /shardnamesuffix &quot;_&quot; /dacpac &quot;Sitecore.Xdb.Collection.Database.Sql.dacpac&quot;
Sitecore Collection databases not created in Prod xConnect Set up using SIF While we are doing xConnect Prod set up, identified that following collection DBs are not created post SIF script execution. Missed collection DBs: 1.Xdb.Collection.Shard0 2.Xdb.Collection.Shard1 3.Xdb.Collection.ShardMapManager So did the below steps to fix the issue. 1.Removed the Processing, reporting databases which got created as part of xConnect setup 2.Removed services which are created as part of xConnect set up 3.Uninstall the set up and execute the script once again. But sill no luck. We got below exception while executing through SIF: &quot;/dbedition was not specified&quot; Error details: While running using SIF: While ran the SqlShardingDeploymentTool.exe using create command: We are doing set up for Sitecore 9.2 and On Premises set up. We are using SA account while executing scripts. Any thoughts please?
Your dockerfile is missing a command to copy the development tools and entrypoint scripts from the tooling image. You can explore your identity container and verify that the tools directory doesn't exist. Fix this adding the command COPY --from=tooling \tools\ \tools\ right after the SHELL command in your dockerfile build specs: ... SHELL [&quot;powershell&quot;, &quot;-Command&quot;, &quot;$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';&quot;] COPY --from=tooling \tools\ \tools\ ...
Deploying files to Identity Server Container I am trying to configure a non-interactive client login in a Sitecore 10 container environment (https://doc.sitecore.com/en/developers/100/developer-tools/configure-a-non-interactive-client-login.html). So I am going to have to deploy a config file to the /config folder of the identity server container. I figure this should be no big deal. I extend my docker-compose.override.xml file to support a volume/entrypoint on the id server: id: image: ${REGISTRY}${COMPOSE_PROJECT_NAME}-id:${VERSION:-latest} build: context: ./docker/build/id args: BASE_IMAGE: ${SITECORE_DOCKER_REGISTRY}sitecore-xp1-cd:${SITECORE_VERSION} TOOLING_IMAGE: ${SITECORE_TOOLS_REGISTRY}sitecore-docker-tools-assets:${TOOLS_VERSION} SOLUTION_IMAGE: ${REGISTRY}${COMPOSE_PROJECT_NAME}-solution:${VERSION:-latest} depends_on: - solution environment: Sitecore_Sitecore__IdentityServer__Clients__DefaultClient__AllowedCorsOrigins__AllowedCorsOriginsGroup2: https://${HRZ_HOST} volumes: - ${LOCAL_DEPLOY_PATH}\identity:C:\deploy entrypoint: powershell -Command &quot;&amp; C:\tools\entrypoints\worker\Development.ps1&quot; Then I extend the id dockerfile # escape=` ARG BASE_IMAGE ARG TOOLING_IMAGE ARG SOLUTION_IMAGE FROM ${SOLUTION_IMAGE} as solution FROM ${TOOLING_IMAGE} as tooling FROM ${BASE_IMAGE} SHELL [&quot;powershell&quot;, &quot;-Command&quot;, &quot;$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';&quot;] WORKDIR C:\config COPY --from=solution \artifacts\Identity\ .\ I then docker-compose build and then dock-compose up -d. Easy Peasy. But for some reason when I bring up the ID container, I get the error: &amp; : The term 'C:\tools\entrypoints\worker\Development.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 + &amp; C:\tools\entrypoints\worker\Development.ps1 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (C:\tools\entryp...Development.p s1:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException I am confused. I have the tooling image included and am using the correct powershell on the entrypoint, but it appears that the tools image is not recognized when trying to create the entrypoint. What am I missing? Thanks in advance.
When I remove the 'ui' in the sample URL it started working. Able to invoke the Sitecore Graphql using postman. URL: https://domain/api/appname/ui?sc_apikey={key} after removing 'ui' from URL URL: https://domain/api/appname?sc_apikey={key}
Can we invoke Sitecore GraphQL as API using Postman We have a requirement to get Sitecore items as invokable API using postman. Now postman is started supporting GraphQL. But when we try to invoke the Sitecore GraphQL I'm getting the error: URL: https://domain/api/appname/ui?sc_apikey={key} [HttpException]: A public action method 'ui' was not found on controller 'Sitecore.Services.GraphQL.Hosting.Mvc.GraphQLController'. at System.Web.Mvc.Controller.HandleUnknownAction(String actionName) Can anyone suggest a way to expose using postman? I know Sitecore provides a nice GraphQL UI to browse through.
The LogMonitor.exe application that is included in the Sitecore images and stored in the C:\LogMonitor folder is a Microsoft logging tool for Windows containers. This application is responsible to monitor configured log sources and to pipe a formatted output to SDTOUT output location. The tool configuration is defined in the C:\LogMonitor\LogMonitorConfig.json file. This is the default configuration taken from the sitecore-xp0-cm:10.1.1 image: { &quot;LogConfig&quot;: { &quot;sources&quot;: [ { &quot;type&quot;: &quot;EventLog&quot;, &quot;startAtOldestRecord&quot;: false, &quot;eventFormatMultiLine&quot;: false, &quot;channels&quot;: [ { &quot;name&quot;: &quot;system&quot;, &quot;level&quot;: &quot;Error&quot; } ] }, { &quot;type&quot;: &quot;File&quot;, &quot;directory&quot;: &quot;c:\\inetpub\\logs&quot;, &quot;filter&quot;: &quot;*.log&quot;, &quot;includeSubdirectories&quot;: true }, { &quot;type&quot;: &quot;File&quot;, &quot;directory&quot;: &quot;c:\\inetpub\\wwwroot\\App_data\\logs&quot;, &quot;filter&quot;: &quot;log.*.txt&quot;, &quot;includeSubdirectories&quot;: false } ] } } You need to add your own source in this configuration or modify the filter of the third source in the default configuration (filter value is &quot;log.*.txt&quot;), currently including only .txt files with a filename that starts with log., in order to include additional logging files with a different name pattern.
How to expose more than one source log file for a pod in Sitecore in AKS We are in the process of upgrading to Sitecore 10.1 and we are also changing our infrastructure to use AKS. I just noticed the the Sitecore logs we get from the pods seems to only include the logs sent through the LogFileAppender (in other words, we only see the logs from the log.{date}.{time}.txt files). We have some modules that are by default configured to log in their own files (for example Dianoga or Sitecron). When inspecting the pods, I can see their log files on disk, but the content of these files does not show in the pods logs (that we can get using the kubectl logs ${POD_NAME} command or using a tool like k9s). By changing these modules configuration so that they use the LogFileAppender works. More precisely, this works <logger name=&quot;Sitecron&quot; role:require=&quot;ContentManagement&quot;> <appender-ref ref=&quot;SitecronLogFileAppender&quot;> <patch:delete /> </appender-ref> <appender-ref ref=&quot;LogFileAppender&quot; /> </logger> but I was wondering if there is way of doing this at the pod level (or in a more Kubernetes native way). For example, if I could change the way Sitecore configures the pods to also include some other log files would be great. I hope my question is clear enough! Thanks
We have resolved the issue with help of the Sitecore support team. We have customized the below DefaultExternalUserBuilder pipeline and that caused the root cause for the Sitecore Serialization during deployment. <externalUserBuilder type=&quot;Foundation.FederatedAuthentication.Services.ExternalDomainUserBuilder, Foundation.FederatedAuthentication&quot; patch:instead=&quot;*[@type='Sitecore.Owin.Authentication.Services.DefaultExternalUserBuilder, Sitecore.Owin.Authentication']&quot; resolve=&quot;true&quot;>
When we are trying to deploy serialized items using Sitecore CLI in Devops pipeline getting error We are getting the below error only when deploying in Production env but the same DevOps pipeline works fine for lower env. Any insight? ERROR [Sitecore Identity] 'http://www.sitecore.net/identity/claims/originalIssuer' claim is missing ERROR Microsoft.Owin.Security.OAuth.OAuthBearerAuthenticationMiddleware - Authentication failed Exception: System.InvalidOperationException Message: Cannot find user builder Source: Sitecore.Owin.Authentication at Sitecore.Owin.Authentication.Services.DefaultApplicationUserResolver.d__16.MoveNext()
In case we dont get personal facet, we need to set it first. Below code worked for us. // Get contact from xConnect, update and save the facet using (XConnectClient client = Sitecore.XConnect.Client.Configuration.SitecoreXConnectClientConfiguration.GetClient()) { try { var contact = client.Get<Sitecore.XConnect.Contact>(new IdentifiedContactReference(anyIdentifier.Source, anyIdentifier.Identifier), new Sitecore.XConnect.ContactExpandOptions(PersonalInformation.DefaultFacetKey, EmailAddressList.DefaultFacetKey)); if (contact != null) { if (contact.Personal() != null) { client.SetFacet<PersonalInformation>(contact, PersonalInformation.DefaultFacetKey, contact.Personal()); } else { if (string.IsNullOrEmpty(args.PrincipalClaimsInformation.GivenName) &amp;&amp; string.IsNullOrEmpty(args.PrincipalClaimsInformation.Surname) &amp;&amp; string.IsNullOrEmpty(args.PrincipalClaimsInformation.DisplayName)) { client.SetFacet<PersonalInformation>(contact, PersonalInformation.DefaultFacetKey, new PersonalInformation() { LastName = args.PrincipalClaimsInformation.DisplayName }); } else { client.SetFacet<PersonalInformation>(contact, PersonalInformation.DefaultFacetKey, new PersonalInformation() { FirstName = args.PrincipalClaimsInformation.GivenName, LastName = args.PrincipalClaimsInformation.Surname }); } } if (contact.Emails() == null) { var prefferedEmail = new EmailAddress(args.PrincipalClaimsInformation.Email, true); var prefferedKey = &quot;Work&quot;; var emailFacet = new EmailAddressList(prefferedEmail, prefferedKey); client.SetFacet<EmailAddressList>(new FacetReference(contact, EmailAddressList.DefaultFacetKey), new EmailAddressList(new EmailAddress(&quot;&quot;, true), &quot;&quot;)); } client.Submit(); //SetPersonalInfo(session, args.PrincipalClaimsInformation); //SetEmail(session, args.PrincipalClaimsInformation.Email); // Remove contact data from shared session state - contact will be re-loaded // during subsequent request with updated facets manager.RemoveFromSession(Sitecore.Analytics.Tracker.Current.Contact.ContactId); Sitecore.Analytics.Tracker.Current.Session.Contact = manager.LoadContact(Sitecore.Analytics.Tracker.Current.Contact.ContactId); } } catch (XdbExecutionException ex) { // Manage conflicts / exceptions } }
XConnectFacets - Personal facet missing I am working in Sitecore 9.3 instance. In XConnectFacets, I can see only 3 facets while debugging (see image), I have to updated PersonalInformation of the contact but it is not showing in XConnectFacets. Can anyone please suggest a possible resolution of this issue? xConnectFacet.Facets[&quot;Personal&quot;] returns null.
For resolving similar kind of situation I used .parse() and .map() For Example: import React, { Component } from &quot;react&quot;; export class Example1 extends Component { constructor(props) { super(props); this.state = { stringData: '[&quot;1. test&quot;, &quot;2. test&quot;, &quot;3. Test&quot;]' }; } render() { // Parsed valued from string const valuesArray = JSON.parse(this.state.stringData); return ( <> <div> <h3>Using local JSON file Array</h3> <ul> {valuesArray.map(item => { return <li>{item}</li>; })} </ul> </div> </> ); } } export default Example1; Let me know if that helps
Is it possible to pass an array data type to a react component with JSS Sitecore? I am wanting to pass an array of string's into a react component with JSS Sitecore. At the moment, I am having to use CommonFieldTypes.SingleLineText in the sitecore component definition and splitting the string passed in on the ', ' to create an array within the actual React component. Is there a field type where I can pass in a string array in the yml file to the component structure without the need to then turn it into an array in the component like so? - componentName: ProgressBar fields: data: [&quot;1. test&quot;, &quot;2. test&quot;, &quot;3. Test&quot;]
The Report.ashx file is no longer used and can safely be removed. This file was used to drive the Executive Insight Dashboard that was deprecated in 8.0 Initial Release. For Sitecore XP 8.0.0 - Sitecore XP 8.2.7, remove the Report.ashx file from /sitecore/shell/ClientBin/Reporting/ folder from all your server instances. For Sitecore XP 7.5.0 - Sitecore XP 7.5.2 see the description here: https://support.sitecore.com/kb?id=kb_article_view&amp;sysparm_article=KB1000776
Can I safely remove Report.ashx file? I am on Sitecore XP 8.0.0 and found Report.ashx file in the /sitecore/shell/ClientBin/Reporting/ folder. Can I safely remove it?
You can achieve this by adding a handler to &quot;publish:itemProcessed&quot; event instead: public void YourItemProcessed(object sender, EventArgs args) { var itemProcessedEventArgs = args as ItemProcessedEventArgs; var context = itemProcessedEventArgs != null ? itemProcessedEventArgs.Context : null; if (context.Result.Operation.Equals(PublishOperation.None) || context.Result.Operation.Equals(PublishOperation.Skipped)) { return; } try { // Your logic here... } catch (Exception e) { Sitecore.Diagnostics.Log.Error($&quot;Error at publish:itemProcessed. Item ID: {context.ItemId} Name: {context.ItemName} => {e.InnerException}&quot;, this); } } Then patch it: <events> <event name=&quot;publish:itemProcessed&quot;> <handler type=&quot;Your.Project.YourItemProcrssed, Your.Project&quot; method=&quot;YourItemProcessedLogic&quot;/> </event> </events> I hope it helps you..
How to get the item currently being published from publishing pipeline I am trying to build a custom publishing pipeline in SC 9.3 where I need to do some custom operations on the items being currently published. I created a custom pipeline and the code looks like below: public class MyProcessor : PublishItemProcessor { public override void Process(PublishItemContext context) { if (context == null || context.Aborted) { return; } var item = Sitecore.Context.Item; Item sourceItem = context.PublishHelper.GetSourceItem(context.ItemId); Item targetItem = context.PublishHelper.GetTargetItem(context.ItemId); ... } } Unfortunately, I ran out of ideas on how to get the currently published item ID inside this pipeline. In the code above the item is null, and the sourceItem and targetItem return the language of the content, not the actual item that I am publishing. Could you please help and point me out to the best way how to check which item is being published?
Finally found solution for this issue. As mentioned in the question there was some issue with cookies as it was not able to login for the first attempt but latter on it was successfully logging in. I added below line to make it work. googleOptions.CookieManager = base.CookieManager; Now it successfully logins even in the first attempt.
Error: Unsuccessful login with external provider - Sitecore 10.1 integration with Google SSO We are trying to integrate google single sign on with sitecore 10.1 (only Sitecore cms login). When we login using google, for the first time we get an error &quot;Error: Unsuccessful login with external provider.&quot; Sitecore Log file : ERROR Unable to get and an external login info via Microsoft.Owin.Security.AuthenticationManagerExtensions.GetExternalLoginInfoAsync. Most probably the identity does not have a 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier' claim. Owin Log file : Microsoft.Owin.Security.Google.GoogleOAuth2AuthenticationMiddleware - .AspNet.Correlation.Google cookie not found. Now when we refresh the page &quot;/sitecore/login&quot; we are able to successfully login and the user is created in the sitecore. Hence the authentication is successful but looks like the cookie is not created at the time of redirection. When we login for the first time we don't see any cookies being created. But when we refresh we see few cookies created. sitecore_userticket, .Asp.Net.Cookies and Asp.Net.Correlation Cookie. Fiddler Screen shot: Identity Provider Config <identityProvider id=&quot;Google&quot; type=&quot;Sitecore.Owin.Authentication.Configuration.DefaultIdentityProvider, Sitecore.Owin.Authentication&quot;> <param desc=&quot;name&quot;>$(id)</param> <param desc=&quot;domainManager&quot; type=&quot;Sitecore.Abstractions.BaseDomainManager&quot; resolve=&quot;true&quot; /> <!--This text will be showed for button--> <caption>Log in with Google</caption> <icon>/sitecore/shell/themes/standard/Images/24x24/Google.jpg</icon> <!--Domain name which will be added when create a user--> <domain>sitecore</domain> <triggerExternalSignOut>true</triggerExternalSignOut> <!--list of identity transfromations which are applied to the provider when a user signin--> <transformations hint=&quot;list:AddTransformation&quot;> <!--SetIdpClaim transformation--> <transformation name=&quot;set idp claim&quot; type=&quot;Sitecore.Owin.Authentication.Services.SetIdpClaimTransform, Sitecore.Owin.Authentication&quot; /> <!--transformation for Google provider--> <transformation name=&quot;devRole&quot; type=&quot;Sitecore.Owin.Authentication.Services.DefaultTransformation, Sitecore.Owin.Authentication&quot;> <sources hint=&quot;raw:AddSource&quot;> <claim name=&quot;idp&quot; value=&quot;Google&quot; /> </sources> <targets hint=&quot;raw:AddTarget&quot;> <claim name=&quot;http://schemas.microsoft.com/ws/2008/06/identity/claims/role&quot; value=&quot;Sitecore\Developer&quot; /> </targets> <keepSource>true</keepSource> </transformation> </transformations> </identityProvider>
The current Sitecore implementation (SC 10.1 and earlier versions since I believe SC 9.2) is configured to support the Microsoft.Configuration.ConfigurationBuilders.EnvironmentConfigBuilder configuration builder provider type, reading connection strings and app settings from environment variables. The Secrets Store CSI driver secrets-store.csi.k8s.io allows Kubernetes to mount multiple secrets, keys, and certs stored in the Azure Key Vault resource into pods as a volume. Once the Volume is attached, the data in it is mounted into the container’s file system. Since the secrets are not stored in environment variables but available in the file system of the container, you need to use a different configuration builder type to access them, the Key-Per-File Configuration Provider. The official Microsoft documentation shows an example on how to use this provider to add configurations from files stored in a folder in the file system (its path would be the path of the mounted /mnt/secrets-store folder). I haven't personally tried it and it would require a good number of changes! An alternative easier approach supported by Sitecore that doesn't require to modify the Sitecore out-of-the-box configuration builder is to sync the mounted CSI file system secrets with Kubernetes Secrets, using the optional secretObjects field in the SecretProviderClass specification to map secrets using their objectName, as explained on the CSI driver official documentation here and on the Sitecore documentation portal here. Kubernetes secrets are already loaded as environment variables in the individual pod specification manifests, using the secretKeyRef field. While this approach is still less secure than reading the secrets from the file system, it eliminates one of the risks documented on the Kubernetes secrets documentation page that you linked in your question: If you configure the secret through a manifest (JSON or YAML) file which has the secret data encoded as base64, sharing this file or checking it in to a source repository means the secret is compromised. Base64 encoding is not an encryption method and is considered the same as plain text. One final note. The Secrets Store CSI driver for AKS is still in preview and as mentioned in the official documentation, preview features are not meant for production use: AKS preview features are available on a self-service, opt-in basis. Previews are provided &quot;as is&quot; and &quot;as available,&quot; and they're excluded from the service-level agreements and limited warranty. AKS previews are partially covered by customer support on a best-effort basis. As such, these features aren't meant for production use.
Not Able to Sync Azure Key Vault Secrets Into Sitecore Pods I'm following this Microsoft document to integrate AKS with KeyVault: https://docs.microsoft.com/en-us/azure/aks/csi-secrets-store-driver I'm using Sitecore 10.1.0 that uses AKS, my idea is to sync the secrets into the pods without using Kubernetes secrets because they are not secure as per this document. My question here is: How do I specify this path on Windows containers? Is there a specific folder that I should point to? Or is it a random folder that will be created during the runtime? And also, once the secrets are mounted in the pod, how do I pass the secrets in the deployment of the Sitecore roles? The example in the document is just to list the secrets that were mounted, and not to pass them in the yaml: kubectl exec busybox-secrets-store-inline -- ls /mnt/secrets-store/
I would suggest different approach because yours might be vulnerable to SXA updates (custom dialog might miss some functionalities). Instead I recommend extending existing scaffolding. When you open New-Site dialog you can see modules/features section. It lists all the modules that will be installed during site scaffolding operation (examples: Page Content, Media, Navigation ...). Your goal is to create your own module (like Media, Navigation) and define actions there which will create desired item structure. Steps Create Site Setup definition (root for your actions) - this item will appear as an option in the dialog. Set meaningful name in Name field. Also specify if modules should be installed by default (checkbox checked) or if it's a system module and every site should have it without possibility to disable it. Documentation Add scaffolding action. In your case you have to use Add Site Item action type. As a Template you can define branch which should be used to create pages. You can use as many action you need. Documentation
How to create a custom Site template in Sitecore SXA? In Sitecore SXA when I right-click on a tenant, it should have an option to add an eCommerce site. So, when a user clicks on the eCommerce site it should run the same PowerShell script that is run when we hit Insert -> Site. The difference is in the site structure, for an eCommerce site we should have a category, sub-category, product pages added inside the home items by default. Is it possible to achieve it? If yes, what would be the steps. Thanks in advance !!
It looks like you are using two different indexes and expect the same results. Compare translated search queries and pay attention to _indexname field. This is unfortunate but queries in Build Search Query dialog are executed against Sitecore index, while these in Preview/Publish (in SXA context) will use SXA indexes. There is no good solution/hotfix for that (to be able to observe SXA indexes results inside this dialog). In your case, you have to inspect your SXA indexes and check index schema to validate if it has the same field (tag) included.
Semantic Tag Based Sxa Search not showing result on solr search service I am using Sitecore 10.1 with Sxa on solr 8.4.1. The sxa scopes based on templates having any semantic tag is showing result in build query, but not on page preview nor published page. Example query : +template:{3f068cb6-080a-46d6-8212-848bd81e4e14};+tag:{B8D314E1-72AB-4F1B-A04A-3CAED1D89212};+location:{05CF23EF-08C3-466F-9A68-31E87B53DA72} whereas query without tag is returning result. The above search query is working on Azure search service, thus wondering is there any limitation or configuration missed for solr search. Although the steps to configure solr in sitecore instance is being done as mentioned Here and the JVM is Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 1.8.0_241 25.241-b0. Thanks in advance!
HTML tags are stripped out while indexing Rich Text field content OOTB in Sitecore and this is a good practice in general as well. But Yes you can configure this, there are two ways to index any RTE field with html tags, first for a single field and, second for all the RTE fields. Single Field- Create a patch config for SITECORE FIELDTYPE MAP section, this map a field type by name to a Strongly Typed Implementation of the field type e.g. html maps to HTMLField. Will add below section under <fieldReaders section. It will have the fieldReaderType = Sitecore.ContentSearch.FieldReaders.DefaultFieldReader, Sitecore.ContentSearch <mapFieldByFieldName hint=&quot;raw:AddFieldReaderByFieldName&quot;> <fieldReaderfieldName=&quot;RTEFieldName&quot;fieldReaderType=&quot;Sitecore.ContentSearch.FieldReaders.DefaultFieldReader, Sitecore.ContentSearch&quot; /> </mapFieldByFieldName> Final output in your showconfig would be like - <fieldReaders type=&quot;Sitecore.ContentSearch.FieldReaders.FieldReaderMap, Sitecore.ContentSearch&quot;> <param desc=&quot;id&quot;>defaultFieldReaderMap</param> <mapFieldByFieldName hint=&quot;raw:AddFieldReaderByFieldName&quot;> <fieldReaderfieldName=&quot;RTEFieldName&quot;fieldReaderType=&quot;Sitecore.ContentSearch.FieldReaders.DefaultFieldReader, Sitecore.ContentSearch&quot; /> </mapFieldByFieldName> <mapFieldByTypeName hint=&quot;raw:AddFieldReaderByFieldTypeName&quot;> <fieldReader fieldTypeName=&quot;checkbox&quot; fieldReaderType=&quot;Sitecore.ContentSearch.FieldReaders.CheckboxFieldReader, Sitecore.ContentSearch&quot;/> <fieldReader fieldTypeName=&quot;date|datetime&quot; fieldReaderType=&quot;Sitecore.ContentSearch.FieldReaders.DateFieldReader, Sitecore.ContentSearch&quot;/> <fieldReader fieldTypeName=&quot;image&quot; fieldReaderType=&quot;Sitecore.ContentSearch.FieldReaders.ImageFieldReader, Sitecore.ContentSearch&quot;/> <fieldReader fieldTypeName=&quot;single-line text|multi-line text|text|memo&quot; fieldReaderType=&quot;Sitecore.ContentSearch.FieldReaders.DefaultFieldReader, Sitecore.ContentSearch&quot;/> <fieldReader fieldTypeName=&quot;integer&quot; fieldReaderType=&quot;Sitecore.ContentSearch.FieldReaders.NumericFieldReader, Sitecore.ContentSearch&quot;/> <fieldReader fieldTypeName=&quot;number&quot; fieldReaderType=&quot;Sitecore.ContentSearch.FieldReaders.PrecisionNumericFieldReader, Sitecore.ContentSearch&quot;/> fieldReaderType=&quot;Sitecore.ContentSearch.FieldReaders.RichTextFieldReader, Sitecore.ContentSearch&quot; /> <fieldReader fieldTypeName=&quot;multilist with search|treelist with search&quot; fieldReaderType=&quot;Sitecore.ContentSearch.FieldReaders.DelimitedListFieldReader, Sitecore.ContentSearch&quot;/> <fieldReader fieldTypeName=&quot;checklist|multilist|treelist|treelistex|tree list&quot; fieldReaderType=&quot;Sitecore.ContentSearch.FieldReaders.MultiListFieldReader, Sitecore.ContentSearch&quot;/> <fieldReader fieldTypeName=&quot;icon|droplist|grouped droplist&quot; fieldReaderType=&quot;Sitecore.ContentSearch.FieldReaders.DefaultFieldReader, Sitecore.ContentSearch&quot;/> <fieldReader fieldTypeName=&quot;name lookup value list|name value list&quot; fieldReaderType=&quot;Sitecore.ContentSearch.FieldReaders.NameValueListFieldReader, Sitecore.ContentSearch&quot;/> <fieldReader fieldTypeName=&quot;droplink|droptree|grouped droplink|tree|reference&quot; fieldReaderType=&quot;Sitecore.ContentSearch.FieldReaders.LookupFieldReader, Sitecore.ContentSearch&quot;/> <fieldReader fieldTypeName=&quot;attachment|frame|rules|tracking|thumbnail&quot; fieldReaderType=&quot;Sitecore.ContentSearch.FieldReaders.NullFieldReader, Sitecore.ContentSearch&quot;/> <fieldReader fieldTypeName=&quot;file|security|server file|template field source|link&quot; fieldReaderType=&quot;Sitecore.ContentSearch.FieldReaders.NullFieldReader, Sitecore.ContentSearch&quot;/> </mapFieldByTypeName> </fieldReaders> RTE Field Type - For all the RTE field type you just need to change the fieldReaderType of “html|rich text” fieldReader to Sitecore.ContentSearch.FieldReaders.DefaultFieldReader. recommanded practice to create patch for config update. <fieldReader fieldTypeName=&quot;html|rich text&quot; fieldReaderType=&quot;Sitecore.ContentSearch.FieldReaders.DefaultFieldReader, Sitecore.ContentSearch&quot;/> After updating these config chagnes you need to do reindexing.
Search HTML code in Content Editor I am sorry if this is a stupid question, I am just starting to explore Sitecore. When I use the search function in the Content Editor, it will return the items that contain my search query. But it will never return anything if I search for HTML code. For example, I know there are many items that contain a link (<a href...>) in their rich text fields, but if I do a search for href, nothing will be returned. Is this behaviour inherent of Sitecore, or is this configurable somewhere?
This behavior occurs if your scheduled task is set to run asynchronously. To avoid this behavior, be sure that the Async field of your scheduled task item is not checked:
Schedule Task LastRun is always returning same time as DateTime.Now, causing issues with task time window checking I have a scheduled task that I recently realized isn't working properly. The Sitecore task is running, but in the code I have time check to make sure that it only runs within a one-hour window (2am to 3am), and only if it hasn't already run in that window: protected virtual bool IsDue(ScheduleItem scheduleItem) { DateTime timeBegin; DateTime timeEnd; DateTime.TryParse(&quot;02:00:00&quot;, out timeBegin); DateTime.TryParse(&quot;03:00:00&quot;, out timeEnd); Sitecore.Diagnostics.Log.Info(&quot;IsDue timeBegin: &quot; + timeBegin.ToString(), this); Sitecore.Diagnostics.Log.Info(&quot;IsDue timeEnd: &quot; + timeEnd.ToString(), this); Sitecore.Diagnostics.Log.Info(&quot;IsDue now: &quot; + DateTime.Now.ToString(), this); Sitecore.Diagnostics.Log.Info(&quot;IsDue Last Ran: &quot; + scheduleItem.LastRun.ToString(), this); return (CheckTime(DateTime.Now, timeBegin, timeEnd) &amp;&amp; !CheckTime(scheduleItem.LastRun, timeBegin, timeEnd)); } private bool CheckTime(DateTime time, DateTime after, DateTime before) { return ((time >= after) &amp;&amp; (time <= before)); } I discovered through the logging that my code isn't running because it always returns IsDue = false, because scheduleItem.LastRun is always equal to DateTime.Now. Here's a sample from my logs: INFO IsDue timeBegin: 21.10.2021 02:00:00 INFO IsDue timeEnd: 21.10.2021 03:00:00 INFO IsDue now: 21.10.2021 02:04:18 INFO IsDue Last Ran: 21.10.2021 02:04:18 INFO Ended: Trial Import Schedule INFO Trial Import Job not due at this time Every instance in the logs is like this, where DateTime.Now is the exact same value as scheduleItem.LastRan. As a result my code never runs because it always thinks that the task has already run within the time window.
The issue was in custom pipeline - AbortSitecoreForKnownRoutes. The request from api/sitecore was also processing, but is shouldn't be. I updated my code to not process api/sitecore request public class AbortSitecoreForKnownRoutes : HttpRequestProcessor { public override void Process(HttpRequestArgs args) { var routeCollection = RouteTable.Routes; var httpContext = args.HttpContext.ApplicationInstance.Context; var routeData = routeCollection.GetRouteData(new HttpContextWrapper(httpContext)); if (routeData == null || args.Url.ItemPath.Contains(&quot;api/sitecore&quot;)) return; HttpContext.Current.RemapHandler(routeData.RouteHandler.GetHttpHandler(HttpContext.Current.Request.RequestContext)); args.AbortPipeline(); } }
Cannot create and add new contact to contact list I am using Sitecore.NET 10.1.1 (rev. 005862). I created an empty list in List Manager. When I am trying to create a new contact nothing is happened and in the logs I have error: 844 11:00:44 ERROR Application error. Exception: System.InvalidOperationException Message: The matched route does not include a 'controller' route value, which is required. Source: System.Web.Mvc at System.Web.Mvc.MvcRouteHandler.GetSessionStateBehavior(RequestContext requestContext) at System.Web.Mvc.MvcRouteHandler.GetHttpHandler(RequestContext requestContext) at Sitecore.Mvc.Routing.RouteHandlerWrapper.GetHttpHandler(RequestContext requestContext) Any help will be appreciated.
The &quot;containery&quot; way to do this is to create your own solr-init image based off of the Sitecore one and copy in your own configset with the custom schema and create the core as part of the script. The container itself provides several scripts to help with this, e.g., New-SolrConfig.ps1, New-SolrCore.ps1, Patch-SolrConfig.ps1, etc. You can create your own script to run the default Start.ps1 and then perform whatever custom work you need to do, then use your custom script as the entrypoint for your container.
Creating a custom Solr core in docker using docker I am trying to create a custom solr index using custom schema with docker container approach. I am able to create a custom index, but I am not able to associate it with the custom schema. I did copy a json file with the names of the custom indexes to the c:/data folder of solr-init container in solr-init DockerFile as a part of creating a custom index, although I ma not sure how can I map the custom schema with this core. Can anyone please help me out? Thanks
For Next.JS and SXA You can now use the new built-in functionality described here. See my blog post here for details on how to configure it. For sitecore-jss-proxy: After a lot of digging my findings are: The sitecore-jss-proxy package will always use the configured Layout Service to render pages. The sitecore-jss-proxy package does honour and support native redirects, in fact any response code from the layout service will be passed up to the browser. Therefore we can use our normal httpRequestBegin and/or mvc.requestBegin pipeline processors to do redirects on layout service requests. You can get the item requested on the pipeline processor like this: public static string GetLayoutServiceRequestItemPath() { if (!HttpContext.Current.Request.Path.Contains(&quot;/layout/render&quot;)) { return null; } var item = HttpContext.Current.Request.QueryString?[&quot;item&quot;]; if (string.IsNullOrWhiteSpace(item)) { return null; } return item; } And then apply whatever logic you need to resolve the item / read from a redirect map, and do your normal HttpContext.Current.Response.Redirect. It is therefore simple to extend the Sitecore.XA.Feature.Redirects.Pipelines.HttpRequest.RedirectMapResolver for layout service requests by overriding the GetRawUrl() logic with the above. This means that any other redirect module you use will need the above modification. It also means that IIS rewrite maps won't be supported without custom code to read and process the maps. Finally, to round out the topic, you can do redirects on the node-proxy itself: server.use((req, res, next) => { // SEO - remove trailing slashes if (req.path !== '/' &amp;&amp; req.path.endsWith('/')) { res.redirect(301, req.path.substring(0, req.path.length - 1)); } next(); })
Redirect map strategy when using Headless What is a good strategy for handling 301 / 302 redirect maps when using Sitecore headless with SSR and the headless proxy? My current thoughts are: Need to handle SSR requests - either IIS redirect maps or SXA redirect maps (or a Sitecore redirect module) should be supported. Need to handle layout service requests - I can't find any information on the approach here. In both cases I need the proxy to pass on the redirect to the browser. Following the redirect and updating the route won't handle all scenarios and won't be good for seo.
Unless your SIF tasks have been customized or modified, they are not expected to create the securityuser database user twice in the Core database. The fact that the securityuser exists in all your databases seems to indicate that it is a SQL Server login user and not a database user. If you are not able to identify the reason behind the preexistence of this user, you should be able to avoid this installation error using a different name for the Security DB user name, editing the default value of the SqlSecurityUser parameter. This parameter is not exposed in the json configurations for the different topologies, so it might be easier to just edit its default value directly in the XP0-sitecore.json file, where it is defined. This is the definition of the parameter to look for and to edit its default value (ie. sitecoresecurityuser): &quot;SqlSecurityUser&quot;: { &quot;Type&quot;: &quot;string&quot;, &quot;DefaultValue&quot;: &quot;sitecoresecurityuser&quot;, &quot;Description&quot;: &quot;The Sql user for the Security connection string in Sitecore.&quot; }
Sitecore 10.1 install error: sql 'securityuser' already exists in the current database Error When installing Sitecore 10.1, I'm getting the below error. [WebDeploy]:[Path] C:\Program Files\iis\Microsoft Web Deploy V3\msdeploy.exe Error Code: ERROR_SQL_EXECUTION_FAILURE More Information: An error occurred during execution of the database script. The error occurred between the following lines of the script: &quot;18&quot; and &quot;21&quot;. The verbose log might have more information about the error. The command started with the following: &quot;CREATE USER [securityuser] WITH PASSWORD = 'PvdT&quot; User, group, or role 'securityuser' already exists in the current database. https://go.microsoft.com/fwlink/?LinkId=178587 Learn more at: https://go.microsoft.com/fwlink/?LinkId=221672#ERROR_SQL_EXECUTION_FAILURE. Error: User, group, or role 'securityuser' already exists in the current database. Error count: 1. Anyone have any ideas what this could be? Scouring the web with no luck yet. Note Creates the majority of the required databases and all of the databases have the securityuser already created inside of them. Makes me think the SIF is creating the user, and then trying to create it again in the same db? Things tried deleting existing sql global securityuser looked for existing global sql roles named securityuser, didn't see any restarting sql server deleting all db's and running SIF again verified webdeploy is installed, have both 3.5 &amp; 3.6 verified SQL Server 2017 prerequisite installed
Sample Here is an example of how I used tags for listing departments associated with media items. {{ if i_item.SxaTags != &quot;&quot; }} <span> Department: </span> {{ tags = [] }} {{ for i_tag in (sc_followmany i_item &quot;SxaTags&quot;) }} {{ tags[tags.size] = i_tag | sc_field &quot;Title&quot; }} {{ end }} {{ tags | array.sort | array.join &quot;, &quot; }} {{ end }}
How do you get value of item tag in scriban template Sorry this is probably a dumb question but I am a bit stuck in here and I can't find suitable solutions in google. Basically I have an item or a page with a Tagging on it. But I can't seem to get the value of tags using scriban template. I tried using {{i_item.tags}} and {{sc_raw i_item 'Tags'}} and {{ for i_child in i_item.sxa_tags }} <span>{{ i_child.Title }}</span> {{ end }} Anyhelp will be really appreciated. Thanks
Do not remove the properties folder, keep it as it is. The file format of files under \package\items\ and \package\properties\items\ are different and they are storing different information: File under Items folder storing the information about the item, its name, sort order etc., also it contains such data about fields like id, key, type, and content. File under Properties folder storing the information about the database, version, language revision etc., also it contains information about fields like Shared/Versioned.
What is purpose of the 'properties' folder inside Sitecore Zip package? We are using Sitecore 9.3 on the project. My zip package takes a lot of space. When I opened my package my-package-1.0.0.zip\package.zip\ with 7-Zip I noticed that the properties folder takes a lot of space and it contains items that are already contained in the items folder. Does someone know the purpose of the properties folder? Is it safe to remove it from the zip package? Thanks in advance.
If you are using powershell you can take a look at the Get-ItemReferrer documentation https://doc.sitecorepowershell.com/appendix/common/get-itemreferrer that can be used check if an item has any referrences to it. I have used the following powershell script: $items = Get-ChildItem -Path 'master:/sitecore/content/Home' -Recurse $results = New-Object System.Collections.ArrayList foreach ($item in $items) { $links = $item | Get-ItemReferrer if ($links.Count -eq 0) { [void]$results.Add($item) } } $results | Format-Table Name, @{ Label = 'Path'; Expression={ $_.Paths.Path } } In C# you can use ItemLink[] itemLinks = Globals.LinkDatabase.GetReferrers(item); to get all referrers of a specific item. I would also recommend to run Rebuild Link databases from control panel prior to running the reports to make sure Link Database is up to date.
How can we get report of the items with no reference or links in Sitecore 8.2? I need a PowerShell script or a .aspx page to get the list of items which has no reference or link to it. Can anyone help with this?
You entered into &quot;Translate&quot; mode: Just click on &quot;VERSIONS&quot; ribbon and uncheck &quot;translate&quot; button.
What would be causing my Sitecore item's content (fields) not content tree, to be duplicated? We just installed 10.1, and I am working with a local instance of my Sitecore 10.1. I pointed my connectionstrings to my DEV database and I rebuilt my indexes in Solr. When I opened up my content tree and click on an item, all of the fields are duplicated? there is an editable field and an identical un-editable field. see below. I checked my WEB database and this is also the case, very strange. what do I need to look at to troubleshoot? Note: I reverted my connectionstrings back to local and now I have a brand new instance of Sitecore (not my site) and no duplication. Also, my DEV environment does not have this issue.
No, you should not do such things! All database operations should be done through the Sitecore APIs. SXA is also using Sitecore APIs and it is never accessing the database directly. Sitecore is doing a lot of processing around basic database operations (e.g.: while saving an item) so you can break the database easily when you will start to manually manipulate it. Only through Sitecore APIs!
Can we add or delete data directly into database through Sitecore SXA? Can we add or delete data directly into database from programming in Sitecore SXA? Can we add .edmx in Sitecore and perform create/update/delete operation through it ?
No, this is not possible. But you can try to mimic this behaviour by: having three themes - header, body and footer each of the above themes will target different root CSS elements like #header, #content, #footer one main theme which you will assign to the page and which will inherit from the above three Thanks to such a trick you will have the logical separation you want.
Assign different theme for Header Is it possible to add different theme for Header and different theme for body / main content..? In SXA, it is allowed to do it but in Header partial view using Experience editor and shows that theme in the partial view but when comes to the complete Page view, Main site theme overrides the Header theme.
Your config doesn't match your path for the scriban templates. You have: return _path + '/-/scriban/**/*.scriban'; if you look at your folder structure you don't have a folder named - before the scriban folder. Change your path to this: return _path + '/scriban/**/*.scriban'; and it should pick up your files.
SXA watch CLI only minify and upload CSS only. JS and Scriban does not work sxa watch All -d AND gulp, only track css. It says its watching js and scriban but when I save a js or scriban, CLI does not throw a response. Am I missing something ? This is my config: Sass (working) sass: { root: 'sass/**/*.scss', components: { sassPath: 'sass/*.scss', stylePath: 'styles' }, styles: { sassPath: [ 'sass/styles/common/*.scss', 'sass/styles/add-highlight/*.scss', 'sass/styles/background-colors/*.scss', 'sass/styles/content-alignment/*.scss', 'sass/styles/layout/*.scss', 'sass/styles/spacing/*.scss' ], stylePath: 'styles', concatName: 'styles.css' }, JS (working), it was not working before but now its working as I did a sxa rebuild. after that now its working js: { path: 'scripts/**/*.js', esLintUploadOnError: true, minificationPath: ['scripts/**/*.js'], jsOptimiserFilePath: 'scripts/**/', jsOptimiserFileName: 'pre-optimized-min.js', es6Support: true, jsSourceMap: false, enableMinification: true, disableSourceUploading: true }, Scriban, Not working. ** issue is with scriban only. scriban: { path: (function () { if (!global.rootPath) return; let rootCreativeExchangePath = global.rootPath.split('-\\media'), _path = './'; if (rootCreativeExchangePath.length > 1) { _path = _path + path.relative('./', global.rootPath.split('-\\media')[0]).split(path.sep).join('/') } return _path + '/-/scriban/**/*.scriban'; })(), Scriban confiuration file: {&quot;siteId&quot;:&quot;{F860FD06-F351-411F-B329-562D41B9941C}&quot;,&quot;database&quot;:&quot;sc93_EXM.Master&quot;} This is the theme file structure:
There is no way to do that out of the box. You would need to override Sitecore.XA.Foundation.Search.Services.SearchService in order to change the way how the query is generated. Right now we are using Sitecore.XA.Foundation.Search.Models.ContentPage as a query return type. It contains a few SXA specific fields and inherits from the Sitecore Sitecore.ContentSearch.SearchTypes.SearchResultItem class which contains a loooot of fields (as you notice it). So technically it is possible but I strongly recommend not to do that as you will end up overriding a few classes while the Search Results component is using paging anyway (you are not getting all of the items and all of the fields at one time).
Sitecore SXA Search Results Filter number of fields returned in SOLR response I am using Sitecore 10.1 with SXA, I have a page that contains search results component and I have noticed that the query that is generated and run on SOLR is retrieving all the fields in the response. Is there a way to override this behavior and return only the fields that will be displayed in search results component?
Try this code, I have modified the custom rendering parameter like the Ajax Options check box. In this, the function takes as an input item you want to edit and field - either Final or Shared layout. Also Write a log on every step:- $languages = @('en') $startPath = '/sitecore/content/xxx/xxx/Presentation/Partial Designs/Frenchs/Recipe' $renderingNames = @('Menu Wrapper') $renderingParamterToUpdate = &quot;Ajax Call&quot; $newRenderingParameterValue = &quot;0&quot; foreach($language in $languages){     $items = Get-ChildItem -Path $startPath -Language $language -Recurse     foreach($item in $items){         Write-Host 'Updating Item: ' $item.Paths.FullPath         foreach($itemRendering in Get-Rendering -Item $item -FinalLayout) {             $renderingItem = Get-Item -Path master: -ID $itemRendering.ItemID                 if($renderingNames -contains $renderingItem.Name){                 Write-Host 'Found Rendering: ' $($renderingItem.Name)                                 $parameters = Get-RenderingParameter -Rendering $itemRendering                 if($parameters[$renderingParamterToUpdate] -ne $newRenderingParameterValue){                     Write-Host 'Updating' $renderingParamterToUpdate -ForegroundColor Green                     $parameters[$renderingParamterToUpdate] = $newRenderingParameterValue                     $itemRendering | Set-RenderingParameter -Parameter $parameters |                     Set-Rendering -Item $item -FinalLayout                 }             }         }     } }
Programatically change all renderings with specific rendering parameter I'm new to Sitecore PowerShell and would like to know the best way to get all the items on my content tree that have a specific rendering parameter set so I can replace it with another value in the rendering parameter. I know I can replace the layout IDs but I thought of using PowerShell to create a more elegant solution. I reviewed the documentation on Get-Rendering and Set-Rendering but couldn't get the script to work. Here is what I have so far. Any help is highly appreciated $defaultLayout = Get-LayoutDevice &quot;Default&quot; $path = &quot;master:\sitecore\content\home\page-that-has-rendering&quot; $language = 'en-US' $items = Get-ChildItem -Path $path -Language $language -Recurse $newValue = Get-Item -Path 'master:\sitecore\content\home\path-to-mynewrenderingparametervalue' $items | ForEach-Object { $rendering = Get-Rendering -Id $_.ID -Device $defaultLayout -FinalLayout #$param = Get-RenderingParameter -Rendering $rendering | Format-Table -Auto foreach($itemRendering in Get-Rendering -Item $_ -FinalLayout) { $parameters = Get-RenderingParameter -Rendering $itemRendering Set-Rendering -Instance $newValue } }
From looking at the error shared in the comment above: C:\StartInit.ps1 : Cannot bind argument to parameter 'SqlServer' because it is an empty string. At line:1 char:143 + ... urcesDirectory $env:RESOURCES_PATH -SqlServer $env:SQL_SERVER -SqlAd It seems that the base image used as build argument is a mssql-init image and not a mssql image, because the StartInit.ps1 entrypoint is the entrypoint script of a mssql-init image. This explains why the build process fails when trying to start the SQL Server service, that of course doesn't exist in a mssql-init image.
Cannot find any service with service name 'MSSQLSERVER' on docker-compose build Has anyone ever run into the error below when running a build for Sitecore 10.1? It used to work fine and now this error pops up. I'm adding SPE and SXA to MSSQL. Again, it just started breaking but worked in the past. Here is the code in the dockerfile that generates the error now: # Add SPE module COPY --from=spe \module\db \spe_data RUN C:\DeployDatabases.ps1 -ResourcesDirectory C:\spe_data; ` Remove-Item -Path C:\spe_data -Recurse -Force; Here is the error on docker-compose build: Step 11/15 : RUN C:\DeployDatabases.ps1 -ResourcesDirectory C:\spe_data; Remove-Item -Path C:\spe_data -Recurse -Force; ---> Running in bffa4ae2ed24 Start-Service : Cannot find any service with service name 'MSSQLSERVER'. At C:\DeployDatabases.ps1:78 char:5 + Start-Service MSSQLSERVER; Thanks!
With the latest version of GlassMapper, GlassCast method is obsolete with lots of other things. One of the important updates is new contexts which include IMvcContext, IRequestContext, IWebFormsContext. If you want to cast the Item type to IMap. You cannot simply do it using the GlassCast method, You need to create an object of MVC Context (probably the one you will be working on the most), and then needs to code as below- IMvcContext mvcContext = new MvcContext(); var mapItem= mvcContext.GetContextItem<IMap>(); The above code is for context item, for any other type of item you can use code as below - IMvcContext mvcContext = new MvcContext(); var mapItem= mvcContext.SitecoreService.GetItem<IMap>(DataSourceItem);
Glass Cast issues after upgrading from Sitecore 8.1 to Sitecore 10.1.2 I am trying to migrate Sitecore items from Sitecore 8.1 to Sitecore 10.1.2. During migration I have got an error as 'Item' does not contain a definition for 'GlassCast' and no accessible extension method 'GlassCast' Below is my code public IMap GetMapItem() { if (this.ContextItem.IsDerived(Templates.Map.ID)) return this.ContextItem.GlassCast<IMap>(); return null; }
You need to register custom language in .NET and then try to define that in Sitecore. Sample code: string culture = &quot;en-JP&quot;; string name = &quot;English (Japanese)&quot;; //Create Culture &amp; Region Info with an existing Language Culture (Eg: en-US) CultureInfo cultureInfo = new CultureInfo(&quot;en-US&quot;); RegionInfo regionInfo = new RegionInfo(cultureInfo.Name); CultureAndRegionInfoBuilder cultureAndRegionInfoBuilder = new CultureAndRegionInfoBuilder(culture, CultureAndRegionModifiers.None); cultureAndRegionInfoBuilder.LoadDataFromCultureInfo(cultureInfo); cultureAndRegionInfoBuilder.LoadDataFromRegionInfo(regionInfo); cultureAndRegionInfoBuilder.CultureEnglishName = cultureAndRegionInfoBuilder.CultureNativeName = name; //Register the Custom Language Culture cultureAndRegionInfoBuilder.Register(); Check this blog that talks in detail about this - https://subbu.ca/blogs/adding-custom-language-in-sitecore/ There is a Sitecore SE post on this topic here that might be useful to you.
Sitecore Custom language causing issue while switching an item in the newly created custom language I have created a new language &quot;en-JP&quot; and used the below entry in LanguageDefinitions.config file <language id=&quot;en&quot; region=&quot;JP&quot; codepage=&quot;65001&quot; encoding=&quot;utf-8&quot; charset=&quot;iso-8859-1&quot; icon=&quot;flags/16x16/flag_Japan.PNG&quot; /> But when I switch an item language in Sitecore CMS, it is throwing the below error. Could you please suggest to me how we can add this language and I wanted to show en-JP in my url and based on context language we're also pulling search results. Hence it is not recommended to use any alternate language code apart from &quot;en-jp&quot;
GlassView and GlassController got deprecated since v5. Have a look at Glass.Mapper.Sc.Web.Mvc.IMvcContext, you should now be using the methods provided there to get the datasource, context and rendering items: I hope it helps you.
Glass Mapper GetLayoutItem depreciated method We are updating GlassMapper from 4 to 5. Since the GlassController is depreciated in new version and we have used GetLayoutItem in many places. Can it be replaced with MvcContext.GetContextItem from MVCContext class? Any recommendations would be appreciated. Thanks
Turns out this is a known bug in Docker Windows. https://github.com/moby/moby/issues/42803 I can run the rendering host on the Docker host (from Visual Studio or dotnet CLI) as an alternative, then restart the rendering container to test Experience Editor Thanks to Nick Wesselman for pointing me in the right direction.
Getting Started Template - File in use by another process So I am doing the walkthrough: https://doc.sitecore.com/en/developers/101/developer-tools/walkthrough--using-the-getting-started-template.html Everything seems to work just fine (the occasional container is unhealthy message) and when everything completes I can see a working instance of Sitecore running in Docker. However the dotnet watch command runs into issues as soon as I try to make changes to any of the views in the project, I make a change, I get the following when in the logs: C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk.Razor\targets\Microsoft.NET.Sdk.Razor.Compilation.targets(232,5): warning MSB3026: Could not copy "C:\solution\src\rendering/obj/container/Debug\netcoreapp3 .1\project.Views.dll" to "C:\solution\src\rendering\bin\container\Debug\netcoreapp3.1\project.Views.dll". Beginning retry 10 in 1000ms. The process cannot access the file 'C:\solution\src\rendering\bin\container\Debug\netco reapp3.1\project.Views.dll' because it is being used by another process. [C:\solution\src\rendering\RenderingHost.csproj] The build fails as a result and the site no longer works. I can restart that image, and then the changes appear, but that is not the way its supposed to work... Any help will be much appreciated. Joe
Just want to explain fix for this issue which may assist other. Thanks @Richerd Seal for providing suggestion. If yours docker desktop running on linux containers then will get this issue. We have to switch to window container. click on docker icon on toolbar, right click and switch to window container.
Getting Started template Sitecore 10- running up.ps1 - failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0 Trying to do local Sitecore 10 setup using Getting Started Template. While running up.ps1 getting error failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to create LLB definition: no match for platform in manifest sha256:3c0ca16693dfc1252120cb6066ddfccf53b9bbce4523bdb7c7fb3f55dd86f33f: not found Please assist.
Just experienced same issue while upgrading from 8.2 to 10.1. We had a custom patch file adding extra field to sitecore_analytics_index. Something like: <index id=&quot;sitecore_analytics_index&quot;> <configuration> <fieldMap> <fieldNames> <field ... /> </fieldNames> </fieldMap> </configuration> </index> In 10.1 we don't have sitecore_analytics_index Sitecore OOTB configs anymore. With that patch Sitecore was trying to add yet another index to the list of indexes, but as patch file doesn't define any type for the index, it was failing. The error message wasn't clear and attempts to find AddIndex in configs (from exception message Could not find add method: AddIndex) didn't help neither. If you experience same issue, search for all <index occurrences in your config patches and check if those indexes are present in OOTB Sitecore configuration.
Could not find add method: AddIndex (type: Sitecore.ContentSearch.ContentSearchConfiguration) We are setting up a new Sitecore 9.3 instance on a server, making the respective connection string changes and getting the below error while loading the Sitecore login page: Error: Could not find add method: AddIndex (type: Sitecore.ContentSearch.ContentSearchConfiguration) Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: Sitecore.Exceptions.RequiredObjectIsNullException: Could not find add method: AddIndex (type: Sitecore.ContentSearch.ContentSearchConfiguration) Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [RequiredObjectIsNullException: Could not find add method: AddIndex (type: Sitecore.ContentSearch.ContentSearchConfiguration)] Sitecore.Configuration.DefaultFactory.AssignProperties(Object obj, Object[] properties) +1704 Sitecore.Configuration.DefaultFactory.AssignProperties(XmlNode configNode, String[] parameters, Object obj, Boolean assert, Boolean deferred, IFactoryHelper helper) +620 Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +320 Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert) +72 Sitecore.Configuration.DefaultFactory.CreateObject(String configPath, String[] parameters, Boolean assert) +703 Sitecore.ContentSearch.ContentSearchManager.get_SearchConfiguration() +306 Sitecore.ContentSearch.SolrProvider.Pipelines.Loader.InitializeSolrProvider.Process(PipelineArgs args) +73 (Object , Object ) +9 Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +484 Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists) +236 Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22 Sitecore.Nexus.Web.HttpModule.Application_Start() +220 Sitecore.Nexus.Web.HttpModule.Init(HttpApplication app) +1165 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +581 System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +168 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +277 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +369 [HttpException (0x80004005): Could not find add method: AddIndex (type: Sitecore.ContentSearch.ContentSearchConfiguration)] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +532 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +111 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +714
I see two possibilities: it's injected via Partial Designs - some partial design has it defined and when layout is composed it is injected to the page. The fact that placeholder matches causes this rendering to pop up inside ambient-video-placeholder Ambient Video Container is a &quot;snippet&quot; - there is a change that someone made a clone of regular snippet rendering and presentation is pulled from the Ambient Video Container datasource (see how snippet works here) You can make a quick test to eliminate 1 Try to move Ambient Video Container to a different placeholder (i.e from main to footer, save page and see if Video rendering is still there). If not, it's probably case 1 if it remains there it's probably 2. If 2 is true - open datasource dialog of Ambient Video Container find this datasource item, them verify if Video rendering is present in layout details. That might be tricky if someone had fantasy and used nested snippets ... Another way could be finding the rendering by UID. This will work only for 2, for 1 you will not find rendering representation in the JavaScript. Open Chrome dev tools and try to find element with this name: scLayoutDefinition, it should contain layout definition in JSON. Try to find your Video rendering and get its UID. Now you can find your rendering in the content using preferred search method (c# code, powershell, SQL), basically your goal is to find and item which contains your UID in one of the fields (I hope you know that presentation is stored in these fields as XML): __Final Renderings __Renderings
Specify default rendering for placeholder in partial design We have a partial design with an empty placeholder that is being pre-filled with one of its allowed renderings upon page creation. It is not clear where exactly it is being specified for this particular partial design, to automatically add the specific rendering when a content editor creates a new page which uses this partial. The presentaion details for the page show the item which specifies the placeholder itself, but there is nothing in the details referring to the actual rendering that gets placed within it. Does anyone know where this might be specified?
I've faced the same issue weeks ago and I fixed it by adding a google DNS (8.8.8.8) on my docker settings as on the print screen below, try to do the same.
NuGet Restore not Working When Building Sitecore Images I'm trying to spin up the following Sitecore environment using docker: https://github.com/Sitecore/docker-examples/tree/develop/custom-images I've already run the Init.ps1 script that fills in all the variables, certificates, Sitecore license and so on... but when I run docker-compose up -d it says the following during the Nuget restore command: Yesterday I've tried to fix that but I ended up messing with my machine, then I re-imaged it, and even doing that, with the machine all empty, the error persists. I couldn't find any relevant content about that on the internet. I don't know why the MSBuild auto-detection is trying to use that path that doesn't have the MSbuild installed. Has anyone experienced a similar issue?
in order to avoid this to happen, you've to get the &quot;zero downtime (switch on rebuild)&quot; feature properly configured so a secondary index is created during the rebuild. The steps to check/configure depend on which search provider do you have and Sitecore version. For Azure Search Sitecore 8.2+ (except 10.2), check: https://doc.sitecore.com/en/developers/101/platform-administration-and-architecture/zero-downtime-index-rebuild-in-azure-search.html For Solr: https://doc.sitecore.com/en/developers/102/platform-administration-and-architecture/switch-solr-indexes.html I hope it answers your question
Can rebuilt index take my site down Some of my pages are not appearing in search results. I tried publish the page but that doesn't work. I think I need to rebuild the index. I am being cautious here, will my site go down until rebuild index is completed? If not how it will use index which is being rebuilt?
This functionality is available OTTB in TDS, to accomplish this you can follow below steps: Select ContentList field item and right click and select Properties 2. Go to Custom Data field and type type=IEnumerable<Namespace.IMytmeplate> Again sync, it will work
TDS overwrites existing model I am new to TDS. I have a template which has a ContentList field of type TreeList. This field is allowed to select any page template. When I map this changes in TDS(Visual Studio) the tds generates a model automatically for this field like, object ContentList{get;set;} but I want this as IEnumerable(IMytmeplate) ContentList{get;set;} Whenever I make changes in CMS and merge in code this is getting overwritten. Is there any way to achieve the desired result? Similarly I have a date picker field and I want it to be nullable. Whenever I make changes to content in CMS and merge in code these fields are getting overwritten and I need to make the changes manually.Any help would be appreciated. Thanks in advance
The issue was the nodejs and solution containers had scale set to 0 by default which excludes them from the running environment. CM depends on the solution container and the rendering container depends on the nodejs container. Since those weren't running the CM and rendering containers never attempt to start preventing other containers from running. Deleting the scale setting corrects the issue.
JSS Containers setup, CM container does not start or attempt to start I'm following the JSS walkthrough with container and I'm running into an issue running the up.ps1 script. Most of the script runs fine, but when it goes to start the containers the cm container doesn't start or doesn't attempt to start. This is preventing the traefik and rendering containers from starting and the rest of the script to fail. Running docker-compose ps I can confirm the CM container isnt' running. Starting Sitecore environment... time=&quot;2021-11-12T12:03:20-06:00&quot; level=warning msg=&quot;`scale` is deprecated. Use the `deploy.replicas` element&quot; time=&quot;2021-11-12T12:03:20-06:00&quot; level=warning msg=&quot;`scale` is deprecated. Use the `deploy.replicas` element&quot; [+] Running 13/13 - Network jsssandbox_default Created 0.3s - Container jsssandbox-mssql-1 Started 15.0s - Container jsssandbox-solr-1 Started 15.3s - Container jsssandbox-mssql-init-1 Started 58.7s - Container jsssandbox-solr-init-1 Started 62.2s - Container jsssandbox-id-1 Started 67.5s - Container jsssandbox-xconnect-1 Started 81.5s - Container jsssandbox-xdbsearchworker-1 Started 145.6s - Container jsssandbox-xdbautomationworker-1 Started 145.5s - Container jsssandbox-cortexprocessingworker-1 Started 145.8s - Container jsssandbox-cm-1 Created 0.1s - Container jsssandbox-traefik-1 Created 0.1s - Container jsssandbox-rendering-1 Created 0.1s no containers to start Waiting for CM to become available... Invoke-RestMethod : Unable to connect to the remote server At F:\Projects\jss-sandbox\up.ps1:27 char:19 + ... $status = Invoke-RestMethod &quot;http://localhost:8079/api/http/routers ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand PS F:\Projects\jss-sandbox> docker-compose ps time=&quot;2021-11-12T12:09:07-06:00&quot; level=warning msg=&quot;`scale` is deprecated. Use the `deploy.replicas` element&quot; time=&quot;2021-11-12T12:09:07-06:00&quot; level=warning msg=&quot;`scale` is deprecated. Use the `deploy.replicas` element&quot; NAME COMMAND SERVICE STATUS PORTS jsssandbox-cm-1 &quot;powershell C:/tools…&quot; cm created jsssandbox-cortexprocessingworker-1 &quot;C:\\LogMonitor\\LogMo…&quot; cortexprocessingworker running (healthy) jsssandbox-id-1 &quot;dotnet.exe .\\Siteco…&quot; id running (healthy) 80/tcp jsssandbox-mssql-1 &quot;powershell -Command…&quot; mssql running (healthy) 0.0.0.0:14330->1433/tcp jsssandbox-mssql-init-1 &quot;powershell -Command…&quot; mssql-init running (healthy) jsssandbox-rendering-1 &quot;cmd /S /C \&quot;npm run …&quot; rendering created jsssandbox-solr-1 &quot;powershell -Command…&quot; solr running (healthy) 0.0.0.0:8984->8983/tcp jsssandbox-solr-init-1 &quot;powershell -Command…&quot; solr-init exited (0) jsssandbox-traefik-1 &quot;/traefik --ping --a…&quot; traefik created jsssandbox-xconnect-1 &quot;C:\\LogMonitor\\LogMo…&quot; xconnect running (healthy) 0.0.0.0:8081->80/tcp jsssandbox-xdbautomationworker-1 &quot;C:\\LogMonitor\\LogMo…&quot; xdbautomationworker running (healthy) jsssandbox-xdbsearchworker-1 &quot;C:\\LogMonitor\\LogMo…&quot; xdbsearchworker running (healthy) I am however able to start each container individually with docker start and after giving them time to startup confirm they are healthy and I can log into the CM site. Any ideas what could be be going on with docker-compose up in up.ps1 script? PS F:\Projects\jss-sandbox> docker start jsssandbox-cm-1 jsssandbox-cm-1 PS F:\Projects\jss-sandbox> docker start jsssandbox-traefik-1 jsssandbox-traefik-1 PS F:\Projects\jss-sandbox> docker start jsssandbox-rendering-1 jsssandbox-rendering-1 PS F:\Projects\jss-sandbox> docker-compose ps time=&quot;2021-11-12T12:12:00-06:00&quot; level=warning msg=&quot;`scale` is deprecated. Use the `deploy.replicas` element&quot; time=&quot;2021-11-12T12:12:00-06:00&quot; level=warning msg=&quot;`scale` is deprecated. Use the `deploy.replicas` element&quot; NAME COMMAND SERVICE STATUS PORTS jsssandbox-cm-1 &quot;powershell C:/tools…&quot; cm running (healthy) 80/tcp jsssandbox-cortexprocessingworker-1 &quot;C:\\LogMonitor\\LogMo…&quot; cortexprocessingworker running (healthy) jsssandbox-id-1 &quot;dotnet.exe .\\Siteco…&quot; id running (healthy) 80/tcp jsssandbox-mssql-1 &quot;powershell -Command…&quot; mssql running (healthy) 0.0.0.0:14330->1433/tcp jsssandbox-mssql-init-1 &quot;powershell -Command…&quot; mssql-init exited (0) jsssandbox-rendering-1 &quot;cmd /S /C \&quot;npm run …&quot; rendering running 3000/tcp jsssandbox-solr-1 &quot;powershell -Command…&quot; solr running (healthy) 0.0.0.0:8984->8983/tcp jsssandbox-solr-init-1 &quot;powershell -Command…&quot; solr-init exited (0) jsssandbox-traefik-1 &quot;/traefik --ping --a…&quot; traefik running (healthy) 0.0.0.0:443->443/tcp, 0.0.0.0:8079->8080/tcp jsssandbox-xconnect-1 &quot;C:\\LogMonitor\\LogMo…&quot; xconnect running (healthy) 0.0.0.0:8081->80/tcp jsssandbox-xdbautomationworker-1 &quot;C:\\LogMonitor\\LogMo…&quot; xdbautomationworker running (healthy) jsssandbox-xdbsearchworker-1 &quot;C:\\LogMonitor\\LogMo…&quot; xdbsearchworker running (healthy)
No. WFFM 9.0 update-2 supports up to XP 9.0 update-2. No further releases of WFFM has been made. Full information here: Web Forms for Marketers – compatibility tables
Does sitecore 10.1 support wffm(webform for marketers)? Getting error on adding wffm form rendering on presentation details.Tried to install wffm modules but nothing worked at my end.Can anyone tell me does sitecore 10.1 support wffm forms?
We have encountered exact the same problem with the null datasource in Sitecore v. 9.3 and Glass.Mapper v. 5.6. As a workaround we have implemented our base Controller with the explicit datasource retrieval by id, language and version as follows: var options = new GetItemByIdOptions(id) { Language = language, Version = version }; var datasource = SitecoreContext.SitecoreService.GetItem<TDatasource>(options); if (datasource == null) { options.Language = Sitecore.Context.Language; datasource = SitecoreContext.SitecoreService.GetItem<TDatasource>(options); } Where id, language and version we get from a RenderingContext.Rendering.DataSource string using a regular expression. Then we inherited all our controllers from the base one to apply the datasource fix across all the concerned components. To begin with it will be enough to implement the fix only for components participating in the A/B testing. Also it will be safe to ensure that both enableItemLanguageFallback and enableFieldLanguageFallback settings are set to true in the config file.
A/B testing of components using Glass Mapper return "Data source invalid." I am using Sitecore 9.3 with Glass Mapper 5.8.177 and component A/B testing does not work for me. I set up a simple component that works perfectly fine until I begin creating variants for A/B testing of this component. For both variants I am getting the &quot;Data source is invalid.&quot; error. I saw this was an issue previously and there were some PR that was merged saying that this was fixed in the version I am using but it still does not seem to be working for me. The problematic method is: var datasource = MvcContext.GetDataSourceItem<T>(); which returns null. After debugging it seems that the item is resolved correctly until the ItemVersionCountByRevisionTask, void Execute(ObjectConstructionArgs args) method is reached. The condition below fails because the Revision field does not exist in the Item Fields if (scContext != null &amp;&amp; options != null &amp;&amp; options.VersionCount &amp;&amp; scContext.Item != null &amp;&amp; scContext.Item.Fields[FieldIDs.Revision].GetValue(allowStandardValue: false).IsNullOrEmpty()) { args.Result = null; } Debugger shows that the scContext.Item.Fields do not contain the Revision field, that is why it returns null. The only field which is visible in my item while debugging is &quot;__Originator&quot;-{F6D8A61C-2F84-4401-BD24-52D2068172BC}. There are also no custom fields mapped as well. I tried setting A/B testing also for different components - the same issue for all of them. All of the components inherit from StandardTemplate and Revision field is present on the items when I check that from Sitecore. Also, all of the components are being displayed and are working fine as long as no A/B testing is used. When I check MvcContext.DataSourceItem value after MvcContext.GetDataSourceItem<T>(); it seems that the items were set correctly in the DataSourceItem, they are just unable to be mapped to a model. Any ideas on what is happening here and how to resolve these issues would be more than welcome.
Just for everyone's benefit: Finally found the root cause of the connectivity issue between app services. As part Azure DevOps migration to new server a new Route to the Route table was added which was causing the traffic from inside the ASE to be routed out causing communication outage. This route was deleted and so the connectivity was restored &amp; then Sitecore Analytics was enabled back which was temporarily disabled earlier. For more details check out my blog : https://ratishkr81.blogspot.com/2021/12/sitecore-performance-issue-on-page-load.html
Performance issue on page load Sitecore.Analytics BLOCKED_TIME Background of Infra/Software: Sitecore Product Version: 9.2 Sitecore XP Scaled topology used. Infrastructure Type: Azure App Service / PaaS inside Isolated ASE Issue: Experiencing slowness in Page load, sometimes it is taking more than a minute. On checking the Profiler trace we found that the Sitecore analytics process is getting blocked while creating a tracker object. Stack trace OTHER <<ntdll!RtlUserThreadStart>> Sitecore.Mvc!Sitecore.Mvc.Routing.RouteHttpHandler.BeginProcessRequest Sitecore.Mvc!Sitecore.Mvc.Pipelines.PipelineService.RunPipeline Sitecore.Kernel!Sitecore.Pipelines.DefaultCorePipelineManager.Run Sitecore.Kernel!Sitecore.Pipelines.DefaultCorePipelineManager.Run Sitecore.Kernel!Sitecore.Pipelines.CorePipeline.Run Sitecore.Mvc.Analytics!dynamicClass. Sitecore.Mvc.Analytics!Sitecore.Mvc.Analytics.Pipelines.MvcEvents.RequestBegin.StartTracking.Process Sitecore.Analytics.XConnect!Sitecore.Analytics.XConnect.Diagnostics.PerformanceCounters.OperationPerformanceMonitorExtensions.Monitor Sitecore.Analytics.XConnect!Sitecore.Analytics.XConnect.Diagnostics.PerformanceCounters.OperationPerformanceMonitorExtensions+<>c__DisplayClass1... Sitecore.Kernel!Sitecore.Pipelines.CorePipeline.Run Sitecore.Analytics!dynamicClass. Sitecore.Analytics!Sitecore.Analytics.Tracker.Initialize Sitecore.Kernel!Sitecore.Pipelines.DefaultCorePipelineManager.Run Sitecore.Kernel!Sitecore.Pipelines.DefaultCorePipelineManager.Run Sitecore.Kernel!Sitecore.Pipelines.CorePipeline.Run Sitecore.Analytics!dynamicClass. Sitecore.Analytics!Sitecore.Analytics.Pipelines.CreateTracker.GetTracker.Process Sitecore.Analytics!Sitecore.Analytics.DefaultTracker.EnsureSessionContext Sitecore.Analytics.XConnect!Sitecore.Analytics.XConnect.Diagnostics.PerformanceCounters.OperationPerformanceMonitorExtensions.Monitor Sitecore.Analytics.XConnect!Sitecore.Analytics.XConnect.Diagnostics.PerformanceCounters.OperationPerformanceMonitorExtensions+<>c__DisplayClass1... Sitecore.Analytics!Sitecore.Analytics.Pipelines.EnsureSessionContext.EnsureSessionContextPipeline+<>c__DisplayClass4_0.<Run>b__0 Sitecore.Kernel!Sitecore.Pipelines.DefaultCorePipelineManager.Run Sitecore.Kernel!Sitecore.Pipelines.DefaultCorePipelineManager.Run Sitecore.Kernel!Sitecore.Pipelines.CorePipeline.Run Sitecore.Analytics!dynamicClass. Sitecore.Analytics!Sitecore.Analytics.Pipelines.EnsureSessionContext.LoadContact.Process Sitecore.Analytics!Sitecore.Analytics.Tracking.ContactManager.LoadContact Sitecore.Analytics!Sitecore.Analytics.Data.ContactRepository.LoadContact Sitecore.Analytics.XConnect!Sitecore.Analytics.XConnect.Diagnostics.PerformanceCounters.OperationPerformanceMonitorExtensions.Monitor Sitecore.Analytics.XConnect!Sitecore.Analytics.XConnect.DataAccess.XConnectDataAdapterProvider+<>c__DisplayClass15_0.<LoadContact>b__0 Sitecore.Analytics.XConnect!Sitecore.Analytics.XConnect.DataAccess.XConnectDataAdapterProvider.ExecuteWithExceptionHandling Sitecore.XConnect.Client.Configuration!Sitecore.XConnect.Client.Configuration.SitecoreXConnectClientConfiguration.GetClient Sitecore.Kernel!Sitecore.Configuration.DefaultFactory.CreateObject Sitecore.Kernel!Sitecore.Configuration.DefaultFactory.CreateObject Sitecore.Kernel!Sitecore.Configuration.DefaultFactory.CreateObject Sitecore.XConnect.Client.Configuration!Sitecore.XConnect.Client.Configuration.SitecoreXConnectClientConfiguration.Initialize Sitecore.XConnect.Client!Sitecore.XConnect.Client.XConnectSynchronousExtensions.SuspendContextLock Sitecore.Xdb.Common.Web!Sitecore.Xdb.Common.Web.Synchronous.SynchronousExtensions.SuspendContextLock Sitecore.Xdb.Common.Web!Sitecore.Xdb.Common.Web.Synchronous.CurrentThreadTaskScheduler.ProcessTaskQueue OTHER <<System!System.Collections.Concurrent.BlockingCollection`1+<GetConsumingEnumerable>d__68[System.__Canon].MoveNext BLOCKED_TIME OTHER <<clr!JITutil_MonTryEnter>> BLOCKED_TIME LAST_BLOCK (Last blocking operation in trace) BLOCKED_TIME
Updated gulp version to at least 4.0.0 on the project. This solved the issue.
Nothing happening when running "sxa init" hoping someone can help. I have successfully installed the SXA CLI as the pre-perquisites to setting up an SXA theme in Sitecore 10.1, I'm following the next steps but hitting a snag I think when trying to run &quot;sxa init&quot;. It has been hanging on this message for a while now because I'm not sure what to expect from this task, is this normal? does it just take time? or is something wrong? Any advice would be appreciated!
This issue is not related to the upgrade directly, though it might be classified as a side effect. There is no any &quot;main&quot; placeholder in the provided Layout: @Html.Sitecore().Placeholder(&quot;main&quot;) The easiest way is to add the &quot;main&quot; placeholder definition just below the &quot;main-content&quot; one to your Layout.
Components not visible after upgrade to Sitecore 10.1 I have upgraded from Sitecore 8.2 to Sitecore 10.1. The layouts are rendered fine but none of the components are rendering. Seems like the placeholders are not working. Some of the components are using a main placeholder. If I change the placeholder name to body-top then components start rendering as expected. This is the main layout @if (!string.IsNullOrEmpty(strBodyTag)) { @Html.Raw(strBodyTag) } @Html.Sitecore().Placeholder(&quot;body-top&quot;) @Html.Sxa().GridBody() @Html.Sitecore().Placeholder(&quot;body-bottom&quot;) @Html.Sitecore().Placeholder(&quot;main-content&quot;) @foreach (string script in assetLinks.Scripts) { @Html.Raw(script) } <!-- /#wrapper --> Do I need to add anything to the layout to render the components properly? Any help or suggestion would be appreciated.
There are 4 factors which have impact on the checkbox: Xdb.Enabled setting Xdb.Tracking.Enabled setting Analytics.AutoDetectBots setting and result of XdbSettings.HasValidLicense call. If I remember correctly, if you can open /sitecore/client/Applications/ExperienceAnalytics/Dashboard url without errors, that means that license is valid for xDB. Have you changed any of the settings or license file after you tried Forms Editor for the first time? Maybe it's cached that checkbox should be disabled? You can try the following url /formbuilder/load?id=&amp;sc_formmode=new&amp;sc_formlang=en&amp;sc_site=shell&amp;_=SOME_RANDOM_VALUE and see the source of the response. It's not easy to read it but you should see something like isRobotDetectionAvailable&amp;quot;:true,&amp;quot; or false. If you see true in response, try new incognito browser or potentially even recycle Sitecore. I checked that in Sitecore 10.1.1 FormViewModel depends on IRobotDetection. Check in showconfig if you have an implementation of IRobotDetection registered, most probably like that: <register serviceType=&quot;Sitecore.ExperienceForms.Tracking.IRobotDetection, Sitecore.ExperienceForms&quot; implementationType=&quot;Sitecore.ExperienceForms.Analytics.Tracking.RobotDetection, Sitecore.ExperienceForms.Analytics&quot; lifetime=&quot;Transient&quot; patch:source=&quot;Sitecore.ExperienceForms.Tracker.config&quot;/> In Sitecore 10.1.0 there is no IRobotDetection. Instead there is RobotDetectionHelper which uses the following code: public static bool IsRobotDetectionAvailable => Settings.GetBoolSetting(&quot;Xdb.Enabled&quot;, false) &amp;&amp; Settings.GetBoolSetting(&quot;Xdb.Tracking.Enabled&quot;, false) &amp;&amp; Settings.GetBoolSetting(&quot;Analytics.AutoDetectBots&quot;, false); You may create a test page or just try it in debug to see what are the values of those setting in your web app and which of them is causing issues.
Enable Robot Detection in 10.1 Forms After upgrading from 9.3 to 10.1, the 'Robot detection enabled' checkbox is uncheackable in form settings. Compared with docs: Xdb enabled XdbTracking enabled AutoDetectBots enabled @Html.Sitecore().VisitorIdentification() is used on the layout What else should I check to make it configurable?
Sitecore's built-in Tasks -> Schedulers functionality works well when you need to execute a task occasionally, but it becomes problematic if you require to run some routine at a certain time every day. You can schedule a task to run every 24 hours, but you cannot ensure that it will run at exact the same time every day because of the interval-based nature of the scheduled execution. Task schedule in Sitecore is based on the interval execution, not on the absolute time. Sitecore periodically performs a check for any tasks that are due to run. Time between checking for scheduled tasks waiting to execute is defined in Sitecore config file, see scheduling -> frequency setting. Therefore, it is almost impossible to schedule a task to execute at the specific hour and minute of a day.
Sitecore Scheduled task runs on startup I'm using Sitecore 9.3, I have a custom scheduled task for rebuilding the Sitecore search index at night. My project is hosted on Azure environment, I noticed that if I restart the CM app service then the task gets triggered and rebuilds the index as a result. I don't want that, I tried to reproduce the issue on my machine, but it didn't happen. Schedule time is: 20210803T235900||127|23:59:00
After some investigation, I resolved this issue by disabling TLS 1.3 over TCP. Open PowerShell as an admin and run the below commands 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 More detail you can find here
Sitecore 10 Installation Error: Failed to Start Service 'Sitecore Marketing Automation Engine' while an instance of 9.0.2 also running on my system Note: I have multiple Solr installed on my local environment one is for the previous version and now I have added Solr for Sitecore 10 on port 8984 So my Solr path for the Sitecore 10 is https://localhost:8984/solr/ I keep getting the same error and I have tried following steps to fix the issue with no luck we have tried removing all the certificates except the certificate for solr we have tried uninstall and reinstall the iis Have enabled all the IIS features that are required Tried running the following script with no result Get-Childitem cert:\LocalMachine\root -Recurse | Where-Object {$.Issuer -ne $.Subject} also tried the solution mentioned in the following links as well with no luck at all. Sitecore 9.3 Installation failing - &#39;Failed to start the Marketing Automation Engine service Failed to start the Marketing Automation Engine service - installation sitecore 10 Getting Error - Failed to start the Marketing Automation Engine service - While installing Sitecore 9.2 via SIA Updated: After reading some comments I am updating the errors that are shown under the logs file on this location: App_Data\jobs\continuous\AutomationEngine\App_Data\Logs Error1: 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. at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.Xdb.Common.Web.CommonWebApiClient`1.<SendAsync>d__47.MoveNext() --- End of inner exception stack trace --- Error2: Failed to start the Marketing Automation Engine service. System.InvalidOperationException: This configuration has not been initialized. Please call the initialize method before using it. at Sitecore.XConnect.Client.XConnectClientConfiguration.CheckInitialized() at Sitecore.XConnect.Client.XConnectClientConfiguration.get_CurrentModel() at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider) at Sitecore.XConnect.Configuration.Extensions.<>c__DisplayClass33_0.<UseServiceDecorator>b__1(IServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitTransient(TransientCallSite transientCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitIEnumerable(IEnumerableCallSite enumerableCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.<RealizeService>b__0(ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider) at Sitecore.Xdb.MarketingAutomation.Engine.App.ServiceConfiguration.get_Engine() at Sitecore.Xdb.MarketingAutomation.Engine.App.EngineService.OnStart(String[] args)
Full workflow to track any events: Connect website with Sitecore CDP: Navigate to CDP -> System Settings -> API Access and copy Client Key value: Navigate to CDP -> System Settings -> Points of Sale and create new one with values that match your website hostname: Insert javascript snippet to your website layout, replace client_key, pointOfSale, cookie_domain with your values: <script type = &quot;text/javascript&quot; > var _boxeverq = _boxeverq || [], _boxever_settings = { client_key: &quot;xxxxxxxxxxxxxxxxx&quot;, target: &quot;https://api.boxever.com/v1.2&quot;, cookie_domain: &quot;.website.com&quot;, pointOfSale: &quot;website.com&quot;, web_flow_target: &quot;https://d35vb5cccm4xzp.cloudfront.net&quot; }; ! function() { var e = document.createElement(&quot;script&quot;); e.type = &quot;text/javascript&quot;, e.async = !0, e.src = &quot;https://d1mj578wat5n4o.cloudfront.net/boxever-1.4.8.min.js&quot;; var t = document.getElementsByTagName(&quot;script&quot;)[0]; t.parentNode.insertBefore(e, t) }() < /script> Trigger _boxeverq.push when it is necessary: // Place an anonymous function in the Boxever queue _boxeverq.push(function() { var viewEvent = { &quot;browser_id&quot;: Boxever.getID(), &quot;channel&quot;: &quot;WEB&quot;, &quot;type&quot;: &quot;VIEW&quot;, &quot;language&quot;: &quot;EN&quot;, &quot;currency&quot;: &quot;EUR&quot;, &quot;page&quot;: &quot;/home&quot;, &quot;pos&quot;: &quot;website.com&quot; }; //Add UTM params viewEvent = Boxever.addUTMParams(viewEvent); // Invoke event create // (<event msg>, <callback function>, <format>) Boxever.eventCreate(viewEvent, function(data){}, 'json'); }); My custom wrapper for event triggering: export const sendBoxeverEvent = (type, options, callback) => { const { page, currency } = options; _boxeverq.push(function () { const boxeverEvent = { browser_id: Boxever.getID(), channel: 'WEB', type: type, language: getCookie('lang').toUpperCase() || 'EN', pos: window.location.host, currency: currency || 'EUR', page: page || '/' }; Boxever.eventCreate( boxeverEvent, function (data) { if (callback) callback(); }, 'json' ); }); }; // example of usage: sendBoxeverEvent('VIEW', {page: window.location.pathname}); Once javascript _boxeverq.push is triggered, you can see JS request with your values to api.boxever.com in browser Network tab: This means that yout event was successfully pushed to Sitecore CDP. BUT: if your website visitor is anonymous, you will NOT find this event immideatelly in CPD guest Interactions Timeline tab. But if your visitor is identified - you will see it almost immideatelly: To Identity your visitor you need to push IDENTITY event to Sitecore CDP. Example: _boxeverq.push(function() { var identityEvent = { &quot;browser_id&quot;: Boxever.getID(), &quot;channel&quot;: &quot;WEB&quot;, &quot;type&quot;: &quot;IDENTITY&quot;, &quot;language&quot;: &quot;EN&quot;, &quot;currency&quot;: &quot;EUR&quot;, &quot;page&quot;: &quot;/home&quot;, &quot;pos&quot;: &quot;website.com&quot;, &quot;email&quot;: &quot;[email protected]&quot;, &quot;firstName&quot;: &quot;First&quot;, &quot;lastName&quot;: &quot;Last&quot; }; Boxever.eventCreate(identityEvent , function(data){}, 'json'); }); P.S. For easy debugging: if your visitor is identified, you can see full user + sessions + events + orders realtime information in Test Canvas tool of any Decision Model, if you select your user: See more information on Sitecore Knowledge Hub.
Send tracking data to Sitecore CDP I am currently working with Sitecore CDP. I have Sitecore site .when user visit the site , I need to capture the user Interactions using Sitecore CDP, In Official Document I found JavaScript snippet to track the visitor Action but pageviews are not tracked. Can anyone help me to resolve this? Thanks in advance.
This depends entirely on your requirements. Separate applications would enable you to develop, deploy, and scale sites independently. Components and other code could be shared via npm packages. A shared, multi-site application could save cost via easier deployment and less infrastructure. Next.js can now support multi-site applications in the same &quot;rendering host&quot; for both SSG (getStaticProps) and SSR (getServerSideProps). For SSG, as of Next.js 12 you can use middleware to map that host name to a Sitecore site name, and alter the incoming URL path to a page route which includes the site name as a route parameter. That site name could then be passed to the Layout Service. Example here. For SSR, you can find the current host name in req.headers.host and map it to a Sitecore site name, which you pass to the Layout Service. Example here.
How to configure multisite in Sitecore Next.js application? How do you implement a multisite setup with Sitecore and Next.js, with a Sitecore First Approach? Do we need to create separate Next.js apps for each site or we can we configure it in the same default Next.js app? Which one is the preferred?
client.Interactions uses xDB indexes to get the data. I recommend you to check if the indexing of anonymous contacts is enabled or if there are interactions with required data for known contacts. If the issue is still reproducible after that, you can check the query which is executed on SOLR when you run your code: https://spl-tricks.github.io/2019/09/07/SOLRQueryReplaying/
Sitecore 10.1 standalone instance always brings 0 interactions I've tried this code, taken almost directly from Sitecore documentation (they are using Goal, I'm using PageViewEvent). var itemId = <some id of an Item in content>; using (var client = Sitecore.XConnect.Client.Configuration.SitecoreXConnectClientConfiguration.GetClient()) { queryable = client.Interactions.Where(x => x.Events.OfType<Sitecore.XConnect.Collection.Model.PageViewEvent>().Any(y => y.ItemId == itemId.Guid)); if (queryable == null) return totalCount; Sitecore.XConnect.Client.Synchronous.IEntityBatchEnumerator<Interaction> enumerable = queryable.GetBatchEnumeratorSync(); while (enumerable.MoveNext()) { foreach (Interaction interaction in enumerable.Current) { int pageVisits = interaction.Events.OfType<Sitecore.XConnect.Collection.Model.PageViewEvent>().Count(x => x.ItemId == itemId.Guid &amp;&amp; x.ItemLanguage == Sitecore.Context.Language.Name); if (uniqueVisits) { pageVisits = pageVisits > 0 ? 1 : 0; } totalCount += pageVisits; } } } This always 0 returns for totalCount. On closer inspection, I found that the actual interactions are 0 (i.e. client.Interactions even without filtering, returns a totalCount of 0). I check the analytics reports and I see page visits, even to the particular item I'm using, so it appears that data exists. Any idea why this is happening, and/or what I'm doing wrong here?
The simplest method is just save that item. Sitecore will do the rest. There is an event handle: <handler type=&quot;Sitecore.Links.ItemEventHandler, Sitecore.Kernel&quot; method=&quot;OnItemSaved&quot;/> It calls `LinkDatabase.UpdateItemVersionReferences` method passing saved item. Another option is to call Sitecore.Globals.LinkDatabase.UpdateItemVersionReferences or Sitecore.Globals.LinkDatabase.UpdateReferences from custom code or script.
Link Database - rebuild specific items instead of whole database Anyone know if there is a way to rebuild specific items in link database through a custom script targeting specific items to rebuild links to? OOB Sitecore only supports rebuilding the whole link database and depending on the size this could take many hours.
You need to set the Culture of your running Thread to what you need. Sitecore's admin pages run in a specific culture context based on your logged in user; this will not be the case on a Scheduled Task. Something like var cultureInfo = CultureInfo.GetCultureInfo(&quot;en-US&quot;); Thread.CurrentThread.CurrentCulture = cultureInfo; Thread.CurrentThread.CurrentUICulture = cultureInfo; And then run your ImportFiles method.
Code on German server parsing data correctly when run from admin page, but incorrectly when run as scheduled task I posted this on https://stackoverflow.com/questions/70023408/aspose-worksheet-not-parsing-decimal-numbers-correctly-on-german-server-ignorin as well but figured I would frame it as a Sitecore question here. I have a scheduled task that parses a .dat file as an Aspose Worksheet. It works as expected locally, but on the German server, it parses decimals incorrectly, ignoring the period delimiter. As an example, here are the logs from my local: 27908 10:47:59 INFO Value: 2074.927 StringValue: 2074.927 DoubleValue: 2074.927 27908 10:48:02 INFO Convert.ToDouble Value: 2074.927, 2074.927 27908 10:48:04 INFO DoubleValue: 2074.927, 2074.927 27908 10:48:07 INFO StringValue: 2074.927 27908 10:48:10 INFO FloatValue: 2074.927, 2074.927 27908 10:48:21 INFO StringValueWithoutFormat: 2074.9270000000001 27908 10:48:24 INFO IntValue: 2074 and from the production server: ManagedPoolThread #12 15:36:04 INFO Value: 2074927 StringValue: 2.074.927 DoubleValue: 2074927 ManagedPoolThread #12 15:36:04 INFO Convert.ToDouble Value: 2074927, 2074927 ManagedPoolThread #12 15:36:04 INFO DoubleValue: 2074927, 2074927 ManagedPoolThread #12 15:36:04 INFO StringValue: 2.074.927 ManagedPoolThread #12 15:36:04 INFO FloatValue: 2074927, 2074927 ManagedPoolThread #12 15:36:04 INFO StringValueWithoutFormat: 2074927 ManagedPoolThread #12 15:36:04 INFO IntValue: 2074927 You can see that both cellInfo.StringValue is incorrect (using periods instead of commas) as well as cellInfo.DoubleValue (omitting period entirely). The issue is that the code parses the numbers correctly when run from the admin page, as a logged in user Here is the scheduled task code: public class DataUploader : Uploader { public void Execute(Item[] items, Sitecore.Tasks.CommandItem command, ScheduleItem scheduleItem) { if (!IsDue(scheduleItem)) { return; } using (new Sitecore.Globalization.LanguageSwitcher(&quot;en-US&quot;)) { var count = ImportFiles(); } } ...and the admin page code: protected void btnFtpTrialsImport_OnClick(object sender, EventArgs e) { try { var uploader = new DataUploader(); var resultsMessage = uploader.ImportFiles(); litResults.Text = resultsMessage; } catch (Exception ex) { litResults.Text = ex.Message; } } both of them use the ImportFiles() in the DataUploader class. As you can see in the Excecute method, I tried to set the language to &quot;en-US&quot;, but that didn't help. I also tried logging in as the admin user within the task, but that threw an error if (Sitecore.Security.Authentication.AuthenticationManager.Login(&quot;sitecore\\admin&quot;)){ ... Why is it parsing differently when running as a scheduled task, and how do I fix it?
You're running in Docker Compose V2 mode. Run the following command: docker-compose disable-v2 Ref: https://stackoverflow.com/questions/68010612/error-response-from-daemon-unrecognised-volume-spec-file-pipe-docker-engi/70039471
Sitecore 10.2 Docker Deploy exits with Named Pipes Error I have recently installed Docker Desktop for Windows, version 20.10.10. It is running in Windows Container mode. I am running Windows 10 Pro Version 20H2. I am going through the Sitecore XP 10.2.0 Developer Workstation Deployment With Docker as per this this guide. I have downloaded the Sitecore 10.2 Container Deployment Package. I have chose the ltsc2019 version of Windows, and XP0 topology. I have successfully run the composer-init.ps1 script. However, when I run docker-compose.exe up --detach, once the downloads are complete I receive the following error: [+] Running 11/11 - Network sitecore-xp0_default Created 0.5s - Container sitecore-xp0-mssql-1 Created 0.1s - Container sitecore-xp0-solr-1 Created 0.1s - Container sitecore-xp0-mssql-init-1 Created 0.1s - Container sitecore-xp0-solr-init-1 Created 0.1s - Container sitecore-xp0-id-1 Created 0.1s - Container sitecore-xp0-xconnect-1 Created 0.1s - Container sitecore-xp0-xdbautomationworker-1 Created 0.1s - Container sitecore-xp0-xdbsearchworker-1 Created 0.1s - Container sitecore-xp0-cortexprocessingworker-1 Created 0.2s - Container sitecore-xp0-cm-1 Created 0.2s - Container sitecore-xp0-traefik-1 Creating 0.1s Error response from daemon: Unrecognised volume spec: file '\\.\pipe\docker_engine' cannot be mapped. Only directories can be mapped on this platform This seems to be related to this section of the docker-compose.yml: volumes: - source: \\.\pipe\docker_engine target: \\.\pipe\docker_engine type: npipe - ./traefik:C:/etc/traefik As a result, I am unable to start all of the Sitecore Containers. I would appreciate some direction on how to resolve this. I haven't been able to find much information on this error. Thanks
This is an agent UrlAgent. You can see its definition in the error: <agent type=&quot;Sitecore.Tasks.UrlAgent&quot; method=&quot;Run&quot; interval=&quot;00:15:00&quot; patch:source=&quot;ProjectName.Web.config&quot; xmlns:patch=&quot;http://www.sitecore.net/xmlconfig/&quot;> <LogActivity>true</LogActivity> </agent> It doesn't have any url defined, that's why it cannot instantiate. There should be second parameter in your config: <agent type=&quot;Sitecore.Tasks.UrlAgent&quot; method=&quot;Run&quot; interval=&quot;00:15:00&quot;> <param desc=&quot;url&quot;>https://<hostname>/sitecore/service/keepalive.aspx</param> <LogActivity>true</LogActivity> </agent>
Error while instantiating agent random error I'm using Sitecore 9.3, Suddenly I faced an error that causes the CM server to be down, and I'm not able to access it. I checked the logs and this is what I found: ERROR Error while instantiating agent. Definition: <agent type=&quot;Sitecore.Tasks.UrlAgent&quot; method=&quot;Run&quot; interval=&quot;00:15:00&quot; patch:source=&quot;ProjectName.Web.config&quot; xmlns:patch=&quot;http://www.sitecore.net/xmlconfig/&quot;><LogActivity>true</LogActivity></agent> This is the OOB Sitecore task, I don't know why this happen, we have many scheduled tasks, but all run as usual and this happened suddenly out of the blue.
You have pagination in the ribbon:
Paging for Site Manager I have few sites but I can't see all of them on the same page in Site Manager. There are presented in 2 pages but I don't see any option to go to page 2 which make hard to manage sites. Is there any configuration for making pagination visible?
After contacting Sitecore Support the issue was related to a missing parameter that should be passed to the commerce roles through docker compose file as we are using docker, the missing parameter is [COMMERCEENGINE_AppSettings__AllowedOrigins]
Rebuild Commerce indexes not working Running into issue with Sitecore Commerce 10.1 when clicking Add to Cart button where I see &quot;Errors&quot;:[&quot;AddCartLine: Unable to find the product in the catalog.&quot;], in the json response, looking into Solr and it looks like the sellable items are not being indexed, triggering Run FullIndex Minion - Catalog Items is not updating the index as it should, looked into Minions log and couldn't find any errors, any thoughts what could be the issues?
You can both, create new web template or extend existing one. Example, how to extend existing Email Corner PopUp: Add first name, last name, gender in HTML markup. It`ll look like: <div> <input type=&quot;email&quot; name=&quot;bx-email_input&quot; class=&quot;bx-email_input input-box&quot; id=&quot;bx-email_input&quot; placeholder=&quot;[[ Input Ghost Text | string | Email | { required: true , group: Email Input, groupOrder: 4, order: 1 } ]]&quot;> <input type=&quot;text&quot; name=&quot;bx-firstname_input&quot; id=&quot;bx-firstname_input&quot; placeholder=&quot;[[ Input Firstname Text | string | First name | { required: true } ]]&quot;> <input type=&quot;text&quot; name=&quot;bx-lastname_input&quot; id=&quot;bx-lastname_input&quot; placeholder=&quot;[[ Input Lastname Text | string | Last name | { required: true } ]]&quot;> <select id=&quot;bx-gender_input&quot; name=&quot;bx-gender_input&quot;> <option value=&quot;male&quot;>Male</option> <option value=&quot;female&quot;>Female</option> </select> <a id=&quot;bx-transition-card--primary&quot; class=&quot;options-container__primary&quot;>[[ Button Text | string | Submit | {required: true,max: 15, group: Submit Button, order: 1 } ]]</a> </div> Pay attention on placeholders markup: https://doc.sitecore.com/cdp/en/users/sitecore-customer-data-platform/create-a-form-for-a-web-template.html Once HTML with parameters added, you will see corresponding placeholder inputs in template: Add CSS styles on CSS tab. Extend Javascript to pass new parameters in IDENTITY request: bxCTA.onclick = function(){ let bxEmail = document.getElementById(&quot;bx-email_input&quot;).value; let firstname = document.getElementById(&quot;bx-firstname_input&quot;).value; let lastname = document.getElementById(&quot;bx-lastname_input&quot;).value; let gender = document.getElementById(&quot;bx-gender_input&quot;).value; let emailVerified = validateEmail(bxEmail); emailVerified ? onSuccessValidation(bxEmail, firstname, lastname, gender) : //friendly error document.getElementById(&quot;bx-email_input&quot;).style.backgroundColor = 'rgba(200,0,0,0.1)'; }; const onSuccessValidation = function(email, firstname, lastname, gender){ sendInteractionToBoxever(&quot;IDENTITY&quot;) let event = { &quot;channel&quot;: &quot;WEB&quot;, &quot;type&quot;: &quot;IDENTITY&quot;, &quot;language&quot;: &quot;EN&quot;, &quot;currency&quot;: &quot;EUR&quot;, &quot;page&quot;: &quot;Home&quot;, &quot;pos&quot;: &quot;spinair.com&quot;, &quot;browser_id&quot;: Boxever.getID(), &quot;email&quot;:email, &quot;firstNme&quot; : firstname, &quot;lastName&quot; : lastname, &quot;gender&quot; : gender }; Boxever.eventCreate(event, function(data){}, 'json'); bxEmailCaptureContainer.style.display = &quot;none&quot;; let X = document.querySelector(&quot;.bx__btn-close&quot;); X.style.display = &quot;none&quot;; showThankYou(); // flash thank you message setTimeout(function(){ document.querySelector('#bx-transition-card').style.display= 'none'; }, 100); } P.S. You can click Preview button and test your experience in Sitecore CDP QA Tool. Just check that firstname, lastname and gender are included in IDENTITY request on submit:
Tracking User Personal Information in sitecore CDP In sitecore CDP, I'm using Email Corner PopUp template to Track user email address and their Interactions on the site, Now I want to get first name, last name, gender of the user. For this , am I need to create a custom web template or can override an existing one. Can anyone Suggest me the ways to track the Personal Details of the user in sitecore CDP?
NVelocity has been completely and totally removed. SXA has adopted Scriban as a replacement. I believe this was introduced in 9.3: https://doc.sitecore.com/en/developers/sxa/93/sitecore-experience-accelerator/scriban-templates.html Example building a custom function
VelocityContext in Sitecore 10.1 When migrating from Sitecore 8.2 to 10.1. I have encountered the error in VelocityContext This is the code. public class AddTemplateRenderers : IGetTemplateRenderersPipelineProcessor { public void Process(GetTemplateRenderersPipelineArgs args) { args.Context.Put(&quot;linkTool&quot;, new LinkTool()); args.Context.Put(&quot;fieldTool&quot;, new FieldTool()); } } We used this link(https://www.sitecorenutsbolts.net/2018/10/23/Sitecore-SXA-Using-Placeholders-with-NVelocity-Templates/) in Sitecore 8.1 to create the class There is no Sitecore.NVelocity dll for Sitecore 10.1. Is there any alternate for this?
You have a few options on how to achieve this: create a template based on the folder template, set the standard values on this template as pleased and use this one for your folder items at the location use the rules engine to add the insert option. How to this can be found at several locations already so I won't repeat it again: https://sitecore.stackexchange.com/a/15190/237 (or https://www.skillcore.net/sitecore/sitecore-insert-options-rules or https://www.pieterbrinkman.com/2011/05/02/sitecore-rules-engine-how-to-create-an-insert-option-rule/) With the little information I have from your case, I would go for the first option though: create your own folder template and set the insert options as you please.
How do we add insert option to a folder and its child folder How do we apply the insert option to a folder and what ever child folder created inside this folder should have same insert option. How can I achieve this? Applying insert option on parent folder allows the parent folder alone to have the insert option.
I recommend using the Siteimprove and the Sitecore connector. Siteimprove is a brilliant tool for doing SEO and performance audits. https://siteimprove.com/en/core-platform/integrations/cms-plugin/sitecore/ There is another SEO plugin that I have seen used in the Sitecore community is called Avtor. https://www.teamdevelopmentforsitecore.com/Avtor/Sitecore-Seo
SEO plugin for Sitecore I am looking for recommendations of SEO plugins for Sitecore 10. I am aware of Sitecore SEO Toolkit, but as far as I know it doesn't support Sitecore 8+. Our content editors come from WordPress background and are looking for similar capabilities that Yoast or SemRush provided them in WP. Do you have any suggestions for plugins or strategies that enables content editors deal with SEO in an easy way?
I faced the same issue during Sitecore 9, so I noticed a couple of things - Go to Bizfix website under inetpub (C:\inetpub\wwwroot\SitecoreBizFx\assets) and check config.json and check the urls there. Open showconfig (https://xyz/sitecore/showconfig.aspx) and search for shopsServiceUrl and sitecoreIdentityServerUrl, and check if these urls are correct. In my case shopsServiceUrl was wrong. After updating these URLs, just do IISRESET and check again. For more updates visit my blog - https://sitecorerocksblog.wordpress.com/2020/05/20/commerce-catalogs-are-not-showing-for-selection-in-sitecore/
select catalog field is Empty in sitecore Commerce 10 I am working in sitecore commerce 10.I have setup Development Environment in sitecore Commerce 10.after that I could not see the catalog. But in Business tool I can see the catalogs in Merchandising Dashboard. and I couldn't update the data template also. Here are the steps that I tried to resolve: 1.Cleared Caches. 2.Reset iis. 3.Recycle App pool. 4.Bootstrap the application. 5.Rebuild the indexes. but still unable to resolve. can anyone help me to resolve the issue? In log file I found below Error Message ERROR Commerce.Connector - Request URL: GetEntityView() - Exception: System.UriFormatException: Invalid URI: The hostname could not be parsed. at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind) at Sitecore.Commerce.Engine.Connect.DataProvider.CommerceRepository.GetClient(Boolean useCommerceOps, String language, String environment, String currency, String shopName) at Sitecore.Commerce.Engine.Connect.DataProvider.CommerceRepository.InvokeHttpClientPost(String serviceCallUrl, StringContent content, Boolean useCommerceOps, Boolean raiseException, String language, String environment, String currency, String shopName, Nullable`1 effectiveDate, String policyKeys) Exception: System.UriFormatException Message: Invalid URI: The hostname could not be parsed. Source: System at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind) at Sitecore.Commerce.Engine.Connect.DataProvider.CommerceRepository.GetClient(Boolean useCommerceOps, String language, String environment, String currency, String shopName) at Sitecore.Commerce.Engine.Connect.DataProvider.CommerceRepository.InvokeHttpClientPost(String serviceCallUrl, StringContent content, Boolean useCommerceOps, Boolean raiseException, String language, String environment, String currency, String shopName, Nullable`1 effectiveDate, String policyKeys) In business tool the url is run as not secure
You can set text in returnType like below, instead of changing in fieldType <fieldTypes hint=&quot;raw:AddFieldByFieldName&quot;> <field fieldName=&quot;propertyaddressstate&quot; returnType=&quot;text&quot; /> ... </fieldTypes> Then publish and rebuild the index.
Solr index field return types are different We have upgraded to Sitecore 10.1 from Sitecore 8.2 and Solr 8.4 from Solr 6.6.2 We have a droplist field which is PropertyAddressState and after rebuiliding the index it is propertyaddressstate_s rather than propertyaddressstate_t (which is in Solr 6.6.2). Here is the code to filter state filterPredicate.And(x => x.PropertyAddressState.Equals(state)); The Sitecore Search log is showing the field propertyaddressstate_t_en:(&quot;nsw&quot;) whereas in the Solr 8.4 the field is propertyaddressstate_s It shows no result because of different field types. How can I force in the code to use propertyaddressstate_t rather than propertyaddressstate_s The droplink is string returnType and by changing to returnType text. It works fine Changing <fieldType fieldTypeName=&quot;icon|droplist|grouped droplist&quot; returnType=&quot;string&quot;/> to <fieldType fieldTypeName=&quot;icon|droplist|grouped droplist&quot; returnType=&quot;text&quot;/> Changing droplist returnType to Text works but is this a good solution?. I am concerned if this will break something else. Any suggestion would be appreciated.
I would recommend the Express Migration tool https://dev.sitecore.net/Downloads/Express_Migration_Tool.aspx if you need the best performance. You can skip file and configuration migration steps and migrate core or/and master DBs only. It works directly with SQL, as a result, it provides the best content migration performance. Despite this tool officially supporting up to 9.0 migration it should work fine for higher versions, I've successfully migrated content to 9.2 without any known issues for several sites.
Sitecore 8.2 to Sitecore 10.1 Content Migration Is there any tool to migrate content from Sitecore 8.2 to Sitecore 10.1. I am creating packages from Sitecore 8.2 and installing in Sitecore 10.1 but that process is very slow and is taking alot of time. Is there any tool available to automate the content migration?
Certification is not necessary to become a Sitecore MVP.
Can non-certified Sitecore developer become Sitecore MVP? Can a non-certified Sitecore developer become Sitecore MVP? Is it requires the latest Sitecore 10 certification, if so?
The sc_site parameter getting constructed using &quot;siteName&quot; parameter which we can set in RestLayoutService and RestDictionaryService. These two are getting initialize in SitecorePagePropsFactory ( if you are using basic_company next.js example) For standalone app which created using cli these two services getting set in layout-service-factory.ts and dictionary-service-factory.ts. So we can easily set sc_site by using RestLayoutService and RestDictionaryService.
How to set layout service within same Next.Js application to access multiple site? We are configuring multiple site within single Next.js application. In experience editor the multisite work perfectly because its passing sc_site parameter as a query string. But in normal mode only default site work, the other site did not work if we browse different hostname other than default site. So in Next.js for normal mode how we pass additional sc_site parameter with site name value? In Next.js there is one class &quot;SitecorePagePropsFactory&quot; and its constructor initializing parameter for layout service. So can we make any change here to pass sc_site parameter to configure multisite or is there any another way? this.dictionaryService = new RestDictionaryService({ apiHost: config.sitecoreApiHost, apiKey: config.sitecoreApiKey, siteName: config.jssAppName, }); this.layoutService = new RestLayoutService({ apiHost: config.sitecoreApiHost, apiKey: config.sitecoreApiKey, siteName: config.jssAppName, });
There is no other way to tell (at least for Clone-Site script) what's the current status. This issue might be caused by known issue in SPE. It often happens when you run a script in CE and switch to other browser tabs. It affects only UI, backend can still work fine. What I would suggest you to do is simply do a quick test and compare number of items for your source and destination sites. Here is a PowerShell snippet. (gci -Path 'site_path' -Recurse).Count If number of items is the same for both sites you can safety assume that script finished without any issues.
Site clone script running for hours I have started cloning a SXA site but it's shows &quot;running script...&quot; on UI. I checked few things Checked logs, found this line Job ended: SPE - &quot;Clone Site&quot; - sitecore\Admin (units processed: ) Checked /sitecore/admin/jobs.aspx there is no Running or Queued jobs. Can I consider it done without any update on UI or shall I wait? How would I know the progress of the operation?
Is there a way to display values which are strings Yes. Solution later. and have duplicates Not really because they are keys and have to be unique. Solution Let's consider following case: Dialog that you can build: Code $dialogOptions = New-Object System.Collections.Specialized.OrderedDictionary # fill values gci -path '/sitecore/content/Home' | % { $dialogOptions.Add($_.Name, $_.ID) } # build dialog $parameters = @() $parameters += @{ Name = &quot;selectedValues&quot;; Options = $dialogOptions; Editor = &quot;checklist&quot;; Title = 'Selected items' } Read-Variable -Parameters $parameters $selectedValues You will have to handle a case with duplicates manually. You can add index numbers into bracelets or something like that.( Sample Item 1 (1), Sample Item 1 (2)) Use this code to check if key already exists in the dictionary: $dialogOptions.Contains($name)
Display values in the dropdown list with duplicate values I have a hash table with keys as Guids and values as string. Of which some of the values are same with different Guids. User will be presented with an prompt which contains a droplist of options and the selected option from the droplist will be selected as an input for next step. In order to achieve this, I'm trying to display values in the drop down list but I'm getting Guids/keys instead. Is there a way to display values which are strings(and have duplicates) instead of Guids? $options = [Ordered]@{} Foreach ($i in $Items) // $Items contains list of items { $options +=@{i.Id = $i.DisplayName} } $options.keys is displaying all the guids $options.values is displaying the names. However when I try to display them to allow users to select an input, I'm getting Guids in the drop-down list $props = @{ Parameters = @( @{ Name = &quot;Name&quot;; Title = &quot;Name&quot;; Options = $options } ) } Displaying in the dialog Using: $name =Read-Variable @props
1. As you noticed, Guest extentions support only primitive values. I found only one workaround how to bypass JSON objects to Guest extention: stringify an object (by using JSON.stringify(data)): And it can be parsed when you need to access to object values: (function () { for (var i = 0; i < guest.dataExtensions.length; i++) { if (guest.dataExtensions[i].name === 'Ext' &amp;&amp; guest.dataExtensions[i].key === 'custom') { var ext = guest.dataExtensions[i].values; var test = JSON.parse(ext.test); print(test[0].a); print(test[0].b); return test; } } })(); I agree that this way is not very convenient, but I did not find an alternative. P.S. You can pass any types of data strusture in Events (if you find a solution for your case how to do it at the event level): const boxeverEvent = { browser_id: Boxever.getID(), channel: 'WEB', type: 'YOUR_EVENT_NAME', language: 'EN', pos: window.location.host, currency: currency || 'EUR', page: '/', ext: YOUR_JSON_OBJECT, }; 2. Second way is to do request to your service to get this informations (as alternative to storage in CDP). You can see example in my blog: https://www.brimit.com/blog/cdp-4-how-to-use-ai-connections. If this option is better for your case, let me know, I`ll extend my answer with example.
Create new custom schemas with nested structure in CDP Can anyone confirm around the feasibility to create new schema's or extend/modify existing schemas such as Guest, Order etc. within Sitecore CDP interface. Is there is a way for developers to create New Schemas with nested JSON structure similar to that of Order, Session, Guest, Product etc. within Sitecore CDP/Boxever. As per documentation the only way to include and associate additional information with Guest profile is in the form of attributes - Key/Value pair supported through Data Extensions. We have a use case, where we want to add some customer Loyalty and service request related data which may have a nested structure based on brands and region. Can someone please guide through a way where we can create new schema or extend existing Guest schema to allow nested pair of objects. Note - I have access to the Boxever Sandbox
Add below 2 settings you can find in the index element configuration - <index id=&quot;Coveo_master_index&quot; ...> <enableItemLanguageFallback>true</enableItemLanguageFallback> <enableFieldLanguageFallback>true</enableFieldLanguageFallback> </index> This setting will enable language fallback for you.
Language fallback version not indexing I am struggling with an issue that I can't get my head around of. I have a Sitecore 9.3 solution, for which I installed the Coveo for Sitecore module. The solution is multilingual, 3 languages (Netherlands, Belgium, German), from which the Belgium one was set to have the Netherlands as fallback. Now, in order to have an extra field in the index, I created an IComputedIndexField (Sitecore.ContentSearch.ComputedFields). Checked the component in debug when indexing is triggered, works just fine for the Netherlands and German, but for Belgium, it is not triggered. The site works just fine for years now, having the language fallback set. Does anyone have any ideas what might go wrong here or what I need to change?
Without seeing your full Leprechaun.config file or knowing the version of Leprechaun, I can't say for certain. However, I believe the problem is the <serializationFormatter> section towards the bottom. The type for the latest version of Leprechaun should be: Leprechaun.InputProviders.Sitecore.YamlSerializationFormatterWrapper, Leprechaun.InputProviders.Sitecore. I suspect you have it set to the previous version (for Sitecore CLI 3.0) which was: Sitecore.DevEx.Serialization.Client.Datasources.Filesystem.Formatting.Yaml.YamlSerializationFormatter, Sitecore.DevEx.Serialization.Client. Sitecore CLI made some changes with 4.0 which weren't backwards compatible with Leprechaun. I recommend whenever upgrading Leprechaun, please compare your Leprechaun.config against the one from the GitHub repo that's tagged with the same version.
Sitecore Leprechaun giving error while generating models (Sitecore 10.1) We are using a fresh Sitecore 10 instance in local and trying to set up Leprechaun for generating C# class for respective template and serialization of Sitecore Items under Visual studio solution. Placed config file under &quot;src&quot; folder - \src\Leprechaun.config Placed *.*.module.json under src\Feature\PageContent\Feature.PageContent.module.json <configurations import=&quot;**\*.module.json&quot;> <!-- Base code generation configuration. Use this abstract configuration to override the <defaults> where needed. (leave defaults alone to make config upgrades simpler) --> <configuration name=&quot;DemoSite.Helix&quot; abstract=&quot;true&quot;> <codeGenerator scripts=&quot;$(configDirectory)\Scripts\Glassmapper.csx&quot; outputFile=&quot;$(configDirectory)\$(layer)\$(module)\code\$(layer).$(module).Model.cs&quot; /> <typeNameGenerator type=&quot;Leprechaun.MetadataGeneration.StandardTypeNameGenerator, Leprechaun&quot; singleInstance=&quot;true&quot; namespaceRootPath=&quot;/sitecore/templates/$(layer)/$(module)&quot; keepLeadingUnderscores=&quot;false&quot; /> <templatePredicate rootNamespace=&quot;DemoSite.$(layer).$(module).Templates&quot;> <include name=&quot;Templates&quot; path=&quot;$(layer)/$(module)&quot; /> </templatePredicate> </configuration> <configuration name=&quot;DemoSite.Base&quot; abstract=&quot;true&quot;> <codeGenerator scripts=&quot;$(configDirectory)\Scripts\Glassmapper.csx&quot; outputFile=&quot;$(configDirectory)\$(layer)\$(module)\code\$(layer).$(module).Model.cs&quot; /> <typeNameGenerator type=&quot;Leprechaun.MetadataGeneration.StandardTypeNameGenerator, Leprechaun&quot; singleInstance=&quot;true&quot; namespaceRootPath=&quot;/sitecore/templates/$(layer)/DemoSite/$(module)&quot; keepLeadingUnderscores=&quot;false&quot; /> <templatePredicate rootNamespace=&quot;DemoSite.$(layer).$(module).Templates&quot;> <include name=&quot;Templates&quot; path=&quot;$(layer)/PennFoster/$(module)&quot; /> </templatePredicate> </configuration> <configuration name=&quot;DemoSite.Scaffolding.Base&quot; abstract=&quot;true&quot;> <codeGenerator scripts=&quot;$(configDirectory)\Scripts\Glassmapper.csx&quot; outputFile=&quot;$(configDirectory)\Foundation\Scaffolding\code\$(module).Scaffolding.Model.cs&quot; /> <typeNameGenerator type=&quot;Leprechaun.MetadataGeneration.StandardTypeNameGenerator, Leprechaun&quot; singleInstance=&quot;true&quot; namespaceRootPath=&quot;/sitecore/templates/$(layer)/$(module)&quot; keepLeadingUnderscores=&quot;false&quot; /> <templatePredicate rootNamespace=&quot;$(module).Foundation.Scaffolding.$(module)Templates&quot; /> </configuration> { &quot;namespace&quot;: &quot;Feature.PageContent&quot;, &quot;items&quot;: { &quot;includes&quot;: [ { &quot;name&quot;: &quot;Projects.Feature.PageContent.Templates&quot;, &quot;allowedPushOperations&quot;: &quot;createUpdateAndDelete&quot;, &quot;database&quot;: &quot;master&quot;, &quot;maxRelativePathLength&quot;: &quot;120&quot;, &quot;scope&quot;: &quot;itemAndDescendants&quot;, &quot;path&quot;: &quot;/sitecore/templates/Feature/DemoSite/PageContent&quot; }, { &quot;name&quot;: &quot;Projects.Feature.PageContent.Renderings&quot;, &quot;path&quot;: &quot;/sitecore/layout/renderings/Feature/PageContent&quot;, &quot;allowedPushOperations&quot;: &quot;createUpdateAndDelete&quot;, &quot;database&quot;: &quot;master&quot;, &quot;maxRelativePathLength&quot;: &quot;120&quot;, &quot;scope&quot;: &quot;itemAndDescendants&quot; } ] }, &quot;leprechaun&quot;: { &quot;configuration&quot;: { &quot;@extends&quot;: &quot;DemoSite.Helix&quot;, &quot;@name&quot;: &quot;Feature.PageContent&quot; } } } When we run command &quot;dotnet leprechaun /c &quot;C:\Source\Demo\DemoSite\src\Leprechaun.config&quot; we are getting below exception - Unhandled exception. Configy.Containers.MicroResolutionException: Cannot activate Leprechaun.InputProviders.Sitecore.Filters.SitecoreTemplatePredicate, constructor param 'leprechaunModuleFactory' (LeprechaunModuleFactory). The type 'LeprechaunModuleFactory' is probably not registered, or may need to be an explicit unmapped parameter (as an XML attribute on the type registration). Inner message: Cannot construct Sitecore.DevEx.Serialization.Client.Datasources.Filesystem.Formatting.Yaml.YamlSerializationFormatter because it has > 1 public constructor. at Configy.Containers.MicroContainer.Activate(Type type, KeyValuePair`2[] unmappedConstructorParameters) at Configy.XmlContainerBuilder.<>c__DisplayClass5_0.<RegisterConfigTypeInterface>b__0() at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode) at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) at System.Lazy`1.CreateValue() at System.Lazy`1.get_Value() at Configy.Containers.MicroContainer.Resolve(Type type) at Configy.Containers.MicroContainer.Resolve[T]() at Leprechaun.InputProviders.Sitecore.SitecoreOrchestrator.GetTemplates(IContainer configuration) in D:\a\1\s\src\Leprechaun.InputProviders.Sitecore\SitecoreOrchestrator.cs:line 54 at Leprechaun.InputProviders.Sitecore.SitecoreOrchestrator.GetAllTemplates(IEnumerable`1 configurations) in D:\a\1\s\src\Leprechaun.InputProviders.Sitecore\SitecoreOrchestrator.cs:line 43 at Leprechaun.InputProviders.Sitecore.SitecoreOrchestrator.GenerateMetadata(IContainer[] configurations) in D:\a\1\s\src\Leprechaun.InputProviders.Sitecore\SitecoreOrchestrator.cs:line 26 at Leprechaun.Execution.Runner.GenerateMetadata(IOrchestrator orchestrator, LeprechaunConfigurationBuilder configuration) in D:\a\1\s\src\Leprechaun\Execution\Runner.cs:line 123 at Leprechaun.Execution.Runner.Run(IRuntimeArgs parsedArgs) in D:\a\1\s\src\Leprechaun\Execution\Runner.cs:line 34 at Leprechaun.Cli.Program.Run(ConsoleArgs parsedArgs, CommandLineParser argsParser) in D:\a\1\s\src\Leprechaun.Cli\Program.cs:line 54 at Leprechaun.Cli.Program.Main(String[] args) in D:\a\1\s\src\Leprechaun.Cli\Program.cs:line 28
You need to read the field __updated which will hold the value of the updated date of the item. Below is how your GraphQL will look like: { item(path: &quot;/sitecore/Content/Home&quot;, language: &quot;en&quot;) { name versions { path field(name: &quot;__updated&quot;){ value } } } } The result: Note that if you want to add the name of the user who modified the item, you should use the name __updated by. Below is a snippet when using the __updated by { item(path: &quot;/sitecore/Content/Home&quot;, language: &quot;en&quot;) { name versions { path updatedby: field(name: &quot;__updated by&quot;) { value } updatedDate: field(name: &quot;__updated&quot;){ value } } } } Outcome:
How to get the modified date and time for item versions in Sitecore via Graphql query I need the query to get date modified on item versions for an item. https://scnew9.3cm.dev.local//sitecore/api/graph/items/master/ui?sc_apikey={api-key}&amp;query=query%0A%7B%0A%20%20item(path%3A%20%22%2Fsitecore%2Fcontent%2Fhome%22)%0A%20%20%7B%0A%20%20%20%20name%0A%20%20%20%20%20%20versions%7B%0A%20%20%20%20%20%20%20%20path%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D Need the Date Modified for the item versions
the lazy loading has been completely reworked on v5, and this setting is not there anymore. Check your GlassMapperScCustom.cs file and see if you have it there, then remove it. On v5 lazy is enabled by default and you can disable it by passing the param model.LazyDisabled() when retrieving your model. I hope it helps you.
Method not found: 'Void Glass.Mapper.Config.set_EnableLazyLoadingForCachableModels(Boolean)' We are upgrading GlassMapper to V5 and installed Glass.Mapper.Sc.90. I have done all the changes and mentioned in http://www.glass.lu/Mapper/documentation/Upgrade-ToV5.html link. After the changes, the solution build successfully. But at runtime i am getting Method not found: 'Void Glass.Mapper.Config.set_EnableLazyLoadingForCachableModels(Boolean)'. Searched many blogs but nothing lead me to the fix. Has anyone got this error? How should i resolve this? Thanks in Advance, Yeshwanth
Cast $item.Fields[&quot;FieldName&quot;} to Sitecore.Data.Fields.MultilistField: $multilistField = [Sitecore.Data.Fields.MultilistField]$item.Fields[&quot;FieldName&quot;] $multilistItems = $multilistField.GetItems() foreach($multilistItem in $multilistItems){ # do whatever you want with item from multilist } EDIT AFTER OP CHANGED THEIR QUESTION The error you get means that one of your variables is null. Check which one is that. It can be either $item itself or $item.Fields[&quot;My checklist field name&quot;]
How to get multilist , dropdown list field value of an item using PowerShell query I am looking to extract the multilist , dropdown list field value of an item using PowerShell query. $item = Get-Item -Path master -ID &quot;{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}&quot; $rawIds = [Sitecore.Data.Fields.MultilistField]$item.Fields[&quot;My checklist field name&quot;] $selectedItems = $rawIds.GetItems() foreach($selectedItem in $selectedItems){ $selectedItem.DisplayName } Error I am getting is You cannot call a method on a null valued expression
TL;DR Because you are not using supported SPE package. Make sure you downloaded it from dev.sitecore.net. Right now package on github is insufficient. More info in Sitecore Experience Accelerator compatibility tables Explanation Starting from SXA 10.2 - items will be delivered/stored inside dat files (not in SQL). Every item that has a dependency on other items (SXA scaffolding scripts depend on SPE) need dependency items stored in dat files as well. If you installed regular package (not IAR enabled) you won't see SXA script library because they cannot be added by composite item provider. That's why you can add Tenant Folder (because it's a regular template that has no dependency) but you cannot add Tenant or Site (they are scripts added as insert options and their templates come from SPE package). I already created PR in SPE so next releases should contain both versions of package.
Where are my SXA items? Running 10.2, I followed the SXA installation instructions and installed: Powershell Extensions 6.3 Sitecore Experience Accelerator 10.2.0 rev. 04247 If I go into /templates, then SXA stuff is there, and if I insert an item under /content, then I get 'Tenant Folder' as an option so that pipeline processor is running, but I'm not seeing any Powershell stuff. I don't have SXA items under /system/modules/Powershell/Script Library and don't get 'Tenant' as an insert option for /content or for a 'Tenant Folder' item. I haven't taken the time to try to deserialize the protobuf files in the SXA package to see what items they contain, but I get this in logs: \SITECORE MODULES\ITEMS\MASTER\ITEMS.MASTER.SXA.DAT, updated item definitions count = 19. \SITECORE MODULES\ITEMS\MASTER\ITEMS.MASTER.SXA.DAT, new item definitions count = 7128. \SITECORE MODULES\ITEMS\MASTER\ITEMS.MASTER.SXA.DAT, updated shared definitions count = 19. \SITECORE MODULES\ITEMS\MASTER\ITEMS.MASTER.SXA.DAT, new shared definitions count = 6129. \SITECORE MODULES\ITEMS\MASTER\ITEMS.MASTER.SXA.DAT, updated language definitions count = 19. \SITECORE MODULES\ITEMS\MASTER\ITEMS.MASTER.SXA.DAT, new language definitions count = 7128.
They are stored in media library. Just open content editor and expand sitecore media library themes projName themeName styles E.g.: There are no files on the drive. There are just media item under those nodes holding content of those files.
Where does SXA store css and js files on CM server We can see css and js files in content tree under /sitecore/media library/Themes/ and if we view source code of a web page we can also see the links. However I am not able to find those files in windows explorer. I am just wondering where those files are stored. This is how it renders in the browser <link href=&quot;/virtualFolder/-/media/themes/projName/global/themeName/styles/styles.css&quot; rel=&quot;stylesheet&quot; /> but no such paths exist on CD server.
From my point of view the right way to do it is to go with a a custom rendering contents resolver. If the json is too big you can use pagination/filters for it. On all implementation I saw until now for headless is used custom rendering contents resolver.
Related articles in Sitecore JSS: custom rendering contents resolver or api call? We have a requirement to show on the article page a list of articles which have the same topic and author as the current article i.e. &quot;Related articles&quot;. I have two ideas about how that can be implemented: create a custom rendering contents resolver which would pass a whole list of articles existing in Sitecore (it might be around 40) and then it will get filtered according to topic/author on react side. (or maybe it's actually better to filter in the resolver too and only pass the &quot;related&quot; data to react side?) make an api call to backend: create search context and filter the items there &amp; pass the filtered output to the react app Both seem to be reasonable enough - and it seems like it would be more fun to try the first approach but I'm hesitant because of the large json output for the layout service. What considerations should I take into account to choose between these two options? And... maybe there is a better way I don't know of? Thank you
I am afraid there is no way to do it because variant is used to generate each result separately not the whole list. This is a place where items from index are prepared Sitecore.XA.Feature.Search.Controllers.SearchController list = (IEnumerable<Result>) source.Select<SearchItem, Result>((Func<SearchItem, Result>) (i => new Result(i, variant))).ToList<Result>(); Sitecore.XA.Feature.Search.Models.Result Inside Result model output HTML is created this way. this.Html = service.RenderVariant(variant, searchItem.Item); As you can see only variant and single item are passed to service thus there is no way to tell the index. Solution - workaround Not ideal because you cannot do it via variant but if you really need it I would suggest doing it in JS. Not sure which one will work better for you: try to attach to event responsible for binding search results (XA.component.search.vent.on(&quot;results-loaded&quot;, this.resultsLoaded.bind(this)); in component-search-results.js override render function in component-search-results.js
Search Result Listing Get index of an item using Scriban I have a Search Result Listing Variant created using Scriban. This will render a card from each of the items got from the scope query. However, I want to get the index of items at the scriban template. Here is my current Search Result Listing <div class=&quot;search-result-card&quot; data-item-index=&quot;{{i_item.index}}&quot;> ... </div> Lets say my Scope is returning 5 items, Basically I want to get the index of the current item and put it on a data-attribute. But i_item context that is exposed at scriban is pointing to current item. Is there no way to get that index? Sorry if my explanation is a it confusing. Thanks all
There are many possibilities, depending on other requirements you can pick the best: the same template, different Page Designs - you can treat Page Designs as configuration items - provide default value for your page template by assigning one page design and then let content authors to set different via Page Design field on a page different template, with it's own Page Design - you can predefine all Page Designs and assign them to templates - you have the same number of Page Designs and templates - I suggest using one base template when you crate them to not duplicate fields. page branch - combination of two above - I like this the most (when you want to keep everything on partial designs). You can create predefined pages with components and even expose you component configurations to authors, so they can potentially change URL. While creating Page branch this article might be helpful - page specific content with Partial Design
Get the content from third party API We have requirement to create a dynamic Pages in SXA. This dynamic page will have a template. These template will have a page design with partial designs. All of the partial designs get the content from third party api. The ask is Currently we have one API which provides all the content for the page, how can we use the content to different partial designs? We need to anchor link few sections on the page. So how we can provide flexibility to content authors to control the anchor links on the page. Anchor links component will part of the page design.
This question may be opinion based and can have different answers. However, I can provide you an idea how I implemented Language Selection feature on different websites. In this case I will only talk about the change required in Sitecore CMS. Instead of using the Languages from /sitecore/system/Languages, you can create a container item under each site named Language Selector. That particular container will hold the list of languages being supported by the website. For example, the Facebook and Twitter site Language Selector containers will hold the 7 language each and Sample Site will hold the 25 languages. Please see screenshot below The items en, fr-FR, de-DE etc is based on a template that you will create which will contain a field as droplist with datasource set to /sitecore/system/Languages Now, you can even extend this further. Since you have sites having same languages, you can have a global language selector container which will hold shared languages How it looks? When using a droplist, it will be specific to this item and it allows you to add other fields such as Flag, Name etc. You can use a multilist also where you will select all the languages necessary for a site. Then you will have only 1 item to manage. UPDATE 1 Previously, if I am not mistaken, you were retrieving the list of languages for Facebook, Twitter and Sample from the path /sitecore/system/Languages. In this implementation, firstly, you need to have a Language Container which will hold languages that are specific to the site. Note that the Language Container and Language item are customs one. In other words, you need to create a template named Language Info where you will have a drop-list field type at minimum. The drop-list will have a datasource pointing to the path /sitecore/system/languages. You may add other fields if you want such as Language Flag etc. The Language Container template is an item that will hold the Language Info. So you can configure multiple languages under the Language Container. In your backend implementation, you will need to retrieve the languages from the path /sitecore/content/[Sitename]/Language Container (depending on where you created the Language Container). This means that when you will configure for each site the different languages, when querying the Language Container, you will have languages specific to this site instead of the whole list of languages from the system path. If you want to have the Shared Language Container, you will need to perform the query as follows: Query path /sitecore/content/[Sitename]/Language Container Query path /sitecore/content/Shared Language Container Merge the 2 lists together P.S: I don't have the specific code but the above helps on how the content tree looks like and based on this, you can easily adapt the code.
How to create a custom standalone language set for a website in Sitecore 9.3 In our application, there are 3 websites and all 3 applications are interlinked with its features. Example: Facebook and Twitter supports multi-language feature with it. There is a dropdown to change the language for both Facebook and twitter. Sample website multi-lang feature is based on the twitter profile setup. i.e. When a user sets his language as French, then Sample website will also be loaded on French language. Now, We are removing this dependency, and implementing the dropdown feature for language in Sample website which supports 25 languages while Facebook and Twitter supports only 7 languages. Since Languages are configured under the sitecore path, /sitecore/system/Languages will be common to all 3 websites when we add a new language in a Sitecore CM. How to add a new language in Sitecore CM where the versions should be added only to one of the website (Sample website)?
I assume that you have written a generic class for all the MVCContent Sitecore service methods. If you don't want to pass x.LazyDisabled() in all the .GetItem methods, you can modify your code as below: public T GetItem<T>(GetItemOptions options) where T : class { options.Lazy = Glass.Mapper.LazyLoading.Disabled; return _mvcContext.SitecoreService.GetItem<T>(options); } Other options with LazyLoading: public enum LazyLoading { Enabled = 0, Disabled = 10, OnlyReferenced = 20 } Update: Refer to below sample code to create a generic class: public class RenderingRepository : IRenderingRepository { private readonly IMvcContext _mvcContext; public RenderingRepository(IMvcContext mvcContext) { _mvcContext = mvcContext; } public T GetItem<T>(GetItemOptions options) where T : class { options.Lazy = Glass.Mapper.LazyLoading.Disabled; return _mvcContext.SitecoreService.GetItem<T>(options); } } Register it into your DI: serviceCollection.AddTransient<IRenderingRepository, RenderingRepository>(); Now using Controller Constructor DI, you can use this method in your controller Action Result: public class SampleController : SitecoreController { private readonly IRenderingRepository _renderingRepository; public Sample(IRenderingRepository renderingRepository) { _renderingRepository = renderingRepository; } public ActionResult Index() { return View(_renderingRepository.MethodName()); } }
Glass Mapper 5 lazy loading We migrated to Sitecore 10.1 and Glass Mapper is upgraded to 5.8.177.0 from 4.3.4.197. I noticed the mapping was not working. I changed the code from var centreHours = glassContext.GetItem<TradingHoursModel>(Rendering.DataSourceItem.Fields[&quot;Centre Hours&quot;].Value); to var centreHours = _mvcContext.SitecoreService.GetItem<TradingHoursModel>(Rendering.DataSourceItem.Fields[&quot;Centre Hours&quot;].Value); The model was null and then I added x.LazyDisabled() var centreHours = _mvcContext.SitecoreService.GetItem<TradingHoursModel>(Rendering.DataSourceItem.Fields[&quot;Centre Hours Datasource&quot;].Value, x => x.LazyDisabled()); It started working after x.LazyDisabled(). Do I need to pass x.LazyDisabled() in all the .GetItem method? Since this is a data source item, I also tried the following code but it didn't work and the model was null. _mvcContext.GetDataSourceItem<TradingHoursModel>(new GetKnownOptions { Lazy = Glass.Mapper.LazyLoading.Disabled});
Please check that your workflow is selected in the Default workflow field of the template's __Standard values as described in this article. If it is not, there will be no workflow state selected by default when a new version of the item is created. Update If it happens only in the Experience Editor, then make sure your <site> definition in the config has enableWorkflow=&quot;true&quot; as Experience Editor runs in the context of your website.
Sitecore item loses the Workflow state, while editing in the Experience editor In our production, in Experience editor, while the item is in the final workflow state, to add new changes the next step is to lock and edit, once I &quot;lock and edit&quot; it, I see it's losing the item workflow state. The same item with the same workflow has no issues in the dev and stage env's, Issue is only in prod, not sure what's causing it? This is in the final WorkFlow state(Approved state) Item lost the workflow state after editing it in the final WF state in experience editor When I check the item, I see the state empty I tried adding the state manually in the item, but again after editing it in EE, it still repeats the same behavior where its looses the state after &quot;lock and edit&quot; in final wf state.
I have resolved this issue. I have found two ways to resolve this issue. 1) gulp.watch 2) Bundler &amp; Minifier Extension gulp.watch : gulp.task('minify:css',async function () { gulp.src('./css/*.css') .pipe(minifyCSS()) .pipe(gulp.dest('minified') ); }); gulp.task(&quot;watch&quot;,() => { gulp.watch(&quot;./css/*.css&quot;, gulp.series('minify:css')); }); gulp.task('default', gulp.series('minify:css', 'watch')); We need to click on default task on Task runner explorer to add the changes automatically in minified file. I am using gulp version 4 so using gulp.series .If you are using gulp version 3 then you can use this code gulp.task(&quot;watch&quot;,() => { gulp.watch('./css/*.css',['minify:css']); }); gulp.task('default', ['minify:css', 'watch']); Instead of gulp.task(&quot;watch&quot;,() => { gulp.watch(&quot;./css/*.css&quot;, gulp.series('minify:css')); }); gulp.task('default', gulp.series('minify:css', 'watch')); Bundler &amp; Minifier Extension Found extension to automatically minified file by follow the steps in the below link https://marketplace.visualstudio.com/items?itemName=MadsKristensen.BundlerMinifier We can add this extension in our project.
How to run gulp task on save button on .css file? I would like to run gulp task on save button on .css file to minify file. I have tried gulp.watch but it is not working. Is there any other way to minify file on save button. Using Sitecore 9.1.1. CLI version: 2.3.0 Local version: 4.0.2
Please check the DefaultShopName on Sitecore.Commerce.Engine.Connect.config. If your site is not a multisite (Only 1 Catalog &amp; 1 Shop), you can set the default ShopName as your Storefront ShopName. Catalog Items crawler will pick the associated Language Set of the storefront and index all the items with configured language(s). But this will not work for multi-branded &amp; multilingual sites as each site may have different language and different catalogs associated. So configuring specific ShopName in this case, crawler will take the language set of this shop and do the index. Setting up DefaultShopName CommerceEngineDefaultStorefront on Sitecore.Commerce.Engine.Connect.config should fix your issue. Updating DefaultShopName as CommerceEngineDefaultStorefront will index all languages and you could see all available languages on your catalog items. Refer this blog for more information, https://doc.sitecore.com/xp/en/developers/91/sitecore-experience-commerce/configure-the-language-set-for-catalog-item-indexing.html
Refresh commerce cache not creating all language versions I'm facing one issue while catalogs are getting created to Sitecore. I have created a new catalog in commerce with sellable items for languages en-CA, fr-CA. I have verified the content from biz tool and I can confirm that the products are created in proper language versions. But when I check the catalogs under my storefront on Sitecore, I can see items are created in en-US version instead of en-CA and fr-CA. In my instance, I have other storefronts supporting en-US. All the languages are added in Sitecore and I checked the language set mapped to the storefront is having the en-CA selected. I tried, delete, update data templates, clear cache from sitecore, redis. Any idea, where I'm missing something.
You can disable tracking per site by using enableTracking=&quot;false&quot; To do this in SXA, go to Site Grouping, then use the Other Properties named value field to add that in. Official Documentation links: https://doc.sitecore.com/xp/en/developers/101/platform-administration-and-architecture/enable-disable-the-xdb-and-the-tracker.html https://doc.sitecore.com/xp/en/developers/sxa/101/sitecore-experience-accelerator/the-sxa-site-definition-fields.html
Disable Analytics/Tracking For each SXA site I am using Sitecore 10.1 and I have a situation where I need to disable analytics and personalization or can say xConnect for a particular SXA site. Is that possible to keep the setting for each site level not for all sites?
I was able to reproduce the issue while running the Export-UnicornConfiguration command through SPE Remoting. It appears to be caused by the fact that Unicorn does not distinguish between Interactive and Non-Interactive sessions. The SPE Console and ISE have specific code implemented to signal when code related to the UI (like Write-Progress) is running in an Interactive mode. At the moment there does not appear to be a convenient solution. A change would need to be made to the command to address this issue.
Error while running Export-UnicornConfiguration cmdlet in the Sitecore PowerShell script I am triggering an SPE script from the code. SPE script contains a few checks but finally has Export-UnicornConfiguration $configurationName. The script runs without any errors when it is triggered through Execute Script inside CMS. The only issue is when it is triggered from the code. Am I missing anything while calling from the code? Even from the code, all the other cmdlets like Get-Item and Get-UnicornConfiguration works fine. But below exception occurs with Export-UnicornConfiguration. using (ScriptSession scriptSession = ScriptSessionManager.NewSession(&quot;Default&quot;, true)) { string script = scriptItem[&quot;Script&quot;]; scriptSession.SetVariable(&quot;ConfigurationName&quot;, _configurationName); if (!string.IsNullOrEmpty(script)) scriptSession.ExecuteScriptPart(script, true); } Unicorn configuration <configuration name=&quot;xxxxxxx_Content&quot;> <dataProviderConfiguration enableTransparentSync=&quot;false&quot; /> <predicate> <include name=&quot;xxxx&quot; database=&quot;master&quot; path=&quot;/sitecore/content/xxxxxxx&quot;> </include> </predicate> <syncConfiguration updateLinkDatabase=&quot;false&quot; updateSearchIndex=&quot;false&quot; /> </configuration> ERROR: Current context is not a job (Sitecore.Jobs.AsyncUI.InvalidContextException)at Sitecore.Jobs.AsyncUI.JobContext.get_Job() at Sitecore.Jobs.AsyncUI.SendMessageMe ssage..ctor(Message message, Boolean postBack) at Spe.Core.Host.ScriptingHostUserInterface.WriteProgress(Int64 sourceId, ProgressRecord record) at System.Management.Automation.Intern al.Host.InternalHostUserInterface.WriteProgress(Int64 sourceId, ProgressRecord record) at Unicorn.PowerShell.PowershellProgressStatus.Report(Int32 percent) at Unicorn.SerializationHe lper.ReserializeConfigurations(IConfiguration[] configurations, IProgressStatus progress, ILogger additionalLogger) Export-UnicornConfiguration : Reserialize failed. Review preceding logs for details. At line:1 char:1 Export-UnicornConfiguration &quot;xxxxxxx_Content&quot; CategoryInfo : NotSpecified: (:) [Export-UnicornConfiguration], InvalidOperationException FullyQualifiedErrorId : System.InvalidOperationException,Unicorn.PowerShell.ExportUnicornConfigurationCommand
Make sure that Dianoga.WebP.CDN.config is enabled and the GenerateCacheKey processor is loading in the correct order and not conflicting with any custom cache config you might have.
Dianoga v5 with WebP, CDN and Sitecore HTML Cache As part of a Sitecore upgrade to v10 we also upgraded to Dianoga V5.4.1. This site uses output/HTML cache extensively. We need to support browsers with and without webp support. The WebP CDN config mentions this: <!-- Generate a unique HTML cache key for renderings since the links will have query string extension=webp --> This seems to happen correctly i.e. if a browser supports webp the extension=webp querystring is added and otherwise it is not. The issue I'm running into is that these URLs are part of renderings which get cached in the output cache and are not always correct when returned from cache, e.g. initially a rendering was requested and cached by a browser which does not support webp, and then it gets returned to a browser with webp support. Prior to this upgrade Dianoga did not add this extension, and returned correct webp/original image based on the browsers accept request header (the CDN is configured to use this for unique cache key). This there a way in Dianoga v5 to get the same behavior, or is there a different configuration to make this work?
If you look at the GetContextItem method, you'll see it accepts GetKnownOptions as a parameter now. Then you can just do something like that: _mvcContext.**GetContextItem**<IPageBase>(new GetKnownOptions{Lazy = LazyLoading.Disabled}); I hope it helps you.
Implementing Lazy on ContextItem We are upgrading GlassMapper to V5 and installed Glass.Mapper.Sc.90. I am doing all the changes mentioned in http://www.glass.lu/Mapper/documentation/Upgrade-ToV5.html link one by one. Now, i am working on Lazy. I have disabled Lazy on Model and trying to implement on services when a model is requested. So far the below is working fine _mvcContext.**GetDataSourceItem**<ITest>(x => x.LazyDisabled()); But when trying the below, i am getting an error. _mvcContext.**GetContextItem**<IPageBase>(x => x.LazyDisabled()); When I mouse hover on x => x.LazyDisabled(), I am seeing Cannot convert lambda expression to type 'GetKnownOptions' because it is not a delegate type also the webpage errors out with below stack trace. Model depth check failed. Model graph too large, enable lazy loading. Type requested: Test.Models.ISitecoreItemTest.Models.ISitecoreItem Test.Models.ISitecoreItem Test.Models.ISitecoreItem Test.Models.ISitecoreItem Test.Models.ISitecoreItem Test.Models.ISitecoreItem Test.Models.ISitecoreItem Test.Models.Common.IPageBase What should I do here? Thoughts? my GlassMapperScCustom.cs looks like below `public static IDependencyResolver CreateResolver(){ var config = new Glass.Mapper.Sc.Config(); //Needed to avoid Model-too - deep exception config.OnDemandMappingEnabled = true; config.Cache.AlwaysOn = true; //config.EnableLazyLoadingForCachableModels = true; // Only for V4. Deprecated in V5 var dependencyResolver = new DependencyResolver(config); // add any changes to the standard resolver here dependencyResolver.ObjectConstructionFactory.Remove<ItemVersionCountByRevisionTask>(); //dependencyResolver.ObjectConstructionFactory.Remove<ModelDepthCheck>(); // **This is not working.** return dependencyResolver; }` Thanks in advance.