output
stringlengths
34
25.7k
instruction
stringlengths
81
31k
input
stringclasses
1 value
There is no need to get the item through the Guid. There is a Custom Data property on the field (in this case BackGroundColor) in Visual Studio, you can set this to the type of color and the code gen process would generate the property as this Color class instead of a Guid, so you will put something like this: type=<optional namespace or global namespace>.Color A more detailed walkthrough about the Custom Data property and Code Generation can be found here
How to select an item property in a drop list using Sitecore 8.2 and Glassmapper it's been a while since I've used Sitecore and I'm struggling with an issue. There is a model which is being autogenerated by TDS and uses Glassmapper for its mapping. [SitecoreType(TemplateId=IParametersTemplate_PanelConstants.TemplateIdString, Cachable=false)] public partial interface IParametersTemplate_Panel : IGlassBase { [SitecoreField(IParametersTemplate_PanelConstants.BackGroundColorFieldName)] Guid BackGroundColor {get; set;} [SitecoreField(IParametersTemplate_PanelConstants.HasBackgroundColorFieldName)] bool HasBackgroundColor {get; set;} } [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] public static partial class IParametersTemplate_PanelConstants { public const string TemplateIdString = &quot;cbecbd24-8b2d-4694-a4f2-aa888b385cfc&quot;; public static readonly ID TemplateId = new ID(TemplateIdString); public const string TemplateName = &quot;ParametersTemplate_Panel&quot;; public static readonly ID BackGroundColorFieldId = new ID(&quot;7760746c-8e96-4ef9-8d53-bf4428e18100&quot;); public const string BackGroundColorFieldName = &quot;BackGroundColor&quot;; public static readonly ID HasBackgroundColorFieldId = new ID(&quot;b7fdfde1-258c-48a8-a934-3425a1c31494&quot;); public const string HasBackgroundColorFieldName = &quot;HasBackgroundColor&quot;; } [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] [SitecoreType(TemplateId=IParametersTemplate_PanelConstants.TemplateIdString, Cachable=false)] public partial class ParametersTemplate_Panel : GlassBase, IParametersTemplate_Panel { [global::System.CodeDom.Compiler.GeneratedCodeAttribute(&quot;Team Development for Sitecore - GlassItem.tt&quot;, &quot;1.0&quot;)] [SitecoreField(IParametersTemplate_PanelConstants.BackGroundColorFieldName)] [global::System.CodeDom.Compiler.GeneratedCodeAttribute(&quot;Team Development for Sitecore - GlassItem.tt&quot;, &quot;1.0&quot;)] [SitecoreField(IParametersTemplate_PanelConstants.HasBackgroundColorFieldName)] public virtual bool HasBackgroundColor {get; set;} } I've added a Droplink field to my template (figure 1.1) called BackGroundColor which points to a datasource that contains 3 items that have keys and values (figure 1.2). figure 1.1 figure 1.2 I would like to get the selected item from the XP editor (figure 2.0) from my droplist so I can map its value (the color class name) to my model. figure 2.0 It's not difficult for a checkbox or something similar but getting a selected item from a droplist seems to be a bit more challenging. Any ideas on how I can make this happen using the current setup ( seeing as my models are being autogenerated)? thanks.
This was useful for me in customizing the response: https://doc.sitecore.com/xp/en/developers/hd/latest/sitecore-headless-development/extending-the-layout-service.html. But, be very careful with it. It may break other JSS functionality here if you change it too much, which it looks like you want to. Adding fields is alright but changing the item serialization may take you in to holes you can't dig out of
How to customize sitecore layout service json response How to customize Sitecore layout service json response completely by removing even Sitecore, context and route level and only return the custom data in the response? For one of my POCs, I have the requirement to return the following result when we invoke the layout service API. { &quot;pageid&quot;: 1, &quot;backgroundimagetype&quot;:&quot;link/base64&quot;, &quot;backgroundimage&quot;: null, &quot;backgroundimagealttext&quot;:&quot;Header&quot;, &quot;tenantid&quot;: 1, &quot;countryid&quot;: 1, &quot;countryname&quot;: &quot;Switzerland&quot;, &quot;languageid&quot;: 1, &quot;languagecode&quot;: &quot;ENG&quot;, &quot;icon&quot;:{ &quot;type&quot;:&quot;anchor/image/base64&quot;, &quot;attributes&quot;:[ { &quot;name&quot;:&quot;href&quot;, &quot;value&quot;:&quot;#&quot; }, { &quot;name&quot;:&quot;class&quot;, &quot;value&quot;:&quot;d-block&quot; } ], &quot;subtype&quot;:&quot;image/text&quot;, &quot;subtypeattributes&quot;:[ { &quot;name&quot;:&quot;src&quot;, &quot;value&quot;:&quot;#&quot; }, { &quot;name&quot;:&quot;class&quot;, &quot;value&quot;:&quot;d-block&quot; }, { &quot;name&quot;:&quot;alt&quot;, &quot;value&quot;:&quot;arrow&quot; } ] } I have the login page which contains only fields. If I simply invoke the API then the result should be as above without even Sitecore, Context, and Route nodes. Is it possible to achieve this? If yes how I can achieve it? Someone can please help with this? API that I'm hitting is: https://sc1010.sc/sitecore/api/layout/render/jss?item={97479C6B-BB30-4A15-AFD1-2C89F207E9D6}&amp;sc_lang=en&amp;sc_apikey=35537f26-6b0a-4a4f-8b76-02d823e4a4fe Version: Sitecore 10.1
After investigation and asking the question to Sitecore team. It seems not possible to use the identifier instead of the id in the REST API relations when creating an entity.
How can I use the taxonomy identifier instead of the id, using the REST API? I am working on a connector with a Sitecore Content Hub environnement. I am using the REST API, sending POST request to create some Assets. I wonder if there is a way to set a taxonomy relation with its identifier instead of the id ? For example to set FinalLifeCycleStatusToAsset with M.Final.LifeCycle.Status.Approved instead of 544. My request is a POST to https://{{hostname}}/api/entities/ With the following body : { &quot;properties&quot;:{ &quot;Title&quot;:&quot;REST API Asset&quot;, &quot;Description&quot;: { &quot;en-US&quot;: &quot;<p>Description</p>&quot; } }, &quot;relations&quot;: { &quot;FinalLifeCycleStatusToAsset&quot;: { &quot;parent&quot;: { &quot;href&quot;: &quot;http://{{hostname}}/api/entities/544&quot; } } }, &quot;entitydefinition&quot;:{ &quot;href&quot;:&quot;http://{{hostname}}/api/entitydefinitions/M.Asset&quot; } } I have tried to set href to http://{{hostname}}/api/entities/identifier/M.Final.LifeCycle.Status.Approved by it gives me in response this message : &quot;Unable to match the route 'EntityById' template with the available route values.&quot; To conclude, is it possible to use M.Final.LifeCycle.Status.Approved instead of 544 when created an asset ? And how can I do that ? Thanks for your help,
It seems your issue is similar to the one specified on the glass mapper issue list https://github.com/mikeedwards83/Glass.Mapper/issues/163. The workaround for the error is replacing the GetViewRenderer pipeline action: public class GetViewRendererWithItemValidation : GetViewRenderer { protected override Renderer GetRenderer(Rendering rendering, GetRendererArgs args) { var viewRenderer = base.GetRenderer(rendering, args) as ViewRenderer; if (viewRenderer == null) return null; // Ignore item check when in page editor // Also this will break if the item for the datasource has been deleted without removing the link. if (Context.PageMode.IsPageEditor || Context.PageMode.IsPageEditorEditing) return viewRenderer; // Override renderer to null when there is an unpublished item refererenced by underlying view return viewRenderer.Rendering.Item != null &amp;&amp; viewRenderer.Rendering.RenderingItem.InnerItem != null ? viewRenderer : null; } } Add the above as a new class in your project and activate the existing glass mapper config file z.Glass.Mapper.Sc.ViewRender.config.exclude Also if you are using glass mapper version 4 or higher you can leave the model field blank and Glass should resolve the model based on the declaration in the view rendering's cshtml file.
Using GlassMapper Models in View Rendering Sitecore 9.3 I have a view rendering where I was previously using the RenderingModel in the view, () but have switched to using the GlassMapper classes instead (). This works great unless the component's data source is an unpublished item. If this happens, on the published page, I get a null exception error. My view rendering item currently has nothing for the Model.
If local or page relative SXA data sources are not resolved you need to resolve them manually. Run resolveRenderingDatasource pipeline: ResolveRenderingDatasourceArgs renderingDatasourceArgs = new ResolveRenderingDatasourceArgs(YOUR_DATA_ROURCE_STRING); renderingDatasourceArgs.CustomData.Add(&quot;contextItem&quot;, CONTEXT_ITEM); CorePipeline.Run(&quot;resolveRenderingDatasource&quot;, renderingDatasourceArgs); string resolvedDataSource = renderingDatasourceArgs.Datasource;
Unable to get Rendering datasource with query like local:/Data/ Teaser 1 I am trying to get all rendering datasources added to an item. I used the below code var renderings = InnerItem.Visualization.GetRenderings(InnerItem.Database.Resources.Devices.GetAll().Where(d => d.Name.ToLower() == &quot;default&quot;).First(), true); var renderingReferences = renderings?.Where(r =>!String.IsNullOrWhiteSpace(r.Settings.DataSource)).ToList(); I see that datasources with static path are returned but those datasources for whom the path is like local:/Data/ Teaser 1 are returned empty. Is there a way to get the value of such datasources(target item id) instead of returning an empty value?
After researching too many things, finally, I found the possible cause of the issue. There could be two reasons behind this. Publishing is not enabled. We have to enable it from Manage => Settings => Publishing => PublishingSettings Publishing is not supported for your instance region. This feature is not yet available in the Asia region. You might need to create your ContentHub instance in either the US or Europe reason. Thanks to the Sitecore support team for this update.
Nothing happens when clicking on Create button while creating a new API key I am trying to create a new API key in my content hub instance using https://xyz.sitecoresandbox.cloud/en-us/admin/api-keys. But while hitting the Create button, nothing happens. It simply refreshes the dialog box without doing anything. What could be the issue?
SXA has a custom pipeline called normalizeSearchPhrase which is removing all special characters from the search phrase. All the characters from this HashSet are removed: new HashSet<string> { &quot;-&quot;, &quot;+&quot;, &quot;&amp;&quot;, &quot;|&quot;, &quot;!&quot;, &quot;{&quot;, &quot;}&quot;, &quot;[&quot;, &quot;]&quot;, &quot;^&quot;, &quot;(&quot;, &quot;)&quot;, &quot;~&quot;, &quot;:&quot;, &quot;;&quot;, &quot;/&quot;, @&quot;\&quot;, &quot;?&quot;, @&quot;&quot;&quot;&quot; } So it actually doesn't matter if you will search with - or without, you should see results. Please check Solr settings and see how tokenization is configured as what you have in my opinion is related to the Solr configuration. Unless you are using an older version of SXA. If yes, then please contact Sitecore Support as we had such issues in the past.
SXA Search is unable to return result with '-' or some special characters in Search results I have a sxa search component, In the sxacontent_txm field in Solr have indexing value( ex: Test search - result). In the searchbox I tried input &quot;Test search - result&quot; it response 0 results. But I tried removed '-' and using &quot;Test search result&quot; it response have results. I'm using Sitecore 9.2 - SXA 1.9 Is there any way I can fix this issue? Please helps me! Thank so much.
Welcome to Sitecore Stack Exchange. If you don't have access to the Azure app service where you can see what values are in the index you need to look at your config files, the Sitecore default ones are located in /App_Config/Sitecore/ContentSearch.Azure/ folder. For field naming, you can take a look at the type suffixes that are appended to the original field name in the Sitecore documentation https://doc.sitecore.com/en/developers/93/sitecore-experience-manager/the-field-types-for-azure-cognitive-search.html#type-suffixes-for-edm-types_body I would recommend trying to get access at least to the azure search index as it helps you debug any issues related to indexing, for example, if you are using custom fields and computed fields. If you don't have a large amount of data to be indexed you can also try to set up your own azure search service in order to use it for your local instance as there is a 200$ free credit that can be used for this.
Custom facet field In sitecore 9.3, when creating a new facet in documentation it is stated &quot;Field Name - The lower case name of the field that is used in the index and that the facet is based on. You can enter multiple field names in a comma separated list (title,author)&quot;. How does one see what fields are used in the index? The solution is hosted on Azure and I have no access to it, only content editor.
I used the following query with Sitecore 10, give it a try with your version: SELECT DimensionKeys.DimensionKey, SiteNames.SiteName, Fact_DownloadEventMetrics.Count, Fact_DownloadEventMetrics.Visits, Fact_DownloadEventMetrics.Value FROM DimensionKeys INNER JOIN Fact_DownloadEventMetrics ON DimensionKeys.DimensionKeyId = Fact_DownloadEventMetrics.DimensionKeyId INNER JOIN SiteNames ON Fact_DownloadEventMetrics.SiteNameId = SiteNames.SiteNameId GROUP BY DimensionKeys.DimensionKey, SiteNames.SiteName, Fact_DownloadEventMetrics.Count, Fact_DownloadEventMetrics.Visits, Fact_DownloadEventMetrics.Value
Downloads table is empty in reporting DB I'm using Sitecore 9.1.1. I have a requirement to track the downloads of PDF files across the site. I've marked the required files under the media library with the &quot;Download&quot; event and I am able to see them in the Experience Analytics dashboard under the behavior tab. I need then to extract the download count of each item, I didn't find an OOTB API that allows me to do so but I found this link which gives a way to extract information from the reporting DB. But my problem is that the &quot;Fact_Downloads&quot; table in the reporting DB is always empty! Any idea why the [Fact_Downloads] table is always empty? and where is the downloads data that's showing up in the analytics dashboard under the behavior tab is coming from in that case?
Seems like it is better to use MVC implementation to make your approach work. But, usually, in WebForms it is can be implemented this way: <a runat=&quot;server&quot; Visible=&quot;<%#!Sitecore.Context.PageMode.IsExperienceEditor%>&quot;> <sc:Placeholder Key=&quot;standard-footer&quot; runat=&quot;server&quot; /> </a> <span runat=&quot;server&quot; Visible=&quot;<%#Sitecore.Context.PageMode.IsExperienceEditor%>&quot;> <sc:Placeholder Key=&quot;standard-footer&quot; runat=&quot;server&quot; /> </span>
How to add if else condition for sitecore experience editor in aspx Layout file I need to add experience editor condition in the Sitecore aspx layout file. I tried adding this <%if(Sitecore.Context.PageMode.IsExperienceEditor){%> <span> <sc:Placeholder Key=&quot;standard-footer&quot; runat=&quot;server&quot; /> </span> <%}else {%> <a href=&quot;www.abc.com&quot;> <sc:Placeholder Key=&quot;standard-footer&quot; runat=&quot;server&quot; /> </a> <% } %> but with that I am getting The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>) error. Any way of adding experience editor condition in aspx layout file.
UPDATE: Support for VS 2022 was added recently in TDS. You have to use the x64 .msi file which is included in the most recent TDS version 6.0.0.34 released on November 12th, 2021 while VS 2019 only works with the x86 .msi (also included). As of now it is not possible to use TDS extension and many more VS extensions in Visual Studio 2022. Reason is because VS 2022 is 64-bit and so far all VS extensions in marketplace were being built as 32-bit for VS 2019 and earlier versions. All third parties extensions (like ReSharper) will be updated for new 64-bit version as we approach general availability of VS 2022 then it should be possible.
Can we use Sitecore TDS with Visual Studio 2022 Preview 2? On a new machine, I tried installing VS 2022 and TDS but TDS gives an error that it doesn't detect VS in that system. So the question is - Can we use Sitecore TDS with Visual Studio 2022 Preview 2 by tweaking something? Is this something that is affecting here?
You don't need the suffix in the IndexField attribute here. The Sitecore Content Search API will (most of the time) add that in when it builds the search query. So it's probably doubling those up, you would see that in your search logs. Build your model class like this: public class BlogSearchModel { //Blog Specific [IndexField(&quot;title&quot;)] public string Title { get; set; } [IndexField(&quot;excerpt&quot;)] public string Excerpt { get; set; } [IndexField(&quot;body&quot;)] public string Body { get; set; } [IndexField(&quot;author&quot;)] public string Author { get; set; } [IndexField(&quot;category&quot;)] public string Category { get; set; } [IndexField(&quot;tags&quot;)] public IEnumerable<string> TagID { get; set; } }
Content Search API issue with Droplist and Treelist fields I am facing a weird(might not be weird for experienced people) issue where ContentSearch API is returning null value for few fields while I can see the correct values in Solr. The fields whose values are returning as null are of String type because of Sitecore field type as Droplist and Treelist. Wondering if there is anything obvious I am missing somewhere? Search Result Class: public class BlogSearchModel { //Blog Specific [IndexField(&quot;title_t&quot;)] public string Title { get; set; } [IndexField(&quot;excerpt_t&quot;)] public string Excerpt { get; set; } [IndexField(&quot;body_t&quot;)] public string Body { get; set; } [IndexField(&quot;author_s&quot;)] public string Author { get; set; } [IndexField(&quot;category_s&quot;)] public string Category { get; set; } [IndexField(&quot;tags_sm&quot;)] public IEnumerable<string> TagID { get; set; } } Here Author, Category, TagID whose value is returning as Null have inherited templates. The solr log shows the query as: Solr Query - ?q=((site_sm:(&quot;xxxxx&quot;) AND _templates:(&quot;795b38b1aca6433fb5f1e02ee350857d&quot;)) AND (body_t:(*blog1*) OR title_t:(*blog1*) OR excerpt_t:(*blog1*))) AND _val_:__boost&amp;start=0&amp;rows=1000000&amp;fl=tags,_templates,author_t,_fullpath,_name,__created_by_s,title_t,_template,site_sm,category_t,excerpt_t,_language,body_t,itemurl_t,_uniqueid,_datasource&amp;fq=_indexname:(sitecore_master_index)&amp;wt=xml
With the Glass version 5+, you need to convert the controller base class from Glass Controller to Controller(.NET class). Then you need to use IMVContext to get items/context from Sitecore, I used IMvcContext when I am working with MVC. your code will look like below - IMvcContext mvcContext = new MvcContext(); var model = mvcContext.GetDataSourceItem<IContent_Item>(); A better approach is to register all of these new Glass services with the Sitecore dependency injection container. Use the below code to register all Glass Mapper services with the Sitecore container - public class GlassMapperConfigurator : IServicesConfigurator { public void Configure(IServiceCollection serviceCollection) { serviceCollection.AddSingleton<Func<Database, ISitecoreService>>(_ => CreateSitecoreService); serviceCollection.AddScoped(_ => CreateSitecoreContextService()); serviceCollection.AddScoped(_ => CreateRequestContext()); serviceCollection.AddScoped(_ => CreateGlassHtml()); serviceCollection.AddScoped(_ => CreateMvcContext()); serviceCollection.AddSingleton<Func<ISitecoreService>>(_ => Get<ISitecoreService>); serviceCollection.AddSingleton<Func<IRequestContext>>(_ => Get<IRequestContext>); serviceCollection.AddSingleton<Func<IGlassHtml>>(_ => Get<IGlassHtml>); serviceCollection.AddSingleton<Func<IMvcContext>>(_ => Get<IMvcContext>); } private static ISitecoreService CreateSitecoreService(Database database) { return new SitecoreService(database); } private static ISitecoreService CreateSitecoreContextService() { var sitecoreServiceThunk = Get<Func<Database, ISitecoreService>>(); return sitecoreServiceThunk(Sitecore.Context.Database); } private static T Get<T>() { return ServiceLocator.ServiceProvider.GetService<T>(); } private static IRequestContext CreateRequestContext() { return new RequestContext(Get<ISitecoreService>()); } private static IGlassHtml CreateGlassHtml() { return new GlassHtml(Get<ISitecoreService>()); } private static IMvcContext CreateMvcContext() { return new MvcContext(Get<ISitecoreService>(), Get<IGlassHtml>()); } } Then patch it like this - <configuration> <sitecore> <services> <configurator type=&quot;YourAssembly.GlassMapperConfigurator, YourAssembly&quot; /> </services> </sitecore> </configuration> finally, your code will be like this - public YourController : Controller { private readonly IMvcContext _mvcContext; public YourController (IMvcContext mvcContext) { var _mvcContext = mvcContext ?? throw new ArgumentNullException(nameof(mvcContext)); } public ActionResult YourAction() { var model = mvcContext.GetDataSourceItem<IContent_Item>(); return View(model); } } Here you don't need to Function the IMvcContext and can use it directly.
Glass Mapper Upgrade to 5.8.177.0. GetDatasource is no longer working after GlassController Obsolete The following code was working before the upgrade to the latest glass mapper. Since removing the GlassController inheritance the following no longer works. Is there something in the latest version that should be used instead? var model = GetDataSourceItem<IContent_Item>();
yes is possible to use Sitecore 10 using asp.net core rendering without docker. Here you find all the information you need: https://www.linkedin.com/pulse/sitecore-headless-development-using-dotnetcore-sdk-without-uzzaman/ https://cmsclub9.wordpress.com/2020/11/23/net-core-sitecore-10-but-no-docker/
Is there a way to develop on Sitecore 10 using ASP.NET Core without Docker All the Helix.Examples use docker containers. Can I develop Dot Net Core based solution without using docker for Sitecore 10?
By mocking a proper return type(GetPreviousProductsResponse) value for the injected service(_productService) instead of a model property(PreviousProducts) solved this issue. _productService.GetPreviousProducts(Arg.Any<GetPreviousProductsParameters>()).Returns(new GetPreviousProductsResponse); The test still doesn't return 'ViewResult' type as intended because 'viewModel.item' in my controller is null and returns 'NullModelResult' type. But, that's something can be handled when I clean up unit test 'Arrange' section with sample data using AutoFixture. Time to focus on some real logic in other controllers!
Unit testing a Sitecore component controller throws exception in mocked service I'm using xUnit, NSubstitute, FluentAssertions and Sitecore FakeDb. Here is the controller that needs a test, public class TransactionsController : Controller { private readonly IRenderingContext _renderingContext; private readonly IProductService _service; private User CurrentUser { get { return Sitecore.Context.User; } } public TransactionsController(IRenderingContext renderingContext, IProductService service) { Assert.ArgumentNotNull(renderingContext, nameof(renderingContext)); Assert.ArgumentNotNull(service, nameof(service)); _renderingContext = renderingContext; _service = service; } public ActionResult Transactions() { var productParam = new GetProductsParameters { ClientId = CurrentUser.Name, NextRecordNumber = 0, NumberOfRowsToReturn = 100 }; var clientId = CurrentUser.Name; TransactionsViewModel viewModel = new TransactionsViewModel { Item = _renderingContext.RenderingDatasource as ITransactionsItem, AccountsList = new List<SomeList>(), ProductsList = _service.GetPreviousProucts(productParam).PreviousProducts ?? new List<PreviousProduct>() }; viewModel.ProductsList.OrderBy(c => c.ProductName); var innotrustIds = CurrentUser.Profile.GetCustomProperty(&quot;Innovue ID&quot;).Split(','); foreach (var id in innotrustIds) { var acctParam = new GetOtherProductParameters { InnovueuserId = CurrentUser.Profile.GetCustomProperty(&quot;Innovue ID&quot;) }; var response = _service.GetOtherProducts(acctParam).OtherProducts; if (response != null) viewModel.AccountsList = viewModel.AccountsList.Concat(response); } if (viewModel.Item == null) return new NullModelResult(_renderingContext, RouteData); return View(@&quot;/Path/To/Transactions.cshtml&quot;, viewModel); } } And the following unit test is pretty much trying to test whether the above controller returns a view [Fact] public void Transactions_Returns_View() { using (var db = new Db()) { var _productService = Substitute.For<IProductService>(); var _renderingContext = Substitute.For<IRenderingContext>(); var product1 = new PreviousProduct { ContactName = &quot;Name&quot;, ContactAddressLine1 = &quot;Address&quot;, ContactId = &quot;123909&quot;, ContactCity = &quot;SomeCity&quot;, ContactState = &quot;State&quot;, ContatctZipCode = &quot;73456&quot;, ContactComment = &quot;Comment&quot; }; var product2 = new PreviousProduct { ContactName = &quot;Name2&quot;, ContactAddressLine1 = &quot;Address2&quot;, ContactId = &quot;1239092&quot;, ContactCity = &quot;SomeCity2&quot;, ContactState = &quot;State&quot;, ContatctZipCode = &quot;73456&quot;, ContactComment = &quot;Comment2&quot; }; var productsList = new List<PreviousProduct>(); productsList.Add(product1); productsList.Add(product2); _productService.GetPreviousProducts(Arg.Any<GetPreviousProductsParameters>()).PreviousProducts.ReturnsForAnyArgs(productsList); var sut = new TransactionsController(_renderingContext, _productService); var result = sut.Transactions(); result.Should().BeOfType<ViewResult>(); } } Test fails executing _productService.GetPreviousProducts mock service returning System.NullReferenceException: 'Object reference not set to an instance of an object.' Feature.Services.Services.IProdcutService.GetPreviousProducts(...) returned null. ReturnsForAnyArgs injects some sample data productsList. The underlying IProdcutService.GetPreviousProducts method calls another REST service to get a list of PreviousProducts from a 3rd party web service. Any insight into why the test fails with NullReferenceException without using ReturnsForAnyArgs(productsList)? What am I missing in this framework? Note: Installed and using Sitecore.FakeDb because one of the previous exception was about 'Sitecore.Context.User' and I understand that this needs to be isolated to make the controllers more unit test friendlier down the road. Using FakeDb but no items are created in the test at this point. We're planning on using AutoFixture to auto mock data in tests once the basic tests work. We're on Sitecore 9.0.2 for reference.
OOTB Sitecore doesn’t allow email address formats to be stored in the username field but you can use an email address as a user-id for Sitecore login. As you mentioned the Sitecore setting AccountNameValidation sets a regular expression that gets used to validate whether a provided username has a valid format. You need to update it as an easy regex. Second, you need to make sure that the email id you are using is unique for every user. When using the user's email address as a username, you should consider changing the membership provider in Sitecore to require a unique email. For this, you need to go to the web.config file and change the attribute requiresUniqueEmail to true - <add name=&quot;sql&quot; type=&quot;System.Web.Security.SqlMembershipProvider&quot; connectionStringName=&quot;security&quot; applicationName=&quot;sitecore&quot; minRequiredPasswordLength=&quot;1&quot; minRequiredNonalphanumericCharacters=&quot;0&quot; requiresQuestionAndAnswer=&quot;false&quot; requiresUniqueEmail=&quot;true&quot; maxInvalidPasswordAttempts=&quot;5&quot;/> There is no problem using the email address as user id, but it's more an opinion-based question in terms of PROS and CONS, where some folks like it and some do not.
Are there any problems with using email addresses as IDs? I am thinking of using an email address as a login ID for Sitecore (CMS). In the settings <setting name=&quot;AccountNameValidation&quot;, value=&quot;.*&quot;> , any character can be used. We know that we can use an email address as the login ID. Is there any problem when using an email address as login ID? The version of Sitecore is 10.1. I would appreciate your wisdom.
Do you offload SSL on your load balancer for https://test-cm-1.myclient.com and https://test-cm-2.myclient.com? It looks like https is handled on load balancer and requests to your website go with http for those 2. And when request is sent to Identity Server from your CM instances, callback url is set to http as well as this is what your IIS on CM server received. Maybe an outbound rule on each of CM servers would help? It's written in notepad and not tested on the server, so it may need some adaptation: <system.webServer> <rewrite> <outboundRules> <rule name=&quot;HttpToHttpsOutbound&quot; preCondition=&quot;IsRedirect&quot;> <match serverVariable=&quot;RESPONSE_Location&quot; pattern=&quot;^http://test-cm-1.myclient.com/(.*)&quot; /> <action type=&quot;Rewrite&quot; value=&quot;https://test-cm-1.myclient.com/{R:1}&quot; /> </rule> <preConditions> <preCondition name=&quot;IsRedirect&quot;> <add input=&quot;{RESPONSE_STATUS}&quot; pattern=&quot;3\d\d&quot; /> </preCondition> </preConditions> </outboundRules> </rewrite> </system.webServer> EDIT You should be able to modify redirect_uri parameter with outbound rule on your CM. It should search for redirect_uri parameter and if it is HTTP, change it to HTTPS. You can read more about it here: https://stackoverflow.com/questions/59886697/iis-url-rewrite-for-modifying-query-parameter-on-outbound-redirect-response
How to sign in to a single CM node in a load balanced environment We have a load balanced v9.3 CM environment with 3 CMs and 1 Identity Server. The load balanced URL is https://test-cm.myclient.com/sitecore. The client would like to also be able to sign in to a single particular CM node for troubleshooting purposes. The AllowedCorsOrigins config in my Identity Server looks like this: <DefaultClient> <AllowedCorsOrigins> <AllowedCorsOriginsGroup1>https://test-cm.myclient.com|https://test-cm-1.myclient.com|https://test-cm-2.myclient.com|https://test-cm-3.myclient.com</AllowedCorsOriginsGroup1> </AllowedCorsOrigins> </DefaultClient> If I open a browser and go to https://test-cm.myclient.com/sitecore it redirects me to the Identity Server (https://identity.myclient.com) like I would expect. However I get an error on the Identity Server sign in page that says: Sorry, there was an error: unauthorized_client When I look in the Identity Server logs I see the following: Invalid redirect_uri: http://test-cm.myclient.com/identity/signin Notice that the redirect_uri in the logs is HTTP and not HTTPS. If I go and modify my AllowedCorsOrigins to include the HTTP version of the URLs then I don't get that error anymore. However I can't sign in because it attempts to POST back to the HTTP version of the URL and that fails. I don't understand why when Sitecore redirects to the Identity Server it is sending along the HTTP version of the redirect_uri. I guess maybe I don't know how Sitecore constructs that redirect_uri when it redirects you to Identity Server. NOTE: Originally I had set the following setting in Sitecore.Owin.Authentication.IdentityServer.config on each CM: <setting name=&quot;FederatedAuthentication.IdentityServer.CallbackAuthority&quot; value=&quot;https://test-cm.myclient.com&quot; /> When I had that setting everything works except you can't sign in to an individual node without changing this setting. Ideally I would like to be able to sign in to either the load balance URL or an individual CM node if needed. So I commented out this setting on each CM node. UPDATE/SOLUTION: Thanks to Marek's answer I realized that what I had to do was create an outbound rule that modified the querystring and looked for redirect_uri and changed it from HTTP to HTTPS. However it is even a little more complicated than that because the redirect_uri data is escaped because it will be decoded later. So the outbound rule that worked for me looks like this: <rewrite> <outboundRules> <rule name=&quot;Change Redirect URI&quot; preCondition=&quot;IsRedirect&quot;> <match serverVariable=&quot;RESPONSE_LOCATION&quot; pattern=&quot;(.*)redirect_uri=http%3a(.*)&quot; /> <action type=&quot;Rewrite&quot; value=&quot;{R:1}redirect_uri=https%3a{R:2}&quot; /> </rule> <preConditions> <preCondition name=&quot;IsRedirect&quot;> <add input=&quot;{RESPONSE_STATUS}&quot; pattern=&quot;3\d\d&quot; /> </preCondition> </preConditions> </outboundRules> </rewrite>
The issue is that JSS needs the media library link to start with forward slash: <a href=&quot;/media_library_prefix/~/media/d494d2a8a8554dbf977695dbdd4e94b5.ashx&quot;>
JSS returns 404 for media items in Richtext I have a Legacy hybrid solution on SC 9.2 where only some page types are migrated to JSS. The issue is that if I insert an Internal Sitecore Link to a media item, it returns 404. Internal link works and the markup looks ok (in both legacy and JSS): <a href=&quot;/relative-path-of-the-page&quot;>Test page</a> But media items (imgs and pdf files) return 404 and the markup looks like below (in both legacy and JSS): <a href=&quot;media_library_prefix/~/media/d494d2a8a8554dbf977695dbdd4e94b5.ashx&quot;> The request for URL for media, in Legacy solution: Request URL: http://myDomain/parentItem_path/media_library_prefix/~/media/d494d2a8a8554dbf977695dbdd4e94b5.ashx and in JSS: Request URL: http://myDomain/sitecore/api/layout/render/jss?sc_apikey={api_guid}&amp;item=/parentItem_path/media_library_prefix/~/media/d494d2a8a8554dbf977695dbdd4e94b5.ashx&amp;sc_lang=en Any advices on what can I do to make Richtext to return the proper working URL ? Thanks
I would suggest clearing your eventqueues, Publish queues and the properties tables as shown below. With upgrades and moving servers, there is a chance these get stuck because of machine name changes TRUNCATE TABLE [dbo].[EventQueue]; TRUNCATE TABLE [dbo].[PublishQueue]; delete from properties where not [key] like '%ENCRYPTIONKEYS%' If it still doesnt work after this, the next thing to check once you publish if the EventQueue tables in the web databases are getting populated properly. If it is not getting in there, then some pipelines are missing. To diagnose, compare your showconfig.aspx to a clean install of 9.3
Publish events don't trigger indexing I was using Sitecore 8.2 then upgraded to Sitecore 9.3, after the upgrade process, when I publish any item, I noticed that the index is not updated, I must trigger a full rebuild for the index to be updated. I checked the index update strategies, but it's the default ones, I checked the Crawling log file, during the publish process, there are no logs in there, it's like the update index process is not triggered at all, but I found this at the log file after I restarted the instance. The event queue is enabled, and I tried cleaning it and also the publishing queue, but still nothing happens. FATAL [Index=sitecore_master_index] Initialization of IntervalAsynchronousStrategy failed because event queue is not enabled. FATAL [Index=sitecore_web_index] Initialization of OnPublishEndAsynchronousSingleInstanceStrategy failed because event queue is not enabled.
/solr/admin/info/system?wt=json is a well-known exploit that allows to get access to system information of a Solr instance. This is not a standard behaviour of Sitecore or Solr, so these requests must be sent by an external bot or script. Consider enabling IP restriction for your Solr app service so that only known servers and locations can access it. You can do it for an app service via section Networking and Access restriction feature on the Azure portal.
Solr suspicious behavior I've Sitecore instance hosted on Azure according to below breakdown : Sitecore 9.1 (each component as standalone App Service) Solr 7.2.1 (standalone App Service) App insights configured and connected to all provisioned app services. Suddenly Solr went down and became un available (Getting 503 ERROR) I was investigating the issue on App Insights (reviewing requests, traces .. etc.) and found below requests are being triggered on SOLR App Service.. Every few minutes, there is a request to access random port on localhost ! Is it really SOLR doing that trials ? or kind of breaches or attacks ? I'm not able to figure it out .. why this is happening on Solr instance ?
The Sitecore.XConnect.Operations.FacetOperationException exceptions can be safely ignored unless the Sitecore.XConnect.Operations.PatchFacetOperation exceptions are thrown. You can see more here for additional details from Sitecore Note: No need of creating extra Redis you must use the same Redis for all CDs and scales instances.
Resolve Sitecore.XConnect.Operations.FacetOperationException - should CDs share common redis cache? The logs of my site are getting full with Sitecore.XConnect.Operations.FacetOperationException. The site uses Sitecore 9.2 in a load-balanced setup on azure with CD1 in UK South and CD2 in UK West regions. CDs are configured with custom autoscale, to allow increase instance from 1 to max of 2. If they scale up, both instances would share the same redis cache, however CD1/CD2 have their own separate redis.sessions connection. I followed the config changes outlined in Walkthrough: Configuring a shared session state database using the Redis provider but am still getting the FacetOperationException. I could not find any info about whether it is correct to have two different redis services, or if CD1/CD2 should point to the same redis service?
My case is solved with the node version. Our hosted environment is azure appservice and node version is 8. The issue was solved when I changed the latest node version in the app service. Change below in app service &quot;name&quot;: &quot;WEBSITE_NODE_DEFAULT_VERSION&quot;, &quot;value&quot;: &quot;~18&quot;
10000ms elapsed without getting a service from the pool - JSS SSR default nodejs pool size - Integrated mode Sitecore 9.3 + JSS. Under heavy load we see errors in log files: Exception Message Exception: System.TimeoutException Message: 10000ms elapsed without getting a service from the pool. Source: Sitecore.JavaScriptServices.ViewEngine.Node at Sitecore.JavaScriptServices.ViewEngine.Node.GenericConcurrentPool`1.CheckOut() at Sitecore.JavaScriptServices.ViewEngine.Node.NodeRenderEngine.Invoke[T](String moduleName, String functionName, Object[] functionArgs) at Sitecore.JavaScriptServices.ViewEngine.Presentation.JssRenderer.PerformRender(TextWriter writer, IRenderEngine renderEngine, String moduleName, String functionName, Object[] functionArgs) at Sitecore.JavaScriptServices.ViewEngine.Presentation.JssRenderer.Render(TextWriter writer) at Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Render(Renderer renderer, TextWriter writer, RenderRenderingArgs args) ... NodeRenderEngine tryes to render a component and takes a INodeServices from the GenericConcurrentPool but cannot because as I see from the code PoolSize is not defined in the config. <renderEngine name=&quot;nodejs&quot; patch:source=&quot;Sitecore.JavaScriptServices.ViewEngine.Node.config&quot;> <instance id=&quot;defaults&quot;> <!-- If true, the Node.js instance will accept incoming V8 debugger connections (e.g., from node-inspector). The node process is invoked with the &quot;inspect&quot; flag. --> <LaunchWithDebugging>false</LaunchWithDebugging> <!-- If &quot;launchWithDebugging&quot; is true, the Node.js instance will listen for V8 debugger connections on this port. IMPORTANT: Node instances _must_ have unique debugging ports. If you try to create multiple node instances with the same debugger port, those node processes will exit. Therefore, it is recommended that you create <instance /> configurations for individual JSS apps / renderings if you wish to use remote SSR debugging features. --> <DebuggingPort/> <!-- If set, the Node.js instance should restart when any matching file on disk within your project changes. --> <WatchFileExtensions>.js|.json|.html</WatchFileExtensions> <!-- If set, starts the Node.js instance with the specified environment variables. --> <EnvironmentVariables> <var name=&quot;NODE_ENV&quot; value=&quot;production&quot;/> </EnvironmentVariables> <!-- Specifies the maximum duration, in milliseconds, that your .NET code should wait for Node.js RPC calls to return. --> <InvocationTimeoutMs>10000</InvocationTimeoutMs> <!-- Specify the path to node to execute. 'node' = resolve using PATH environment variable --> <NodePath>node</NodePath> </instance> </renderEngine> but has value 2 from the <app name=&quot;defaults&quot; ... serverSideRenderingWorkerProcesses=&quot;2&quot;. So the question is: should I increase the pool size and what is the general rule here besides the 'one per cpu core' coming from the common sense?
TDS serialization uses the default Sitecore serialization format. For this case all fields are saved with content-length, e.g.: ----field---- field: {A60ACD61-A6DB-4182-8329-C957982CEC74} name: Text key: text content-length: 788 [Some Value] Value of content-length should correspond to the length of content [Some Value]. If the length of content in the field is different, you will get this error message. Usually, this kind of error you get when you solve git conflicts manually and make mistakes. You have few options: Find the file that causes an error, calculate new content length, and change it to the proper value. Find the file that causes an error and check git history on it. The most probably that you have started to get this problem after not successful merge of conflicts. Revert to the working version. Find the file that causes an error. Set content-length of the field to 0. Set value to an empty line. Sync the item. Change the value of the field in the Sitecore Content Editor. Sync item again. And you should get proper values in the file.
TDS Item sync issue Length of field content doesn't match the content-length attribute an attribute *.item -text is already existing in the .git attributes file. Are we missing something here. This doesn't happen while syncing all the TDS files. It happens only to certain files.
This recommendation is for development environments on Windows 10 that use Docker Desktop: RAM: 16GB of RAM is the minimum, 32GB of RAM is recommended. This depends on the number of instances and topologies you want to run (that is, the number of simultaneously running containers). For example, 16GB may be sufficient for XM1 or XP0 instances, but will probably have problems running a full XP1 instance. A quad core, or higher, CPU. At least 25GB of free disk space for Sitecore container images. SSD storage is highly recommended for optimal performance when downloading and running Docker containers. I recommend you to have minimum 512 GB on your hard disk. On my old laptop I had 256 GB on my hard disk and I had to archive to cloud some old solutions/demo solution. More information you can find here: https://community.sitecore.net/technical_blogs/b/sitecorejohn_blog/posts/sitecore-xp-development-hardware-recommendations https://doc.sitecore.com/en/developers/100/developer-tools/set-up-the-environment.html#prerequisites_body
Sitecore developer workstation requirement for Sitecore Experience Platform (XP Single) I am new in Sitecore and now I am trying to setup my machine. I want to ask you that what is a recommendation for developer workstation in terms of below points: RAM CPU Disk Any other specific requirement Currently I am going to start work on Sitecore XP 9.3 but later I will work on Sitecore 10 with Docker so I am considering this point as well for developement machine.
Looking at the stack trace it indicates that it cannot find a certain configuration/setting. You might be missing a file in CD server. Check that your CD server that it has all the relevant *.config files enabled and disabled, especially those files that has Marketing name on it.
Issue with Sitecore.Analytics.Pipelines.StartAnalytics.StartTracking processor We are using Sitecore 9.1 update 1 in XM only mode. We wanted to use Sitecore geoIP, so enabled tracking but XDB is still disabled. (Is it possible to enable sitecore Geoip without enabling sitecore Analytics?) Config below : <setting name=&quot;Analytics.PerformLookup&quot; set:value=&quot;true&quot; /> <setting name=&quot;EXM.Enabled&quot; set:value=&quot;false&quot; /> <setting name=&quot;DeviceDetection.Enabled&quot; set:value=&quot;false&quot; /> <setting name=&quot;Xdb.Enabled&quot; set:value=&quot;false&quot; /> <setting name=&quot;Xdb.Tracking.Enabled&quot; set:value=&quot;true&quot; /> After these changes the geoIP is working fine in CM but there is issue while starting the tracking only in CD(above config is same in both CM and CD). As per the stack trace there is issue in StartTracking processor and it is looking for master db but master db is not required in CD. Hence confused as to why we are getting this error. Stack Trace below : 3752 10:11:49 ERROR Error in GeoLocationRedirect processor of mvc.requestBegin pipeline - at Sitecore.Configuration.DefaultFactory.GetConfigNode(String xpath, Boolean assert) at Sitecore.Configuration.DefaultFactory.CreateObject(String configPath, String[] parameters, Boolean assert) at Sitecore.Configuration.DefaultFactory.GetDatabase(String name, Boolean assert) at Sitecore.Configuration.DefaultFactory.GetDatabase(String name) at Sitecore.Marketing.xMgmt.Definitions.Profiles.Data.ItemDb.ProfileDefinitionItemRepository..ctor(ILogger`1 logger, String databaseName, Boolean assumeActive, IDefinitionRecordMapper`1 mapper) at Sitecore.Marketing.xMgmt.Definitions.Profiles.Data.ItemDb.ProfileDefinitionItemRepository..ctor(ILogger`1 logger, IItemRepositoriesSettings settings, IDefinitionRecordMapper`1 mapper) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope) 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.Marketing.Definitions.DefinitionManagerFactory.GetDefinitionManager[TDefinition]() at Sitecore.Analytics.Data.MarketingDefinitions.<>c__DisplayClass7_0.<.ctor>b__4() at System.Lazy`1.CreateValue() at System.Lazy`1.LazyInitValue() at Sitecore.Analytics.Data.MarketingDefinitions.InitializeProfilesWithDefaultValues() at System.Lazy`1.CreateValue() at System.Lazy`1.LazyInitValue() at Sitecore.Analytics.Data.TrackingField.InitializeProfiles() at Sitecore.Analytics.Data.TrackingField..ctor(Field innerField, DefinitionManagerFactory factory) at Sitecore.Analytics.Data.TrackingField.GetTrackingField(Item item) at Sitecore.Analytics.Data.TrackingField.FindTrackingField(Item item) at Sitecore.Analytics.DefaultTracker.IgnoreCurrentItem() at Sitecore.Analytics.DefaultTracker.StartTracking() at Sitecore.Analytics.Pipelines.StartAnalytics.StartTracking.Process(PipelineArgs args) at (Object , Object ) at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) at Sitecore.Analytics.XConnect.Diagnostics.PerformanceCounters.OperationPerformanceMonitorExtensions.<>c__DisplayClass1_0.<Monitor>b__0() at Sitecore.Analytics.XConnect.Diagnostics.PerformanceCounters.OperationPerformanceMonitorExtensions.Monitor[T](OperationPerformanceMonitorBase monitor, Func`1 operation) at xyz.Custom.Pipelines.GeoLocationRedirect.Process(RequestBeginArgs args) Exception: System.InvalidOperationException Message: Could not find configuration node: databases/database[@id='master'] Source: Sitecore.Kernel at Sitecore.Configuration.DefaultFactory.GetConfigNode(String xpath, Boolean assert) at Sitecore.Configuration.DefaultFactory.CreateObject(String configPath, String[] parameters, Boolean assert) at Sitecore.Configuration.DefaultFactory.GetDatabase(String name, Boolean assert) at Sitecore.Configuration.DefaultFactory.GetDatabase(String name) at Sitecore.Marketing.xMgmt.Definitions.Profiles.Data.ItemDb.ProfileDefinitionItemRepository..ctor(ILogger`1 logger, String databaseName, Boolean assumeActive, IDefinitionRecordMapper`1 mapper) at Sitecore.Marketing.xMgmt.Definitions.Profiles.Data.ItemDb.ProfileDefinitionItemRepository..ctor(ILogger`1 logger, IItemRepositoriesSettings settings, IDefinitionRecordMapper`1 mapper) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope) 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.Marketing.Definitions.DefinitionManagerFactory.GetDefinitionManager[TDefinition]() at Sitecore.Analytics.Data.MarketingDefinitions.<>c__DisplayClass7_0.<.ctor>b__4() at System.Lazy`1.CreateValue() at System.Lazy`1.LazyInitValue() at Sitecore.Analytics.Data.MarketingDefinitions.InitializeProfilesWithDefaultValues() at System.Lazy`1.CreateValue() at System.Lazy`1.LazyInitValue() at Sitecore.Analytics.Data.TrackingField.InitializeProfiles() at Sitecore.Analytics.Data.TrackingField..ctor(Field innerField, DefinitionManagerFactory factory) at Sitecore.Analytics.Data.TrackingField.GetTrackingField(Item item) at Sitecore.Analytics.Data.TrackingField.FindTrackingField(Item item) at Sitecore.Analytics.DefaultTracker.IgnoreCurrentItem() at Sitecore.Analytics.DefaultTracker.StartTracking() at Sitecore.Analytics.Pipelines.StartAnalytics.StartTracking.Process(PipelineArgs args) at (Object , Object ) at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) at Sitecore.Analytics.XConnect.Diagnostics.PerformanceCounters.OperationPerformanceMonitorExtensions.<>c__DisplayClass1_0.<Monitor>b__0() at Sitecore.Analytics.XConnect.Diagnostics.PerformanceCounters.OperationPerformanceMonitorExtensions.Monitor[T](OperationPerformanceMonitorBase monitor, Func`1 operation) at xyz.Custom.Pipelines.GeoLocationRedirect.Process(RequestBeginArgs args)
To decrypt the contact, we'll need to use cipher.TryDecrypt method from Sitecore.Modules.EmailCampaign.Core.Crypto library. This method with return contact identifier. After getting the contact identifier, we will call ContactService from Sitecore.Modules.EmailCampaign.Core.Contacts library to Get the contact. Complete implementation will look like this: public class EXMPreferencesController : Controller { // Sitecore.XConnect ContactIdentifier private ContactIdentifier _contactIdentifier; // Sitecore.EmailCampaign.Cd.Services IMarketingPreferencesService to get the marketing preferences from preference center page private readonly IMarketingPreferencesService _marketingPreferencesService; // Sitecore.Modules.EmailCampaign.Core.Contacts IContactService to get the contacts from XDB private readonly IContactService _contactService; // Sitecore.Modules.EmailCampaign.Core.Crypto IStringCipher to encrypt or decrypt contacts private readonly IStringCipher _cipher; private Contact _contact; public EXMPreferencesController() { // To get the contactService from current sitecore context using Sitecore.DependencyInjection.ServiceLocator IContactService contactService = Sitecore.DependencyInjection.ServiceLocator.ServiceProvider.GetService<IContactService>(); // To get the cipher from current sitecore context using Sitecore.DependencyInjection.ServiceLocator IStringCipher cipher = Sitecore.DependencyInjection.ServiceLocator.ServiceProvider.GetService<IStringCipher>(); // check cipher and contactService should not be null Condition.Requires<IContactService>(contactService, nameof(contactService)).IsNotNull<IContactService>(); Condition.Requires<IStringCipher>(cipher, nameof(cipher)).IsNotNull<IStringCipher>(); this._contactService = contactService; this._cipher = cipher; } // get all the Preferences in List of Sitecore.EmailCampaign.Model.XConnect.Facets.MarketingPreference model [System.Web.Http.HttpPost] public void UpdateContactPreferences(List<MarketingPreference> Preferences, string EncryptedContactIdentifier) { ContactIdentifier contactIdentifier = this.GetContactIdentifier(EncryptedContactIdentifier); Contact contact = this.GetContact(contactIdentifier); // Get xconnect client in sitecore context using (Sitecore.XConnect.Client.XConnectClient client = Sitecore.XConnect.Client.Configuration.SitecoreXConnectClientConfiguration.GetClient()) { if (contact != null) { // write your logic, here we are saving customer preferences to custom facets } client.Submit(); } } protected ContactIdentifier GetContactIdentifier(string encryptedValue) { if (this._contactIdentifier != null) return this._contactIdentifier; try { string str = this._cipher.TryDecrypt(encryptedValue); if (string.IsNullOrEmpty(str)) { return (ContactIdentifier)null; } this._contactIdentifier = str.ToContactIdentifier(); return this._contactIdentifier; } catch (Exception ex) { return (ContactIdentifier)null; } } protected Contact GetContact(ContactIdentifier contactIdentifier) { return this._contact ?? (this._contact = this._contactService.GetContactWithRetry(contactIdentifier, 100.0, 3, this.FacetKeys)); } Refer to this blog for more details: https://sitecorewithraman.wordpress.com/2022/01/01/customization-of-exm-preference-center-and-decrypt-contacts/
Decrypt ContactIdentifier in EXM Preference center We are trying to customize the EXM preference centre by calling an additional AJAX in the Preference Center Java Script For this we have created a controller action: public class EXMPreferencesController: Controller { [HttpPost] public JsonResult getcontact(object Preferences, string EncryptedContactIdentifier) { // some code return Json(&quot;ok&quot;); } } and appended the below AJAX in submitPreferences function in javascript. So that this AJAX will hit on click of the Update subscription button on the Email Preference Center page. $.ajax('/api/sitecore/EXMPreferences/getcontact', { method: 'POST', contentType: 'application/json', processData: false, data: JSON.stringify({ &quot;Preferences&quot; : preferences, &quot;EncryptedContactIdentifier&quot;: contactIdentifier }) }).then(formSuccess, formFail); AJAX is getting triggered, but how can we get current contact information like contact ID, contact identifier from EncryptedContactIdentifier variable in action method. Any help is much appreciated?
Besides following the Sitecore upgrade guide, in order to upgrade SXA you should follow the SXA upgrade guide on the page https://dev.sitecore.net/Downloads/Sitecore_Experience_Accelerator/10x/Sitecore_Experience_Accelerator_1010.aspx The section &quot;2.2.4 Remove obsolete module content&quot; is reffering to old sitecore modules which are obsolete, for example WFFM. Make sure to check if you are using any sitecore or custom modules and see if they are compatible with the latest sitecore version. Regarding Azure App Services, you should take into consideration that it will be completely removed in the future and it will be supported until 10.2. Please read the sitecore documentation regarding sitecore on azure https://doc.sitecore.com/en/developers/91/sitecore-experience-manager/sitecore-on-azure.html.
Upgrade Sitecore 9.1 to Version 10.1.1 We have Sitecore 9.1.1 currently deployed on production environment. Our topology is scaled on Azure App services. It's required to upgrade current version (9.1.1) to the latest Sitecore version (10.1.1) and deploy it on scaled azure topology (using App Services) We have visited the official product page - Sitecore XP 10.1 Update-1 and explored this guide BUT it's not mentioning anything about &quot;App Services&quot; option! Now, I'm looking for a step-by-step guide that we can follow to upgrade Sitecore 9.1.1 to version 10.1.1 on Azure app service scaled environment .. How to move forward ?
It seems that PageList in this SXA version isn't using solr queries like search results component, if you take a look in Sitecore.XA.Feature.PageContent.Repositories.PageListRepository it makes a call to this.GetItems(this.Rendering, this.Rendering.Parameters[&quot;SourceType&quot;], this.IsEdit). Depending on the Source Type set on the component (Children, Sibling, Items with the same template) this method is doing a SelectItems query if (!str.StartsWith(&quot;query:&quot;, StringComparison.OrdinalIgnoreCase)) return this.GetDatasourceItem(str, dataSourceItem); string query = ServiceLocator.ServiceProvider.GetService<ITokenResolver>().Resolve(str, dataSourceItem); Item[] items = dataSourceItem.Axes.SelectItems(query) ?? Array.Empty<Item>(); return (IEnumerable<Item>) this.EvaluateRules(queryItem, items); You can find this in Sitecore.XA.Foundation.RenderingVariants.Repositories.ListRepository namespace. You can take a look at the sitecore documentation which details some cases where you should use Page List component. In the latest SXA version it was changed so that it is using search queries aswell: return str.IsSitecoreQuery() ? this.GetSitecoreQueryItems(dataSourceItem, queryItem, str) : this.GetContentSearchQueryItems(dataSourceItem, queryItem, str);
SXA Pagelist vs SearchResults component I'm using Sitecore 9.2 and SXA 1.9, I wonder how SXA Pagelist component works in terms of querying items, does it fetch items from Solr as SXA SearchResults one. I tried decompiling its dll, but couldn't totally understand how it does it, and I there are no requests is triggered to the Solr when using it. If they use the same approach, when to use Pagelist over SearchResults component.
There is an attribute Exclude that should works for you. You can add Exclude=&quot;Sitecore.Commerce.ServiceProxy.dll&quot; to the corresponding ExcludeFromPackageFiles node. <ItemGroup> <SitecoreAssembliesToExclude Include=&quot;@(SitecoreAssemblies)&quot; /> </ItemGroup> <ItemGroup> <ExcludeFromPackageFiles Include=&quot;bin\Sitecore.*.dll&quot; Exclude=&quot;Sitecore.Commerce.ServiceProxy.dll&quot; /> <ExcludeFromPackageFiles Include=&quot;bin\*.dll.config&quot; /> <ExcludeFromPackageFiles Include=&quot;bin\*.pdb&quot; /> <ExcludeFromPackageFiles Include=&quot;bin\Scriban.dll;bin\Spatial4n.Core.dll;bin\Newtonsoft.Json.Bson.dll;bin\Microsoft.OData.Client.dll;bin\AjaxMin.dll;bin\Microsoft.Extensions.Caching.StackExchangeRedis.dll&quot; /> <ExcludeFromPackageFolders Include=&quot;bin\de&quot; /> </ItemGroup> <PropertyGroup>
How to include a dll for publish in Visual Studio The project uses Helix publishing and all the Sitecore dlls are excluded, in the publishing targets file. <ItemGroup> <SitecoreAssembliesToExclude Include=&quot;@(SitecoreAssemblies)&quot; /> </ItemGroup> <ItemGroup> <ExcludeFromPackageFiles Include=&quot;bin\Sitecore.*.dll&quot; /> <ExcludeFromPackageFiles Include=&quot;bin\*.dll.config&quot; /> <ExcludeFromPackageFiles Include=&quot;bin\*.pdb&quot; /> <ExcludeFromPackageFiles Include=&quot;bin\Scriban.dll;bin\Spatial4n.Core.dll;bin\Newtonsoft.Json.Bson.dll;bin\Microsoft.OData.Client.dll;bin\AjaxMin.dll;bin\Microsoft.Extensions.Caching.StackExchangeRedis.dll&quot; /> <ExcludeFromPackageFolders Include=&quot;bin\de&quot; /> </ItemGroup> <PropertyGroup> But I want to include this dll - Sitecore.Commerce.ServiceProxy How to do that
This could be an authorization issue. Your user must be an admin or a member of sitecore\Sitecore Client Developing to see this option.
Development Tools option not visible on Sitecore CMS desktop mode I recently installed sitecore 9 on my machine, I was trying to create a package out of my local instance. I opened Desktop mode and clicked on sitecore icon at the bottom, but I was not able to see the 'Development Tools' option which we use for Creating and Installing packages. Any thoughts on these. Thanks.
You can change the style of the search results using the variant for your results. The rendering variant for the Search Results component specifies how each repeating section is rendered. OOTB the theme will render in a more grid-like fashion using the horizontal variant. You could also create your own variant and use grid columns to render the results in a grid and then you can control exactly how many results per row you want to see.
Sitecore 9.3 where do you specify search result appearance as grid? New (and probably a dumb question). I have got a search result configured but it always displays as list. The docs say that you can display your results as grid but defaults to list but I can't find where to set that? Thanks
Quick Fix Search your solution for any references to the Docker image tag mcr.microsoft.com/dotnet/framework/sdk:4.8 and replace them with mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019. Explanation Many of the examples provided by Sitecore use .NET Framework SDK images provided by Microsoft as a base for solution builds. When the Microsoft image tags do not contain an OS version, they are often actually references to a manifest associated with the tag to determine the actual image that will be used, based on the OS version of the Docker host. You can see the available OS images associated with a manifest with the docker manifest inspect command. docker manifest inspect mcr.microsoft.com/dotnet/framework/sdk:4.8 If Microsoft does not have an SDK image for your exact Windows version (perhaps you are using a new or old SAC release), you may end up with LTSC2016, which does not have TLS 1.2 enabled, thus the TLS error downloading NuGet.exe. You can see the Windows version of the image actually being used in your Docker host via docker image inspect. docker image inspect mcr.microsoft.com/dotnet/framework/sdk:4.8 --format '{{ .OsVersion }}' 10.0.14393.4402 In the output above, 10.0.14393 would indeed indicate use of LTSC2016.
Container-based solution build errors with "Could not create SSL/TLS secure channel" I am doing container-based builds of my Sitecore solution, based on examples provided by Sitecore. However when I attempt to build, I get the following error: RUN Invoke-WebRequest &quot;https://dist.nuget.org/win-x86-commandline/v$env:NUGET_VERSION/nuget.exe&quot; -UseBasicParsing -OutFile &quot;$env:ProgramFiles\NuGet\nuget.exe&quot; ---> Running in 99e111499461 Invoke-WebRequest : The request was aborted: Could not create SSL/TLS secure channel. I can invoke this command successfully from my Docker host. How can I resolve this error, and what is the cause?
It would be difficult to update placeholder text in the input field because whenever you will update placeholder text, the cursor will show in the input field. There could be one way where you can add Edit Frame in between input fields like below: @using (BeginEditFrame(Model.Page, &quot;Edit PlaceholderText&quot;, x => x.PlaceholderText)) { <input type=&quot;text&quot; class=&quot;form-control&quot; autofocus=autofocus /> } Here is the link for Glass edit frame: https://jammykam.wordpress.com/2017/09/11/glass-edit-frame-immediately-invoking-wrapper/
Is there a way to use @Editable (Glass-mapper) and an anonymous model in an html input placeholder? I have an input box and I would like to be able to have the placeholder text XP editor friendly. <input type=&quot;text&quot; class=&quot;form-control&quot; placeholder=&quot;@Editable(x => x.PlaceholderText)&quot; autofocus=autofocus /> Is there a way to make this work?
The Query Builder field does not support specifying a page size or offset. You can write your own code with the Content Search API where you first parse the Query Builder text and then add on the necessary calls to Take, Skip, Select to control what is returned.
How to get the first "N" items while using Query Builder? Environment: Sitecore 9.3 &amp; SXA 1.9 Scenario: I would like to get the first 10 items while using the search query builder. This is the query I am using +template:{25a72111-ea49-56e0-97ca-3247ffa9a569};sxa:TaggedWithAtLeastOneTagFromCurrentPage|SxaTags;sort:__smallcreateddate[desc]. I tried to use the custom tag in the query to get the rows (like this +custom:rows|10) but it didn't work. How to achieve this functionality? Thanks.
In the Build a Search Query dialog box, in the Search field, build your search query by adding the relevant filters, in your case, use the template filter and enter all the templates name (intellisense will automatically append template ID) you want to have your items based on. Query should look like this: template:{B1C01A36-40F9-4D9B-8319-260767B760BC};template:{141F54F0-9C89-4193-B0F8-C9CB96A51913};sort:__updated;+location:{302969A3-C03A-48E8-BE4F-1BD6C3E32F0D}
Sitecore Default Bucket Query For Multiple Templates I need to build a sitecore default bucket query for a bucketable folder which will display the articles which are based on different page templates. I was not able to find a specific syntax which we need to use the build the query, currently, it is only taking a single template to display the results. The query which I am using currently is : But I need to display the results of the articles which are based on different templates : Can anyone pls help me out !! Thank you.
I used to get same error in Sitecore 9.3 in visual studio 2019 with latest OData. It only worked when i switched to visual studio 2017 with OData Connected Service 0.3.0. Here is the link with error and other details: https://sitecore-commerce.blogspot.com/2020/11/sitecore-commerce-service-proxy-error.html For 10.1 it should work with Visual Studio 2019 with latest version of OData Connected Service. Try with deleting &quot;CommerceOps.cs&quot; and &quot;CommerceShops.cs&quot; file and verify &quot;ConnectedService.json&quot; file for ServiceName, Endpoint. Then re-generate service proxy and see if there error is resolved.
Sitecore Commerce Service Proxy and Microsoft oData Compatibility Issue XC 10.1 I'm trying to use commerce service proxy, and when trying to update connected services I'm getting the following build error, noticing that I'm using XC 10.1 and MS oData 7.5: cannot convert from 'System.Collections.Generic.IDictionary<string, object>' to 'System.Collections.Generic.Dictionary<string, object>' Sitecore.Commerce.ServiceProxy C:\deploy\Sitecore.Commerce.Engine.SDK.7.0.55\src\Sitecore.Commerce.ServiceProxy\Connected Services\CommerceOps\CommerceOps.cs Looking into this and it seems like an issue with oData and fixed in 7.6.3 as stated here: https://github.com/OData/odata.net/pull/1648 Upgrading Nuget fix the build error but when deploying the service proxy it breaks the storefront which is using oData 7.5. Could be VS extension issue, I've VS 2019 with oData v 0.12.0, couldn't find any reference what version should be used with 10.1, any thoughts?
This answer isn't mine but posting in case anyone may need in future. As per @Nehemiah from Sitecore slack: Nehemiah: I don't think so. I believe they are part of middleware where Sitecore context won't be there. I followed the link mentioned by @Jeroen. https://sitecore.stackexchange.com/a/26878/3632 One small adjustment I had to make was, I assigned the clientId to notification.ProtocolMessage.ClientId In RedirectToIdentityProvider, the Sitecore.Context.Site becomes available.
Get current site in IdentityProvidersProcessor for Federated Login We have a multisite architecture, and I am working on implementing the federated authentication using Auth0 for visitors login/signup. I need to fetch separate client id and secret per tenant based on the site. On the pipeline processor IdentityProviderProcessor (inherited from IdentityProvidersProcessor) I am unable to fetch the site name. Any insights would be greatly appreciated. Thank you
Seems like you have directly created a language version of an item before adding the new language in Sitecore system settings. You need to follow the below steps to add a language to Sitecore system settings: In the Content Editor, go to /sitecore/System/Languages. Right-click and then click Insert, Language. In the Add a New Language dialog box, in the Choose a predefined language code field, select the language and country code you want to use. Complete the remaining fields as required and click Next to step through the remaining pages of the Wizard. When you are finished, click Close. The new language is added to the content tree. Now, if you go back to your item and try to publish it, you'll see new language will be there.
Added item language is not showing in Publish item When adding a new language to an item, it's not showing in my Publish item viewer. Do I need to configure this somewhere else too? Spanish and Dutch were added to this item, but when Publishing the item, I'm not getting the Publishing language.
I was not able to find the direct cause of this issue but I have found a possible solution. When using the Like function with the slop parameter Like<T>(this T value, string phraseComparison, int slop), it formats the query correctly without the backslashes. From the logs: _content:(&quot;Test query Test test&quot;~1) I believe the phrase query is closer to what I am hoping to achieve so this should be OK.
Sitecore.ContentSearch.Linq is adding backslash to all space characters in search query Whenever I query using the Like query the Sitecore generated Solr query escapes the space characters. Here is an example: queryable = queryable.Where(result => result[&quot;displayName&quot;].Like(keywordArg).Boost(2.0f) || result.Name.Like(keywordArg).Boost(2.0f) || result.Content.Like(keywordArg) ); Generates: (displayname_t:(Test\ Query\ Test~0.5))^2 OR (_name:(Test\ Query\ Test~0.5))^2 OR _content:(Test\ Query\ Test~0.5) I am using Sitecore.ContentSearch.Linq 10.1.0. My expectation would be that it does not add a backslash to the generated query. Any Ideas?
The systemContent schema provider built into Sitecore GraphQL does indeed provide mutations to createItem, updateItem, and deleteItem. The Sitecore-provided /sitecore/api/graph/items/master endpoint exposes these, and details can be found in the Schema Docs in the GraphQL IDE accessible at /sitecore/api/graph/items/master/ui. Note that for these to work successfully, the context user executing them must have appropriate authorizations. If you are using the systemService security configuration on the endpoint (the default for the example), you may need additional configuration for it to authenticate using cookies. If using publicService or otherwise authenticating with an API Key, the Impersonation User configured on the API Key will need appropriate rights. Note as well that when setting item field values, the mutations accept a value of type FieldValueInput, which expects a JSON value for the field value. The docs on this graph type provide examples of accepted values: Field type Value Checkbox &quot;true&quot;, &quot;false&quot; Integer &quot;5&quot; Number &quot;5.5&quot; Single-Line Text &quot;'Home'&quot; Multi-Line Text, Rich Text &quot;'line1\r\nline2'&quot; Date and Datetime &quot;'2019-08-04T13:33:03.969Z'&quot; Checklist [&quot;0DD426E8-F61B-447E-8484-A1FF33115963&quot;,&quot;B3576ED6-05C9-49E7-B12B-918D5B2CF430&quot;] General Link &quot;{'text':'some test', 'anchor': 'anchor', 'linktype':'internal','queryString':'sc_lang=en','className': 'linkClass', 'targetItem':'110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9', 'target':'target', 'url': 'some url'}&quot; Note the nested double/single quotes on text values in particular, to make them valid JSON. Example Queries Create Item mutation CreateItem { createItem( name: &quot;ExampleItem&quot; template: &quot;{76036F5E-CBCE-46D1-AF0A-4143F9B557AA}&quot; parent: &quot;{0DE95AE4-41AB-4D01-9EB0-67441B7C2450}&quot; language: &quot;en&quot; fields: [ { name: &quot;title&quot;, value: &quot;'Example Item'&quot; } { name: &quot;text&quot;, value: &quot;'This is an example item created with GraphQL'&quot; } ] ) { path } } Update Item mutation UpdateItem { updateItem( path: &quot;/sitecore/content/ExampleItem&quot; language: &quot;en&quot; version: 1 fields: [{ name: &quot;title&quot;, value: &quot;'Example Item with changed title'&quot; }] ) { ... on SampleItem { title { value } } } } Delete Item mutation DeleteItem { deleteItem( path: &quot;/sitecore/content/ExampleItem&quot; ) }
Create / Update / Delete items in Sitecore via GraphQL The Sitecore Headless GraphQL documentation has some good examples for querying data. However I don't see any for mutations such as updating an item's fields, creating new items, or deleting items. As an example, say I have an item of template Listing which has a field called description. How do I update the field? I tried this but I think the syntax is wrong. mutation UpdateListing($path: String, $description String) { item(path: $path) { id ...on Listing { description { value: $description } } } }
I had the same problem and after the TDS installation finished and before the VSIX installation I ended all msiexec processes and after that I did the VSIX installation. With these steps I was able to install TDS and the extension on VS2019.
Error Another setup is already running when trying to install TDS on VS2019 I have a Sitecore 9.3 XP0 instance installed on my machine and now I'm trying to set up the TDS v6.0.0.31 on my Visual Studio 2019 v16.10.1, but whenever I install it the following error is thrown: Select Continue to install Visual Studio while the other install is running. This might cause problems with other parts of the installation. Select Retry to continue with the Visual Studio install once the other install has completed. Select Cancel to cancel the Visual Studio install. 30/08/2021 10:01:13 - Pre-check verification failed with warning(s) : AnotherInstallationRunning. 30/08/2021 10:01:13 - Erro de Instalação: System.AggregateException: Um ou mais erros. ---> System.OperationCanceledException: Pre-check verification failed with warning(s) : AnotherInstallationRunning. ---> Microsoft.VisualStudio.Setup.CanceledByPrecheckException: Pre-check verification failed with warning(s) : AnotherInstallationRunning. --- Fim do rastreamento de pilha de exceções internas --- em Microsoft.VisualStudio.Setup.PrecheckManager.RunPrechecks(PrecheckParameters precheckParameters, VariableCollection properties) em Microsoft.VisualStudio.Setup.Engine.RunPrecheck(String destination, Product product, ExecuteAction action, IWindowsRestartManager rmService, ITelemetryOperation installOperation, InstallOperation install) em Microsoft.VisualStudio.Setup.Engine.Install(Product product, String destination, CancellationToken token) em Microsoft.VisualStudio.ExtensionManager.SetupEngineService.<Install>b__14_0() em System.Threading.Tasks.Task`1.InnerInvoke() em System.Threading.Tasks.Task.Execute() --- Fim do rastreamento de pilha de exceções internas --- em System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) em System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) em Microsoft.VisualStudio.ExtensionManager.SetupEngineService.Install() em Microsoft.VisualStudio.ExtensionManager.ExtensionEngineImpl.PerformSetupEngineInstall(InstallableExtensionImpl extension, Boolean installPerMachine, Boolean isPackComponent, IDictionary`2 extensionsInstalledSoFar, List`1 extensionsUninstalledSoFar, IInstalledExtensionList modifiedInstalledExtensionsList, IProgress`1 progress, InstallFlags installFlags, AsyncOperation asyncOp, Version targetedVsVersion, IInstalledExtension&amp; newExtension) em Microsoft.VisualStudio.ExtensionManager.ExtensionEngineImpl.InstallInternal(InstallableExtensionImpl extension, InstallFlags installFlags, IDictionary`2 extensionsInstalledSoFar, List`1 extensionsUninstalledSoFar, IInstalledExtensionList modifiedInstalledExtensionsList, AsyncOperation asyncOp, IProgress`1 progress, Version targetedVsVersion) em Microsoft.VisualStudio.ExtensionManager.ExtensionEngineImpl.BeginInstall(IInstallableExtension installableExtension, InstallFlags installFlags, AsyncOperation asyncOp, Version targetedVsVersion) em Microsoft.VisualStudio.ExtensionManager.ExtensionEngineImpl.InstallWorker(IInstallableExtension extension, InstallFlags installFlags, AsyncOperation asyncOp) ---> (Exceção Interna N° 0) System.OperationCanceledException: Pre-check verification failed with warning(s) : AnotherInstallationRunning. ---> Microsoft.VisualStudio.Setup.CanceledByPrecheckException: Pre-check verification failed with warning(s) : AnotherInstallationRunning. --- Fim do rastreamento de pilha de exceções internas --- em Microsoft.VisualStudio.Setup.PrecheckManager.RunPrechecks(PrecheckParameters precheckParameters, VariableCollection properties) em Microsoft.VisualStudio.Setup.Engine.RunPrecheck(String destination, Product product, ExecuteAction action, IWindowsRestartManager rmService, ITelemetryOperation installOperation, InstallOperation install) em Microsoft.VisualStudio.Setup.Engine.Install(Product product, String destination, CancellationToken token) em Microsoft.VisualStudio.ExtensionManager.SetupEngineService.<Install>b__14_0() em System.Threading.Tasks.Task`1.InnerInvoke() em System.Threading.Tasks.Task.Execute()<--- I've already done the steps suggested in the following link but even after kill all msiexec.exe running processes I'm still getting the same error. I receive the error “Another setup is already running
By default Sitecore eventhandlers are executed synchronously. I think in your case it depends on what you are trying to achieve in sitecore content/experience editor, if you need to have the change visible immediately to the editor or if it is ok to handle it async after the item has been renamed. If you have a long running operation you can use instead a sitecore job, you can take a look at more details on https://stackoverflow.com/questions/24693179/are-sitecore-events-handled-synchronously. If you run tasks asynchronous you also need to take into consideration updating the content tree view if the editor is on the item that will be moved.
Rename and move item to proper bucket, programatically Is there a way to move an item in a bucket (based on some rules) after it has been renamed? Basically the following behaviour is wanted: Rename the item If bucket exists ---> move it there If bucket not exist ---> create bucket ---> move it there The thing is that I created a command with custom button, added it in the context menu, but first I have to show the Rename modal and only after I move the item. Any help is welcome. Thanks LE: I've done it with a custom item:renamed event handler, but the UI is freezing until the logic is executed, and I am unable to make it async. Is there a workaround or solution for this? My code looks like below: public void OnItemRenamed(object sender, EventArgs args) { if (Event.ExtractParameter(args, 0) is Item item &amp;&amp; item != null) { if (item.TemplateID.ToString().Equals(TemplateIdConstants.GlobalPageCollectionItem)) { IlikeToMoveItMoveIt(item); } } } private void IlikeToMoveItMoveIt(Item itemToBeMoved) { try { var helper = new Helper(); var destination = helper.GetDestination(itemToBeMoved); itemToBeMoved.MoveTo(destination); } catch (Exception ex) { SitecoreReal.Diagnostics.Log.Error(string.Format(&quot;Error in move/publish for {0} - exception: {1}&quot;, itemToBeMoved.ID, ex.Message), string.Empty); } }
When using Sitecore Identity Service for login (default on Sitecore 9.1+), you must configure additional URLs for which Sitecore will apply authentication cookies. For this example, a configuration patch on your CM such as the following would accomplish this: <configuration> <sitecore> <pipelines> <owin.cookieAuthentication.validateIdentity> <processor type=&quot;Sitecore.Owin.Authentication.Pipelines.CookieAuthentication.ValidateIdentity.ValidateSiteNeutralPaths, Sitecore.Owin.Authentication&quot;> <siteNeutralPaths hint=&quot;list&quot;> <path hint=&quot;graphql&quot;>/sitecore/api/graph/items/</path> </siteNeutralPaths> </processor> </owin.cookieAuthentication.validateIdentity> </pipelines> </sitecore> </configuration> Additionally, if using Headless Services 18.0+, the new GraphQL Playground IDE used for the GraphQL UI will not pass cookies by default. In the Settings (accessible via the gear icon the upper right corner), change request.credentials to same-origin and click Save Settings.
Getting "Authentication required" error when attempting to use systemService with Sitecore GraphQL I'm trying to use the example /sitecore/api/graph/items/master endpoint for Sitecore GraphQL, which uses the systemService security configuration. However when I visit /sitecore/api/graph/items/master/ui, I get an Authentication required error. I am logged into Sitecore and can access the Launchpad and Content Editor. How can I use this GraphQL example and systemService?
Installing Constellation.Feature.Redirects gets you a new Sitecore app for the Sitecore Desktop called Redirect Manager. This application allows you to create, update, export, and import a list of marketing redirects. You also get an Item Template that you can use to insert a Page Redirect anywhere in your content tree. This allows you to create short URLs that link to deeper content, or to host a URL within a given section of your site that points to something external to that branch of the content tree. Installation Constellation.Feature.Redirects is managed via NuGet. In Visual Studio, fire up the Package Manager console and install into a Web Application project: PM:> Install-Package Constellation.Feature.Redirects Once you will install this library you will get the option Redirect Manager in Desktop from Launchpad. Click on the redirect manager and it will redirect you to the new Window: In the Redirect Windows manager, you can perform the below operation Adding a New Marketing Redirect Editing Existing Redirects Importing and Exporting Marketing Redirects See the blog post for more details: Redirects Compatibility: Yes, It's compatible with Sitecore 10. Constellation is now compatible with Sitecore 10
Is there a URL Rewrite module for Sitecore 10.1.0? Does anyone know of a URL Rewrite module that is compatible with Sitecore 10.1.0 without SXA?
Both hidden inputs (fxb_guid_Fields_Index_guid and fxb_guid_Fields_guid__ItemId) usually contain the same value which is the ID of the field item. If you copy the value and search for it in Sitecore, you will see that it's a field item under /sitecore/Forms/YOUR_FORM/Page/Section/Field Name. Why it's there? So Sitecore can save it with right id in the database and that it can process proper mappings when executing save actions. Code which uses them is Sitecore code. You may try to decompile Sitecore dlls with 'Forms' in their name.
What are the hidden Input Fields added by default in Sitecore 9 Forms? I'm using Sitecore 9 Forms currently (not WFFM forms). After adding a Single-Line Text element, when I look at the HTML output generated by the form, I noticed that there are 2 additional hidden input fields getting added by default, before the label and input elements corresponding to the text field. It's usually in this format as show below (displaying the GUIDs with string &quot;guid&quot;): <div data-sc-field-key=&quot;guid&quot; class=&quot;abc&quot;> <input id=&quot;fxb_guid_Fields_Index_guid&quot; name=&quot;fxb.guid.Fields.Index&quot; type=&quot;hidden&quot; value=&quot;guid&quot;> <!-- what is this used for? --> <input id=&quot;fxb_guid_Fields_guid__ItemId&quot; name=&quot;fxb.guid.Fields[guid].ItemId&quot; type=&quot;hidden&quot; value=&quot;guid&quot;> <!-- what is this used for? --> <label for=&quot;fxb_guid_Fields_guid__Value&quot; class=&quot;abc&quot; id=&quot;abc&quot;>Label</label> <!-- Label for textfield --> <input id=&quot;fxb_guid_Fields_guid__Value&quot; name=&quot;fxb.guid.Fields[guid].Value&quot; class=&quot;abc&quot; type=&quot;text&quot; .....> <!-- Input for textfield --> </div> What are the function of these input elements and if possible, where can I see how it is being used in the source code?
You are missing the code in SecurityTokenValidated event to call ApplyClaimsTransformations, it needs to include something like this (make sure to keep your other code there too: private Task OnSecurityTokenValidated(SecurityTokenValidatedNotification<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> context) { TransformationContext transformationContext = new TransformationContext(FederatedAuthenticationConfiguration, GetIdentityProvider()); context.AuthenticationTicket.Identity.ApplyClaimsTransformations(transformationContext); return Task.CompletedTask; }
Sitecore Federated Authentication unable to login Unable to get and an external login info I am using Federated Authentication with Auth0. Right after login, I get the following error: ERROR [Sitecore.Owin.Authentication.Pipelines.Initialize.HandleLoginLink] 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. As per the information in the website I added this on the config as well: <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.xmlsoap.org/ws/2005/05/identity/claims/name&quot; /> </sources> <targets hint=&quot;raw:AddTarget&quot;> <claim name=&quot;http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier&quot; /> </targets> <keepSource>true</keepSource> </transformation> public class Auth0IdentityProviderProcessor : IdentityProvidersProcessor { public Auth0IdentityProviderProcessor(FederatedAuthenticationConfiguration federatedAuthenticationConfiguration, ICookieManager cookieManager, BaseSettings settings) : base(federatedAuthenticationConfiguration, cookieManager, settings) { } /// <summary> /// Identityprovider name. Has to match the configuration /// </summary> protected override string IdentityProviderName => &quot;Auth0&quot;; protected IdentityProvider IdentityProvider { get; set; } protected override void ProcessCore(IdentityProvidersArgs args) { Assert.ArgumentNotNull(args, &quot;args&quot;); IdentityProvider = this.GetIdentityProvider(); // Configure Auth0 parameters string auth0Domain = Sitecore.Configuration.Settings.GetSetting(&quot;Auth0:Domain&quot;); string auth0ClientId = Sitecore.Configuration.Settings.GetSetting(&quot;Auth0:ClientId&quot;); string auth0RedirectUri = Sitecore.Configuration.Settings.GetSetting(&quot;Auth0:RedirectUri&quot;); string auth0PostLogoutRedirectUri = Sitecore.Configuration.Settings.GetSetting(&quot;Auth0:PostLogoutRedirectUri&quot;); AntiForgeryConfig.UniqueClaimTypeIdentifier = ClaimTypes.NameIdentifier; // Sequence of this middleware matters. The KentorOwinCookieSave must comes before OpenIdConnectAuthentication. args.App.UseKentorOwinCookieSaver(); var options = new OpenIdConnectAuthenticationOptions { AuthenticationType = this.GetAuthenticationType(), Authority = $&quot;https://{auth0Domain}&quot;, ClientId = auth0ClientId, RedirectUri = auth0RedirectUri, PostLogoutRedirectUri = auth0PostLogoutRedirectUri, ResponseType = OpenIdConnectResponseType.IdToken, Scope = &quot;openid profile&quot;, TokenValidationParameters = new TokenValidationParameters { NameClaimType = &quot;name&quot; }, Notifications = new OpenIdConnectAuthenticationNotifications { SecurityTokenValidated = notification => { notification.AuthenticationTicket.Identity.AddClaim(new Claim(&quot;idp&quot;, &quot;Auth0&quot;)); notification.AuthenticationTicket.Identity.AddClaim(new Claim(&quot;id_token&quot;, notification.ProtocolMessage.IdToken)); return Task.FromResult(0); }, RedirectToIdentityProvider = notification => { if (notification.ProtocolMessage.RequestType == OpenIdConnectRequestType.Authentication) { // The context's ProtocolMessage can be used to pass along additional query parameters // to Auth0's /authorize endpoint. var paramsDictionary = notification.OwinContext.Request.Context.Authentication .AuthenticationResponseChallenge?.Properties.Dictionary; if (paramsDictionary != null &amp;&amp; paramsDictionary.ContainsKey(&quot;screen_hint&quot;)) { notification.ProtocolMessage.SetParameter(&quot;screen_hint&quot;, paramsDictionary[&quot;screen_hint&quot;]); } } else if (notification.ProtocolMessage.RequestType == OpenIdConnectRequestType.Logout) { var logoutUri = $&quot;https://{auth0Domain}/v2/logout?client_id={auth0ClientId}&quot;; var postLogoutUri = notification.ProtocolMessage.PostLogoutRedirectUri; if (!string.IsNullOrEmpty(postLogoutUri)) { if (postLogoutUri.StartsWith(&quot;/&quot;)) { // transform to absolute var request = notification.Request; postLogoutUri = request.Scheme + &quot;://&quot; + request.Host + request.PathBase + postLogoutUri; } logoutUri += $&quot;&amp;returnTo={Uri.EscapeDataString(postLogoutUri)}&quot;; } notification.Response.Redirect(logoutUri); notification.HandleResponse(); } return Task.FromResult(0); } } }; // Configure Auth0 authentication args.App.UseOpenIdConnectAuthentication(options); } } I even tried the fix from this link: Federated authentication with OpenIDConnect gives &quot;Unsuccessful login with external provider&quot; Still the error persists. Any insights or suggestion would be really helpful. Thank you
Unfortunately, this doesn't work in Sitecore 9.3: https://doc.sitecore.com/en/developers/93/platform-administration-and-architecture/search-result-boosting.html You can store the viewsCount in an indexed field and sort by it. Or move away from LINQ and directly query Solr.
Boosting items by its own field values I'm using Sitecore 9.3 and Solr 8.2.1, I had Solr index-time boosting in my old search implementation, but after I upgraded to a new Solr version, it is deprecated now. Imagine I have an item with field called viewsCount, what I want to achieve is boosting this item by the viewsCount value at the query-time, like this: query.Where(b => b.Boost(b.viewsCount)) This is not applicable as I don't have the viewsCount value at the time of preparation the predicate, I had this value in html tags and it was used for boosting but in the old implementation for the time-index boosting.
You can gather the Sitecore TDS License expiration date for an active installation, looking at the ExpireDate subkey of the Computer\HKEY_CURRENT_USER\SOFTWARE\HedgehogDevelopment\Sitecore Visual Studio Integration 2.0\ActivatedLicense15 key in the registry of the machine where TDS is installed. Note that this is the registry key for TDS 5.7.0.16. I don't know if the registry key path is the same for other versions.
How to check TDS license expiration date? How can I check the Sitecore TDS license expiration date?
If you go with the second option (real Contact instance), you can use reflection (e.g. ReflectionUtil) to set FacetMap property on the contact instance. FacetMap is then used by Facets and GetFacet calls. [Test] public void Test1() { var contact = new Contact(); var facetMap = new Dictionary<string, Facet>(); var firstName = &quot;Marek&quot;; facetMap[PersonalInformation.DefaultFacetKey] = new PersonalInformation { FirstName = firstName }; Sitecore.Reflection.ReflectionUtil.SetProperty(contact, &quot;FacetMap&quot;, facetMap); Assert.AreEqual(firstName, contact.GetFacet<PersonalInformation>().FirstName); }
How to mock XConnect contact I'm writing unit tests and using Moq as a mocking tool. In a previous question I was advised to use IXdbContext to mock the XConnect client, which works just fine. However, I run into problems if I mock the GetAsync() method to be able to get a Contact. I need to get facets off of the returned Contact so I either have to mock a Contact and override the GetFacet<>() method, or create a real Contact instance with the proper facets in its Facets collection. The first option fails because Contact is sealed, and the second option fails because the Facets collection is a ReadOnlyDictionary which can't be written to. So how can I properly mock a Contact that I can return in GetAsync() so that I can get facets out of it?
Other option to install it is to override the Sitecore 10 files with Sitecore 10.1 files. Looks like just files were changed in Sitecore 10.1 release. From my point of view is much more simpler to install a vanilla of 10.1, upgrade your NUGET packages to use 10.1 version and deploy it on vanilla solution.
Sitecore upgrade from Sitecore 10.0 to 10.1 - Can we upgrade without installing vanilla instance? We like to upgrade from Sitecore 10.0.1 to 10.1. But, the official documentation is stating that we need to: Install vanilla instance parallel to our main instance. Attach the databases to the new installation. Deploy your solution on top of the new installation. Is there any other way to upgrade which does not involve installing the vanilla instance? Any detailed explanation will be much appreciated!
The dynamic package generation uses item Statistics to make the call if an item qualifies to be included in the package. So, if the fields there are updated, it should include it in the package. Do you have any other criteria like name, template, or user selected? Try the &quot;Within the past days&quot; filter than the date filter. The days uses the server time vs ISO time.
Sitecore Package Designer - Items Dynamically - not working As a measure to make sure we do not overwrite content updates made by content authors in the Production Content Management System, we create Content Packages from production to copy down to QA using the &quot;Items Dynamically&quot; option and a date range from the last deployment to present day. There are a few known item name changes made on 8/4/2021, and the Updated Date field on the items confirms the item was changed. However, when I design a package via items dynamically from 07/14/21 - 09/02/21 the items that had name changes on 8/4/21 are not included in the package that is generated. Is there anyone who can speak to the limitations of package creation for items dynamically added, and is it only optimal for specific types of changes to items in the content tree?
Search results signature is one of the Search Box rendering properties which can be convenient when you have more than one search result rendering on the page. To show different search results (with different scope) on the same search result page, you need to do the following: 1. Search Box Configuration: To edit the default behaviour of the search box, open the Control Properties dialog box and edit the Search results signature field: enter the unique signature of a specific Search Results rendering to limit the search results. This will be convenient when you have more than one search result rendering on the page. In your case, you’ll be having two search results rendering on the search page. Just placed all the Search Results signatures in the Search results signature separated by “,”. 2. Search result configuration: Open the search page in experience editor and edit the Search Criteria for both search result boxes. eg First search box second search box Refer to this blog for more details: https://sitecorewithraman.wordpress.com/2021/08/10/sxa-multiple-search-results/
What is a search results signature? What is a search result signature. I have two searches on a page filtering with different scopes. They both bring back the same data and count which is incorrect and I suspect I need to bind a search results signature but where do I find this on the search result? Apologies for ground level noobness.
Prerequisites The following must be setup in advance to make logging to Splunk possible. Configure Splunk HEC Note: The following example could use some TLC but gets the job done. Code First step is to write some code that taps into the logging mechanism in Sitecore (log4net). using System; using System.Net.Http; using System.Net.Http.Headers; using System.Text; using System.Threading.Tasks; using log4net.Appender; using log4net.spi; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; namespace Scms.Foundation.Logging { public class SplunkAppender : AppenderSkeleton { private readonly HttpClient _httpClient; private Uri _baseUrl; public SplunkAppender() { var httpClientHandler = new HttpClientHandler { ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator }; _httpClient = new HttpClient(httpClientHandler); } public string Url { get; set; } public string Token { get; set; } public override void ActivateOptions() { base.ActivateOptions(); _baseUrl = new Uri(Url); _httpClient.DefaultRequestHeaders.ExpectContinue = false; if (string.IsNullOrWhiteSpace(Token)) return; _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(&quot;Splunk&quot;, Token); } protected override void Append(LoggingEvent loggingEvent) { Task.Run(async () => { try { var logEntry = new SplunkLogEntry { Event = { Level = loggingEvent.Level.Name, Message = loggingEvent.RenderedMessage, Time = loggingEvent.TimeStamp.ToString(&quot;HH:mm:ss&quot;), Date = loggingEvent.TimeStamp.ToString(&quot;yyyy-MM-dd&quot;), Username = loggingEvent.UserName }, Source = loggingEvent.LoggerName }; var serializedContent = JsonConvert.SerializeObject(logEntry, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore, ContractResolver = new CamelCasePropertyNamesContractResolver() }); var stringContent = new StringContent(serializedContent, Encoding.UTF8, &quot;application/json&quot;); var responseMessage = await _httpClient.PostAsync(_baseUrl, stringContent); } catch (Exception ex) { this.ErrorHandler.Error(&quot;Unable to send logging event to remote host: &quot; + Url, ex); } }); } } public class SplunkLogEntry { public string Index { get; set; } = &quot;sitecore&quot;; [JsonProperty(&quot;sourcetype&quot;)] public string SourceType { get; set; } = &quot;sitecore:log4net&quot;; public string Source { get; set; } = nameof(SplunkAppender).ToLower(); public string Host { get; set; } = Environment.MachineName.ToLower(); public SplunkEvent Event { get; set; } = new SplunkEvent(); } public class SplunkEvent { public string Level { get; set; } public string Message { get; set; } public string Time { get; set; } public string Date { get; set; } public string Username { get; set; } } } Second step is to patch in the new appender. <?xml version=&quot;1.0&quot;?> <configuration xmlns:patch=&quot;http://www.sitecore.net/xmlconfig/&quot;> <sitecore> <log4net> <appender name=&quot;SplunkAppender&quot; type=&quot;Scms.Foundation.Logging.SplunkAppender, Scms.Foundation&quot;> <url value=&quot;https://your-splunk-instance:8088/services/collector/raw&quot; /> <token value=&quot;your-guid-from-splunk&quot; /> <layout type=&quot;log4net.Layout.PatternLayout&quot;> <conversionPattern value=&quot;%4t %d{ABSOLUTE} %-5p %m%n&quot;/> </layout> </appender> <root> <appender-ref ref=&quot;SplunkAppender&quot; /> </root> </log4net> </sitecore> </configuration> Finally, log into Splunk and watch all your hard work pay off. Possible Enhancements Rewrite code to use an AsyncBufferingForwardingAppender as seen in this article, repo, and another repo
How do you push log data to Splunk? We are trying to consolidate our logging data in Splunk and then limit/reduce access to the Sitecore servers. I've not seen much from the community on how to set this up. Are there any examples available demonstrating how to do this?
When you add a new Sender an email is send to the mail you set it up to confirm the sender. After you confirm the email on the Moosend dashboard you will see: Did you get confirmation mail ? I used gmail accounts and it works fine. Maybe on your business email you have some special security rules Update Raman wrote to Moosend support and he receive next answer: We have many checkers that run once you add a sender so one of them was stopping it - but i manually checked it, saw that it was okay and accepted it for you! If you have similar issue write to Moosend support
Why Senders are not getting approved in Moosend? I am working on the trial version of the Sitecore Moosend platform, where I signed up with my organization's email address. As part of the initial set-up, I am adding a new sender. But all the senders are getting rejected. I've tried adding sender with the moosend.com domain as well as my professional email address. Does anyone have an idea about this?
You can try to override Sitecore.ItemWebApi.Pipelines.Request.SerializeResponse, Sitecore.ItemWebApi' this pipeline. <configuration xmlns:patch=&quot;http://www.sitecore.net/xmlconfig/&quot;> <sitecore> <pipelines> <itemWebApiRequest> <processor patch:instead=&quot;*[@type='Sitecore.ItemWebApi.Pipelines.Request.SerializeResponse, Sitecore.ItemWebApi']&quot; type=&quot;Sitecore.SharedSource.ItemWebApiCustom.Override.SerializeResponseOverride, Sitecore.SharedSource.ItemWebApiCustom&quot; /> </itemWebApiRequest> </pipelines> </sitecore> </configuration> using System; using System.Web.Script.Serialization; using Newtonsoft.Json; using Sitecore.Diagnostics; using Sitecore.ItemWebApi.Serialization; using Formatting = System.Xml.Formatting; namespace Sitecore.SharedSource.ItemWebApiCustom.Override { public class SerializerOverride : ISerializer { public string Serialize(object value) { Assert.ArgumentNotNull(value, &quot;value&quot;); var serializer = new JavaScriptSerializer {MaxJsonLength = Int32.MaxValue}; dynamic parsedJson = JsonConvert.DeserializeObject(serializer.Serialize(value)); return JsonConvert.SerializeObject(parsedJson, (Newtonsoft.Json.Formatting) Formatting.Indented); } public string SerializedDataMediaType => &quot;application/json&quot;; } } using Sitecore.Diagnostics; using Sitecore.ItemWebApi.Pipelines.Request; namespace Sitecore.SharedSource.ItemWebApiCustom.Override { public class SerializeResponseOverride : SerializeResponse { public override void Process(RequestArgs arguments) { Assert.ArgumentNotNull(arguments, &quot;arguments&quot;); SerializerOverride serializer = new SerializerOverride(); arguments.ResponseText = serializer.Serialize(arguments.Result); } } }
Insert link UI window is not showing items from bucket Let there be a bucket with the structure: Parent/a/b/c/abc item name, and the bucket from layer 3, which contains 295 items. Let there be an item with a field of type &quot;General Link with Search&quot;. When I click insert link and navigate to &quot;abc item name&quot; from above, the Insert Link modal is not extending the 3rd layer bucket, thus I cannot see items from it. If I navigate to the same bucket from the Content Editor, it loads all the 295 items. Is there any setting or limitation I am not aware of? Thanks
You can create alias in Sitecore either at the same time while you are creating articles in Sitecore or manually create alias after all articles are created. Programmatically create alias If you want to create programmatically then create items inside /sitecore/system/Aliases from this template /sitecore/templates/System/Alias https://doc.sitecore.com/en/developers/93/sitecore-experience-manager/create-an-alias.html Manually create alias Below is the link to create an alias manually: https://doc.sitecore.com/en/developers/90/sitecore-experience-manager/create-an-alias-in-the-content-editor.html
Dynamic item tree url is very lengthy. SEO rank is degrading I have a requirement. My application is generating Articles from the Backend. Import data from 3rd party. Convert the Information into Class. Create Items into Sitecore. Now based on the Import, the Item creation tree is dynamic. As the data is coming from Import, there is no predictability about the path. Example: sitecore/content/home/article/health/diabetes/low/prescription/medication/simple-diabetic-precautions sitecore/content/home/article/sport/soccer/national/player/goolkeeper/professional/strength/corners/save-theedges sitecore/content/home/articles/health/insurance/medical-type/cancer/blood/stage-3/intense-care-preparation the above path is just pseudocode, to avoid violations. can we do anything in this case to shorten the URL? Thanks in advance, Regards, Sunil Rana
The Event List component is using Rendering Variants to render all the fields. To render a date it is using default Sitecore FieldRenderer so it is server site date. Using client-side time settings would require some custom implementation. You could for example implement your own: Token Scriban which would take the client timezone and replace existing Variant Date items.
Sitecore SXA Events Component I am using sitecore 10.1 with SXA, when using the Events components its shows the date time with server timezone regardless the client timezone, is there an option that allows the date\time displayed to be converted to the client timezone?
Check the answer to below stackexchange question for working code - Federated Authentication with Azure AD - Sitecore 9.3 - .Aspnet .Cookies not getting created
Sitecore 9.3 - Sitecore.Owin.Authentication - Unable to find "idp" claim in the identity I am working on upgrading a project from sitecore 8.1 to 9.3. I have added a new identity provider - AzureB2C to login into sites. It is using OpenIdConnect. I am able to navigate to the login page and get authenticated as well, but upon returning, I get blank error page - It is redirecting to the redirectUrl configured and sends code, token and state as well. But after that this issue occurs. Below are the code and configs - Config 1 <configuration xmlns:patch=&quot;http://www.sitecore.net/xmlconfig/&quot;> <sitecore> <pipelines> <initialize> <processor type=&quot;Project.SC.Feature.Login.Models.Routes.RegisterAuthRoutes, Project.SC.Feature.Login&quot; patch:before=&quot;processor[@type='Sitecore.Mvc.Pipelines.Loader.InitializeRoutes, Sitecore.Mvc']&quot; resolve=&quot;true&quot; /> </initialize> <owin.identityProviders> <!--This is the custom processor that gets executed when azure AD posts the token to Sitecore--> <processor type=&quot;Project.SC.Feature.Login.Providers.AzureAdB2CIdentityProviderProcessor, Project.SC.Feature.Login&quot; resolve=&quot;true&quot; /> </owin.identityProviders> </pipelines> <services> <!-- <configurator type= &quot;Feature.AzureAdB2C.Models.AuthenticationConfigurator, Feature.AzureAdB2C&quot;/>--> <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 hint=&quot;list:AddIdentityProvidersPerSites&quot;> </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>CustomDomainName</domain> <transformations hint=&quot;list:AddTransformation&quot;> <transformation name=&quot;nameClaimTransformation&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.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier&quot; /> </targets> <keepSource>true</keepSource> </transformation> </transformations> </identityProvider> </identityProviders> <!--List of all shared transformations--> <sharedTransformations> </sharedTransformations> <!--Property mappings initializer--> <propertyInitializer type=&quot;Sitecore.Owin.Authentication.Services.PropertyInitializer, Sitecore.Owin.Authentication&quot;> </propertyInitializer> </federatedAuthentication> </sitecore> </configuration> Config 2 <configuration> <sitecore> <federatedAuthentication> <identityProvidersPerSites> <mapEntry name=&quot;portal&quot; type=&quot;Sitecore.Owin.Authentication.Collections.IdentityProvidersPerSitesMapEntry, Sitecore.Owin.Authentication&quot; resolve=&quot;true&quot;> <sites hint=&quot;list&quot;> <site>portal</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> </federatedAuthentication> </sitecore> </configuration> IdentityProviderProcessor - using System; using System.Collections.Generic; using System.Linq; using System.Security.Claims; using System.Threading.Tasks; using Project.SC.Feature.Login.Configuration; using Project.SC.Feature.Login.Extensions; using Project.SC.Feature.Login.Models; using Microsoft.IdentityModel.Protocols; using Microsoft.IdentityModel.Tokens; using Microsoft.Owin.Infrastructure; using Microsoft.Owin.Security; using Microsoft.Owin.Security.Notifications; using Microsoft.Owin.Security.OpenIdConnect; using Owin; using Sitecore.Abstractions; using Sitecore.Configuration; using Sitecore.Diagnostics; using Sitecore.Owin.Authentication.Configuration; using Sitecore.Owin.Authentication.Extensions; using Sitecore.Owin.Authentication.Pipelines.IdentityProviders; using Sitecore.Owin.Authentication.Services; using Sitecore.Text; using Sitecore.Web; using OpenIdConnectMessage = Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectMessage; namespace Project.SC.Feature.Login.Providers { [CLSCompliant(false)] public class AzureAdB2CIdentityProviderProcessor : IdentityProvidersProcessor { protected override string IdentityProviderName => &quot;AzureAdB2C&quot;; public AzureAdB2CIdentityProviderProcessor( FederatedAuthenticationConfiguration federatedAuthenticationConfiguration, ICookieManager cookieManager, BaseSettings settings) : base(federatedAuthenticationConfiguration, cookieManager, settings) { } protected override void ProcessCore(IdentityProvidersArgs args) { Assert.ArgumentNotNull(args, nameof(args)); Log.Info(&quot;Inside AzureAdB2CIdentityProviderProcessor -> processcore &quot;, typeof(AzureAdB2CIdentityProviderProcessor)); List<SiteInfo> siteInfoList = Factory.GetSiteInfoList(); IEnumerable<OpenIdConnectSiteInfo> sites = siteInfoList.Select(s => new OpenIdConnectSiteInfo(s)).Where(s => s.UsesOpenIdConnect); foreach (OpenIdConnectSiteInfo site in sites) { Log.Info(&quot;Inside foreach site in sites AzureAdB2CIdentityProviderProcessor&quot;, typeof(AzureAdB2CIdentityProviderProcessor)); // NOTE [ILs] SXA allows adding multiple hostnames to be matched seperated by | foreach (string hostname in site.HostName.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries)) { Log.Info(&quot;Inside foreach hostname in site.hostname AzureAdB2CIdentityProviderProcessor&quot;, typeof(AzureAdB2CIdentityProviderProcessor)); // args.App.UseOpenIdConnectAuthentication(CreateOptionsFromSiteInfo(site)); args.App.MapWhen( ctx => ctx.MapDomain(hostname) &amp;&amp; ctx.MapFolder(site.VirtualFolder), app => { CookieAuthentication.ConfigureCookieAuthentication(app); app.UseOpenIdConnectAuthentication(CreateOptionsFromSiteInfo(site)); }); Log.Info(&quot;After MapWhen AzureAdB2CIdentityProviderProcessor&quot;, typeof(AzureAdB2CIdentityProviderProcessor)); } } } private OpenIdConnectAuthenticationOptions CreateOptionsFromSiteInfo(OpenIdConnectSiteInfo site) { OpenIdConnectAuthenticationOptions options = new OpenIdConnectAuthenticationOptions(); var identityProvider = GetIdentityProvider(); Log.Info(&quot;Start AzureAdB2CIdentityProviderProcessor -> CreateOptionsFromSiteInfo &quot;, typeof(AzureAdB2CIdentityProviderProcessor)); // For each policy, give OWIN the policy-specific metadata address, and // set the authentication type to the id of the policy options.MetadataAddress = site.Authority; options.AuthenticationType = GetAuthenticationType(); options.RedirectUri = site.RedirectUri; options.PostLogoutRedirectUri = site.PostlogoutRedirectUri; options.TokenValidationParameters = new TokenValidationParameters { NameClaimType = site.NameClaimType, SaveSigninToken = true }; options.Notifications = new OpenIdConnectAuthenticationNotifications() { AuthenticationFailed = context => HandleOpenIdConnectAuthenticationFailed(context, site), RedirectToIdentityProvider = context => HandleOpenIdConnectRedirectToIdentityProvider(context, site), //SecurityTokenValidated = notification => //{ // notification.AuthenticationTicket.Identity.AddClaim(new Claim(&quot;idp&quot;, &quot;azureadb2c&quot;)); // // transform all claims // ClaimsIdentity identity = notification.AuthenticationTicket.Identity; // notification.AuthenticationTicket.Identity.ApplyClaimsTransformations(new TransformationContext(FederatedAuthenticationConfiguration, identityProvider)); // return Task.CompletedTask; //} }; // These are standard OpenID Connect parameters, with values pulled from web.config options.ClientId = site.ClientId; //http://openid.net/specs/openid-connect-core-1_0.html#AuthRequest options.Scope = site.Scope; //http://openid.net/specs/openid-connect-core-1_0.html#Authentication options.ResponseType = OpenIdConnectResponseTypes.CodeIdToken; Log.Info(&quot;End AzureAdB2CIdentityProviderProcessor -> CreateOptionsFromSiteInfo&quot;, typeof(AzureAdB2CIdentityProviderProcessor)); return options; } /* * 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) { Log.Info(&quot;Start AzureAdB2CIdentityProviderProcessor -> HandleOpenIdConnectRedirectToIdentityProvider&quot;, typeof(AzureAdB2CIdentityProviderProcessor)); 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); } try { AddLanguageQueryString(notification); } catch (Exception ex) { Log.Error(ex.Message, ex, typeof(OpenIdConnectAuthentication)); } Log.Info(&quot;End AzureAdB2CIdentityProviderProcessor -> HandleOpenIdConnectRedirectToIdentityProvider&quot;, typeof(AzureAdB2CIdentityProviderProcessor)); return Task.FromResult(0); } private static void AddLanguageQueryString(RedirectToIdentityProviderNotification<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> notification) { Log.Info(&quot;Start AzureAdB2CIdentityProviderProcessor -> AddLanguageQueryString&quot;, typeof(AzureAdB2CIdentityProviderProcessor)); string portalUrlCookie = &quot;Project_portal&quot;; string langPrefCookieFormat = &quot;Project_{0}#lang&quot;; string language = string.Empty; if (notification.Request.Cookies[portalUrlCookie] != null) { string portalUrl = notification.Request.Cookies[portalUrlCookie]; int pos = portalUrl.LastIndexOf(&quot;/&quot;) + 1; string locale = portalUrl.Substring(pos, portalUrl.Length - pos); language = locale.Split('-')?[0]; } string refererUrl = notification.Request.Headers[&quot;referer&quot;]; string country = refererUrl.Split('/')[3]; string langPrefCookie = string.Format(langPrefCookieFormat, country); if (notification.Request.Cookies[langPrefCookie] != null) { string prefLang = notification.Request.Cookies[langPrefCookie].Split('-')[0]; if (!string.IsNullOrEmpty(prefLang)) { language = prefLang; } else { language = refererUrl.Split('/')[4].Split('-')[0]; } } if (!string.IsNullOrEmpty(language)) notification.ProtocolMessage.Parameters.Add(&quot;ui_locales&quot;, language); Log.Info(&quot;End AzureAdB2CIdentityProviderProcessor -> AddLanguageQueryString&quot;, typeof(AzureAdB2CIdentityProviderProcessor)); } private static Task HandleOpenIdConnectAuthenticationFailed(AuthenticationFailedNotification<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> context, OpenIdConnectSiteInfo site) { Log.Info(&quot;Start AzureAdB2CIdentityProviderProcessor -> HandleOpenIdConnectAuthenticationFailed&quot;, typeof(AzureAdB2CIdentityProviderProcessor)); 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()); } Log.Info(&quot;End AzureAdB2CIdentityProviderProcessor -> HandleOpenIdConnectAuthenticationFailed&quot;, typeof(AzureAdB2CIdentityProviderProcessor)); return Task.FromResult(0); } } } Update 1 In the logs I am getting below error - ERROR Unable to find &quot;idp&quot; claim in the identity. Make sure that &quot;Sitecore.Owin.Authentication.Services.SetIdpClaimTransform&quot; or analogue is used in claim transformations of all identity providers. Tried adding below transformation in config, but still no luck. <transformation name=&quot;Idp Claim&quot; type=&quot;Sitecore.Owin.Authentication.Services.SetIdpClaimTransform, Sitecore.Owin.Authentication&quot; />
I recently created a guide here: https://community.sitecore.com/community?id=community_blog&amp;sys_id=f1cc98af1b541590e55241dde54bcb0d that talks a little bit about the options that are available when migrating from XP to an XM+CDP/Personalize scenarios. It focuses on the products that would make sense depending on your scenario, which seems irrelevant to this discussion, but does have impact, since if you are moving to Personalize only, than the Batch API's mentioned here are not available for this product and honestly you'll need to look into if there is really data that's needed for your scenario. If however you are moving to Sitecore CDP (or a Smart Hub CDP solution with both Sitecore CDP and Sitecore Personalize) there are a couple of options available to migrate data. However none of these options are perfect, because each of these have limitations: Using the Batch APIs Limited Data: Currently Batch APIs only support importing Guests and their data. Sessions or Interactions are not supported in Batch API's, however there could be options to roll some of this data into a guest data extension if you proceed with this option. Also it's important to call out that the procedure of moving this data is an extensive process. It may be wise to consider what data makes the most sense to move into the product. Example, instead of all anonymous and known users that have ever visited your web properties, maybe instead zero-in on Known contacts only. Documentation about the Batch APIs: https://doc.sitecore.com/cdp/en/developers/sitecore-customer-data-platform--data-model-2-1/using-the-sitecore-cdp-batch-api.html Import Using Stream APIs Probably the least useful option in this set, just because stream APIs can only ingest real time data, so even though you can import interactions/sessions for Stream data, it'll all appear as if it came in, when you run the requests. Pull in data directly into your Decision Model via a Connection I proposed in the article that you could use xConnect here, but as I'm writing this, I'm realizing that you could export this data into a Data Lake or Data Warehouse and built a mechanism to query the data from the Decision Model. All of this being theoretical of course :-). When using connections in a Decision Model, it's vital that this data runs in less than 250 ms, so if this option is used, you'll want to make sure that whatever you are pulling in, keeps this in mind. Also if you go with a direct xConnect option here, you may also run into licensing challenges with the need to run xConnect and therefore XP simultaneously with Sitecore CDP. In a lot of use cases, it may actually make more sense to utilize the power of CDP/Personalize and purchase the product before you start to transition from Sitecore XP, and start tracking events and other actions simultaneously as you begin your migration to a Composable model. So that, once you begin to turn off XP (xDb) and migrate to XM, you have your Experiences/Experiments created within the product and all of the data available within the product to begin taking action on the data collected in your CDP product. Documentation on Integrating CDP: https://doc.sitecore.com/cdp/en/developers/sitecore-customer-data-platform--data-model-2-1/integrating-sitecore-cdp-using-javascript.html Developer Portal Integration Guides: https://developers.sitecore.com/learn/integrations/xm-smarthub-cdp
How to move contact and traffic data from xDB to CDP How do we move current xDB data (contacts, traffic etc) to the Sitecore CDP. I know there is no straightforward tool but are there APIs I can use to accomplish it and keep all or most of the data from xDB?
What happened to Sitecore Marketplace contribution? The Sitecore Marketplace contributions needed to be retired for technical reasons and has not been replaced by Sitecore with an alternative at the time of this answer. The Marketplace site is still online to allow people to find previously contributed modules. We do want to solve for this problem going forward, possibly as part of the new Developer Portal (https://developers.sitecore.com) project. What will be the alternative for that? GitHub? We have been recommending GitHub as a great place to host your modules, and many other community members are already doing this. A lot of community members will have an associated blog article posted somewhere to explain/advertise the module. Make sure your README in your GitHub repo has the information needed for search engines to surface your module to people looking for it! How long the Sitecore Marketplace website will be available with all the contributed modules? Sitecore hasn't made a decision yet to retire this site. At this moment, our team is hoping to keep this running as is until an alternative is available.
How to contribute on Sitecore Marketplace now? What happened to Sitecore Marketplace contribution? https://marketplace.sitecore.net/Contribute.aspx What will be the alternative for that? GitHub? How long the Sitecore Marketplace website will be available with all the contributed modules?
This seems like a bug to me where in the existing Social Media Buttons template there is no field for Title. But you can simply create a new template inheriting /sitecore/templates/Feature/Experience Accelerator/Social/Settings/Social Media Buttons and can add a new field for Title. After that, create a new item under /sitecore/content/HBCS/IntranetHub/Settings/Social Media Groups based on the new template and create social media items under this folder. Now if you'll use this Social media share component on expedience editor, you'll see and edit the title.
SXA OOTB Social Share Heading Tag I am using SXA 9.3 with my Sitecore 9.3 instance. For the Social Share component, there is a model property HeadingTag in the view file(snapshot attached below) for which there is no field shown in the Social Media templates. On dev tool inspection, it is clearly visible that there is a tag but not sure how and where to add the value as there is no field. Does anyone have any idea about this?
In the page https://partners.sitecore.com/s/program-requirements you find the requirements: Once, you meet the criteria, you have to apply for the each one of it by submitting the forms in the links in this same page.
How to become Sitecore Silver/Gold partner I am not sure is the right platform for this question or not but I am curious to know about the answer to this question so posting here. If any Company/Organization wants to be a Sitecore Silver/Gold Partner then What is the process to become a Sitecore Silver/Gold partner? I have some other questions as well regarding the same, I am writing down below: Should they have MVP developers? Any specific criteria company should match like delivered a number of projects successfully in Sitecore, must be MVP, etc. Does the individual developer/contributor can also apply for the partnership or only be a registered organization can apply?
After trying to debug, I got it working. Ensure your PowerShell is having all the modules required to work. in my case when I pasted the code &quot;Get-Module -ListAvailable -Name PackageManagement it only showed me C:\Program Files (x86)\WindowsPowerShell\Modules directory with 2 versions. but when you are running the SIA exe, it will try to look for Powershell in C:\Users\<UserName>\Documents\WindowsPowerShell directory. Solution: All I did is copied the Configuration and Modules folder and pasted into this path. I think we need to add the PowerShell path to Environment Variable Path. the only error you might get after that is version Upgradation. which can be easily achieved. I hope this helps others.
Installation Sitecore 10.1.1 SIA error I am trying to Install Sitecore 10.1.1, while on first step, in prerequisite installation, I am getting below error: The term Get-PackageProvider 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. The term Install-PackageProvider 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. The term Install-Module 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. The term Get-PSRepository 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. The term Register-PSRepository 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. The specified module SitecoreInstallFramework with version 2.3.0 was not loaded because no valid module file was found in any module directory. can any one help ?
The issue turned out to be this code that was present in one of my performance config patches: <pipelines> <getTranslation> <patch:delete/> </getTranslation> </pipelines> Any time Translate.Text() was called, it would permanently delete the dictionary.dat file until the dictionary got published again.
dictionary.dat file keeps getting deleted when browsing site Whenever I publish my dictionary items, I see the dictionary.dat file getting created. However, whenever I browse the site, the file gets deleted. I can see that happen in real time. What might be some good things to check / try?
Have you bootstrap commerce engine after changing SQL connection setting in Plugin.SQL.PolicySet-1.0.0.json file? if not, then please do it and also do iisreset or apppool recycle of commerce engine after that.
Sitecore commerce 10 visual studio setup issue I tried to setup the development environment for Sitecore Commerce 10 with visual studio. I can able to run Customer.sample.solution without any build error but while trying to navigate to the Business tool it shows below error message in the log file. ERROR SQL.GetEntities.Fail: Id='List-CONTENTPATHS-ByDate'|Environment='Entity-CommerceEnvironment-HabitatAuthoring'|Message='Login failed for user 'xxx/yyy'.'|Number='18456'|Procedure=''|Line='65536'|Number='18456' ERROR CtxMsg.Error.SqlException: Text=SQL:block:findentitiesinlist.Exception: Login failed for user 'xxx/yyy'. ERROR Pipeline completed with errorSystem.ObjectDisposedException: Cannot access a disposed object. Object name: 'IServiceProvider'. at Microsoft.Extensions.DependencyInjection.ServiceLookup.ThrowHelper.ThrowObjectDisposedException() at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType) at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetServiceOrCreateInstance[T](IServiceProvider provider) at Sitecore.Framework.Pipelines.Definitions.AddPipelineBlockDefinition`1.Build(IServiceProvider services) at Sitecore.Framework.Pipelines.DefaultPipelineBlockRunner.RunAsync[TOutput](String name, Object input, IPipelineExecutionContext context) ERROR SitecoreConnectionManager.Error: Message=The operation was canceled.|Trace= at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithNtConnectionAuthAsync(HttpConnection connection, HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Net.Http.DiagnosticsHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts) at Sitecore.Commerce.Plugin.Management.SitecoreConnectionManager.ProcessRequestAsync(CommerceContext commerceContext, String action, String method, ItemModel itemModel) and in browser console Steps that I followed: I did changes in sitecorebizfx config.json for both (EngineUri and bizfxuri). I updated AllowedOrigins of wwwroot/config.json and launchsettings.json(&quot;COMMERCEENGINE_AppSettings__AllowedOrigins&quot;). I have updated the SQL database username, password, servername in Global.json, launchsettings.json, Plugin.SQL.PolicySet-1.0.0.json file. I have added the localhost URL in Sitecore.Commerce.IdentityServer.Host.xml file. I have changed the shopServiceUrl and commerceOpsServiceurl in Sitecore.Commerce.Engine.Connect.config file. Finally stopped the CommerceAuthoring site, restarted the IIS and clear the browser cache. so can anyone help me to resolve this issue?
On Settings item, you need to make sure that The field App Name has the proper application name which is your JSS App name. The field Filesystem path has the proper path to your JSS App. For example, /dist/app. The field Server side rendering engine should be NodeJs. Moreover, make sure that your JSS App files have been deployed to your Sitecore instance root directory.
Moving JSS App to JSS-SXA Site I have implemented Jss App in sitecore 10 instance, and now I need to move the the jss app to jss-sxa site to have the sxa structure, so what I do I have moved my items to the jss-sxa site as below and i have disabled the app config this one and I have added the site settings here but when try to open in page under the moved site it gives me 404 error with this message &quot;Node render engine project directory does not exist. Ensure your JavaScript code has been deployed and that the configured path is correct.&quot; any ideas, what is missing??, why this error happen even i have the dist folder in my instance root??
Based on my review of the decompiled Sitecore.Services.GraphQL.EdgeSchema.Services.SearchService class (which is the service used by the Sitecore.Services.GraphQL.EdgeSchema.Queries.SearchQuery query which responds to search queries in GraphQL), it appears that you can use any field that is present in your Solr index, but a handful of standard fields get some special treatment. The Solution If you look in the Solr index (e.g. sitecore_master_index) you will see that the field containing the templates list is called _templates. The below query returns all items with a passed-in template: { # 3BD4AD928374500C836811A4F049ED22 = ContentBlock template ID search(where: {name: &quot;_templates&quot;, value: &quot;3BD4AD928374500C836811A4F049ED22&quot;, operator: EQ}) { total results { id name path hasChildren } } } More Info Special field handling There a handful of standard fields that support a short-hand syntax, allowing you to use a default search operator and not have to pass one in. Here's the list from the SearchService constructor: private Dictionary<string, ItemSearchOperator> supportedFields; public SearchService(IOperationHandlerFactory operationHandlerFactory, IPaginationService paginationService) { supportedFields = new Dictionary<string, ItemSearchOperator>(); supportedFields.Add(&quot;_name&quot;, ItemSearchOperator.EQ); supportedFields.Add(&quot;_language&quot;, ItemSearchOperator.EQ); supportedFields.Add(&quot;_path&quot;, ItemSearchOperator.CONTAINS); supportedFields.Add(&quot;_templates&quot;, ItemSearchOperator.CONTAINS); supportedFields.Add(&quot;_hasLayout&quot;, ItemSearchOperator.EQ); supportedFields.Add(&quot;_parent&quot;, ItemSearchOperator.EQ); _operationHandlerFactory = operationHandlerFactory; _paginationService = paginationService; } Therefore, you can simplify the above query by removing the operator: EQ section, if you wish. Other fields You can also use your own fields to search against, like so: { # 3BD4AD928374500C836811A4F049ED22 = ContentBlock template ID search( where: { name: &quot;_templates&quot; value: &quot;3BD4AD928374500C836811A4F049ED22&quot; AND: { name: &quot;heading&quot;, value: &quot;&quot;, operator: NEQ } } ) { total results { id name path hasChildren fields { name value } } } } Or, you can search against any other standard field in the Solr index (just make sure you include the operator property): { search( where: { name: &quot;_displayname&quot; value: &quot;content&quot; operator: CONTAINS } ) { total results { id name path hasChildren fields { name value } } } }
What built-in/standard fields are available on the `search` GraphQL query? I am trying to build a query that returns all items of a specific template, but can't seem to figure out if there's a &quot;template&quot; field available on the search query for GraphQL. Where can I find a list of available fields for the GraphQL search query? Here's what I tried: { # 3BD4AD928374500C836811A4F049ED22 = ContentBlock template ID search(where: {name: &quot;template&quot;, value: &quot;3BD4AD928374500C836811A4F049ED22&quot;}) { total results { id name path hasChildren } } } I also tried templatename, templateid, templates, __templates, and all the other options I could think of. They all return the following results: { &quot;data&quot;: { &quot;search&quot;: { &quot;total&quot;: 0, &quot;results&quot;: [] } } } Environment details jss --version: 18.0.0 Using the edge GraphQL endpoint, which uses the edgeContent schema configuration
The Next.js SDK depends on GraphQL APIs introduced in Headless Services 16.0, which is only supported on Sitecore 10.1. Thus you must upgrade to Sitecore 10.1 to use Next.js with Sitecore XM/XP.
JSS 16/18 for Sitecore 10 According to Sitecore JSS documentation, JSS 16 and 18 are only supported by Sitecore 10.1+. As Next.JS is only supported by JSS 16+, is there any way to make JSS 16 work on Sitecore 10.0 or only Next.JS to work in Sitecore 10.0?
I see two options here that might help you: You can set &quot;WebEdit.EnableJSBundling&quot; to &quot;false&quot;, as a result, you will see much more JS files in Network -> JS, but it might affect page load in Experience Editor, so it is better to use on local or test environments You can use debbuger; instead of the breakpoint on your local environments
How to debug bundled JavaScript files of Experience Editor? I'm doing changes in Experience Editor JavaScript command file of ribbon button, but I'm not able to find this file in browser (Chrome Dev Tools > Network > JS), so how I can find my file and how I can debug JavaScript files here?
Publish and unpublish automatically, is OOTB in Sitecore, in which you need to set interval in below config: <agent type=&quot;Sitecore.Tasks.PublishAgent&quot; method=&quot;Run&quot; interval=&quot;00:05:00&quot;> <param desc=&quot;source database&quot;>master</param> <param desc=&quot;target database&quot;>web</param> <param desc=&quot;mode (full or smart or incremental)&quot;>incremental</param> <param desc=&quot;languages&quot;>en, da</param> </agent> and need to set publish/unpublish date and time. Note: Publish/Unpublish will not happen on exact time as it check on particular interval, not on exact time
Sitecore Publish/Unpublish automatically I am using Sitecore 9.1 and I set future publish/unpublish dates for some of the items. I found two articles to do this: This article talks about 1. Download the AUTOMATED PUBLISHER module from the Sitecore Marketplace. 2. Have your Sitecore implementers write your own custom code that is triggered by a Sitecore Task. https://www.techguilds.com/Blog/2018/11/scheduled-and-advanced-publishing-with-sitecore-part-2 and This article, which advises to do it by patching values in the config file: <agent type=&quot;Sitecore.Tasks.PublishAgent&quot; method=&quot;Run&quot; interval=&quot;00:00:00&quot;> <param desc=&quot;source database&quot;>master</param> <param desc=&quot;target database&quot;>web</param> <param desc=&quot;mode (full or smart or incremental)&quot;>incremental</param> <param desc=&quot;languages&quot;>en, da</param> </agent> https://community.sitecore.net/developers/f/8/t/5496 Is auto-publishing built OOB in any version (in my case 9.1) ? If not, which of the above would be the preferred way to do this?
The suggestions mentioned in the comment didn't work for us. So, instead of defining username in UserBuilder, we added a method with below code that is getting called from our Login Action - string userName = $&quot;{Context.Domain.Name}\\{userId}&quot;; Sitecore.Security.Accounts.User virtualUser = AuthenticationManager.BuildVirtualUser(userName, true); virtualUser.SetRoles(user, account, _currentPortalId); AuthenticationManager.Login(virtualUser); This code runs without any errors and we are able to get required username in Context.User.
CustomExternalUserBuilder not getting called sitecore 9.3 We have added identity provider for Azure B2C for login into sitecore websites. We need to change the username of virtual user that is created by sitecore after authentication. For that, below code is added and an entry is made to the config file but the code is not getting called. Please let me know what else we need to add? Thank you in advance. public class CustomExternalUserBuilder : ExternalUserBuilder { private readonly IHashEncryption _hashEncryption; public CustomExternalUserBuilder( ApplicationUserFactory applicationUserFactory, IHashEncryption hashEncryption) { Assert.ArgumentNotNull((object)applicationUserFactory, nameof(applicationUserFactory)); Assert.ArgumentNotNull((object)hashEncryption, nameof(hashEncryption)); this._hashEncryption = hashEncryption; this.ApplicationUserFactory = applicationUserFactory; } public bool IsPersistentUser { get; set; } protected ApplicationUserFactory ApplicationUserFactory { get; } public override ApplicationUser BuildUser( UserManager<ApplicationUser> userManager, ExternalLoginInfo externalLoginInfo) { ApplicationUser user = this.ApplicationUserFactory.CreateUser(this.CreateUniqueUserName(userManager, externalLoginInfo)); user.IsVirtual = !this.IsPersistentUser; user.Email = externalLoginInfo.Email; return user; } protected virtual string CreateUniqueUserName( UserManager<ApplicationUser> userManager, ExternalLoginInfo externalLoginInfo) { Assert.ArgumentNotNull((object)userManager, nameof(userManager)); Assert.ArgumentNotNull((object)externalLoginInfo, nameof(externalLoginInfo)); var identityProvider = this.FederatedAuthenticationConfiguration.GetIdentityProvider(externalLoginInfo.ExternalIdentity) ?? throw new InvalidOperationException(&quot;Unable to retrieve an identity provider for the given identity&quot;); string domain = (identityProvider).Domain; string accountName = externalLoginInfo.ExternalIdentity?.FindFirst(&quot;AccountName&quot;)?.Value; string userName = $&quot;{domain}\\{accountName}&quot;; return userName; } } Config - <configuration> <sitecore> <federatedAuthentication> <identityProvidersPerSites> <mapEntry name=&quot;portal&quot; type=&quot;Sitecore.Owin.Authentication.Collections.IdentityProvidersPerSitesMapEntry, Sitecore.Owin.Authentication&quot; resolve=&quot;true&quot;> <sites hint=&quot;list&quot;> <site>portal</site> </sites> <identityProviders hint=&quot;list:AddIdentityProvider&quot;> <identityProvider ref=&quot;federatedAuthentication/identityProviders/identityProvider[@id='AzureAdB2C']&quot;/> </identityProviders> <externalUserBuilder type=&quot;Portal.SC.Feature.Login.Pipelines.Owin.CustomExternalUserBuilder, Portal.SC.Feature.Login&quot; resolve=&quot;true&quot;> <param desc=&quot;isPersistentUser&quot;>false</param> </externalUserBuilder> </mapEntry> </identityProvidersPerSites> </federatedAuthentication> </sitecore> </configuration>
ExperienceEditor.Dialogs.prompt usually used for this, here an example below for Experience Editor ribbon button: define([&quot;sitecore&quot;, &quot;/-/speak/v1/ExperienceEditor/ExperienceEditor.js&quot;], function (Sitecore, ExperienceEditor) { Sitecore.Commands.MyCommand = { canExecute: function(context) { return true; }, execute: function (context) { ExperienceEditor.Dialogs.prompt(&quot;Enter a value:&quot;, &quot;Default value&quot;, function (newValue) { ExperienceEditor.Dialogs.alert(newValue); }); } }; });
Prompt SPEAK dialog in Experience Editor? Is it possible to use Sitecore specific prompt dialog in Experience Editor, like this below? If so, can somebody provide an example, please?
You have two ways to achieve this: Option 1. Create a custom facet to store newsletter consent for the contact and save its value (true/false) on the click of Subscribe button, the same way you're doing to set email facet value. After values are stored in XDB, you can call this custom facet in experience profile code and store its value in DataTable. Option 2. If you don't want to create a custom facet to store consent, you can use the validated attribute of EmailAddress Facet. So while saving the value of EmailAdress on click of subscribe button, you can set the validated as true. emailFacet = new EmailAddressList(new EmailAddress(email, true), &quot;Preferred&quot;); Now, you can fetch the value of this attribute in the custom profile tab. PS. I would recommend using the EPExpressTab module to create a custom tab in the Sitecore Experience Profile. Using this you can easily load your facet values and manipulate the logic as you want. You can refer to this post to see how to implement a custom tab in Sitecore Experience Profile.
Set the value of custom Xdb field on custom Sitecore 9 form custom button click I have created a Sitecore 9 form with a custom button as shown below: On click of this &quot;Subscribe&quot; button I am saving the email of the contact in Xdb (Experience profile). Also, I have created a custom tab (&quot;Consent&quot;) and field (&quot;Newsletter Consent&quot;) in Experience profile which will be visible to all users with the help of the following post https://community.sitecore.net/technical_blogs/b/getting_to_know_sitecore/posts/using-custom-contact-data-part-1-experience-profile : Now my question is, how do I add the value to this custom field. For now, all those users who enter their email and click subscribe, this &quot;Newsletter consent&quot; value should be true and should be visible against it's label in experience profile. I am unable to set it's value like I have done for email on custom button click. private static void SetEmail(string email, Contact contact, IXdbContext client) { if (string.IsNullOrEmpty(email)) { return; } EmailAddressList emailFacet = contact.Emails(); if (emailFacet == null) { emailFacet = new EmailAddressList(new EmailAddress(email, false), &quot;Preferred&quot;); } else { if (emailFacet.PreferredEmail?.SmtpAddress == email) { return; } emailFacet.PreferredEmail = new EmailAddress(email, false); } client.SetEmails(contact, emailFacet); } Any help would be highly appreciated :).
You can find the Slack chat details here: https://sitecore.chat/ You can sign up using this form: https://docs.google.com/forms/d/1bAVDgP5-FhFh8ohPchHtifq-rz7EBkuPojAzdEofJyo/viewform Slack is more for chat and it does not have a history, so your questions and the answers will disappear. Everything what is a concrete issue should be asked on Stack Exchange so the answer can be found forever.
Sitecore Slack or Stack Exchange? Is it still possible to join Sitecore Slack (http://sitecorechat.slack.com/)? How can I do this? Can somebody please shed the light on what I should ask in Slack and what is better to ask in Stack Exchange and vice versa?
I experienced the same issue, after some investigation, I found this setting below in \App_Config\Sitecore\JavaScriptServices\Sitecore.JavaScriptServices.ViewEngine.Http.config <settings> <setting name=&quot;JavaScriptServices.ViewEngine.Http.JssEditingSecret&quot; value=&quot;$(env:SITECORE_JSS_EDITING_SECRET)&quot; /> </settings> So, you can define environment variable, or override/overwrite manually like here below: <settings> <setting name=&quot;JavaScriptServices.ViewEngine.Http.JssEditingSecret&quot; value=&quot;mysecretkey&quot; /> </settings> This solved my issue.
Connection to your rendering host failed with a Not Found error. Ensure the POST endpoint has been enabled I am working with Sitecore 10.1 and sitecore-jss 18.0. I am getting the error - Connection to your rendering host failed with a Not Found error. Ensure the POST endpoint at URL http://localhost:3000/api/editing/render has been enabled. I have already verified the JSS editing secret in client and server side configuration. I also went through below solutions: https://blog.vitaliitylyk.com/jss-rendering-host/ https://programmer-swift.medium.com/sitecore-10-1-jss-next-troubleshooting-2b5dec34bbac But as of now, it's not working. Did anyone face a similar issue? Any possible solution. Thanks a lot.
Assuming you have a certificate in pfx format and you know its password (if the certificate is password protected), you can install it in the image of your container when you build it, copying the certificate in the image (with its password) and installing it with the Import-PfxCertificate powershell command. You can do this in the dockerfile build specs of your image, adding the following commands: # Steps to copy certificate pfx file and its password in image COPY .\cert.pfx C:\cert.pfx COPY .\cert.password.txt C:\cert.password.txt ... # Step to import Pfx certificate in local machine root certificate store RUN $password = (Get-Content -Path C:\cert.password.txt) | ConvertTo-SecureString -AsPlainText -Force; ` $cert = Import-PfxCertificate -Password $password -CertStoreLocation Cert:\LocalMachine\root -FilePath C:\cert.pfx Paths in the example above might differ in your host build instance. UPDATE (based on additional details shared in comments): Like Mark wrote in his comment, Identity Server allows to use a certificate stored in an environment variable, instead of being stored in storage or in a file (see the \sitecore\Sitecore.Plugin.IdentityServer\Config\identityServer.xml configuration file of an Identity Server instance to see the different available configuration options). If your solution doesn't support these alternative certificate storage solutions and you have different certificates per environments, you could execute the Import-PfxCertificate command in your container at runtime, extending the entrypoint script of your image (or creating one if the image doesn't have an entrypoint yet). You could use the same approach of providing the certificate raw data and password using environment variables. You will need to write the certificate raw data in a pfx file in the container, since the Import-PfxCertificate command takes the path of the certificate file as input parameter only. This is an example of code to add to an entrypoint script that would take care of writing a certificate in the file system from an environment variable and installing it: ... &quot;${env:CUSTOM_CERT_PFX_DATA}&quot; | Out-File C:\cert.pfx -Force $password = &quot;{env:CUSTOM_CERT_PFX_PASSWORD}&quot; | ConvertTo-SecureString -AsPlainText -Force $cert = Import-PfxCertificate -Password $password -CertStoreLocation Cert:\LocalMachine\root -FilePath C:\cert.pfx ... Where CUSTOM_CERT_PFX_DATA would be an environment variable to provide the pfx certificate data and CUSTOM_CERT_PFX_PASSWORD would be an environment variable to provide its password.
Install certificate to store on container I'm working on migrating my existing Sitecore 10.1.1 site into containers. My code requires a cert to be available in the local certificate store on the container. It seems like the Sitecore ID container is already doing this. I tried to figure out how this certificate gets into the store so I can use same approach. Does anyone know how this gets into the certificate store on container?
It turned out another project was loading in a newer version of this version System.IdentityModel.Tokens.Jwt, Version=5.2.1.0 and this was conflicting with the one used by Sitecore 8.2. ( 4.0.20622.1351 )
Trying to use the Sitecore ItemService in our UITests but receiving a 500 error with the following log As the title says, our project contains a a UITesting project that uses the ItemService to login and do perform actions such as create an item, check if an item exist, etc. However for one of our Sitecore projects it's not working and when looking at logs I've noticed the following: Exception: Sitecore.Mvc.Diagnostics.ControllerCreationException Message: Could not create controller: 'ServicesAuthentication'. Source: Sitecore.Mvc at Sitecore.Mvc.Controllers.SitecoreControllerFactory.CreateController(RequestContext requestContext, String controllerName) at System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController&amp; controller, IControllerFactory&amp; factory) at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) Nested Exception Exception: System.InvalidOperationException Message: An error occurred when trying to create a controller of type 'Sitecore.Services.Infrastructure.Sitecore.Mvc.ServicesAuthenticationController'. Make sure that the controller has a parameterless public constructor. Source: System.Web.Mvc at System.Web.Mvc.DefaultControllerFactory.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) at System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) at Sitecore.Mvc.Controllers.SitecoreControllerFactory.CreateController(RequestContext requestContext, String controllerName) Nested Exception Exception: System.Reflection.TargetInvocationException Message: Exception has been thrown by the target of an invocation. Source: mscorlib at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean&amp; canBeCached, RuntimeMethodHandleInternal&amp; ctor, Boolean&amp; bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark&amp; stackMark) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Activator.CreateInstance(Type type) at System.Web.Mvc.DefaultControllerFactory.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) Nested Exception Exception: System.TypeLoadException Message: Could not load type 'System.IdentityModel.Tokens.JwtSecurityTokenHandler' from assembly 'System.IdentityModel.Tokens.Jwt, Version=5.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Source: Sitecore.Services.Infrastructure.Sitecore at Sitecore.Services.Infrastructure.Sitecore.Security.SigningTokenProvider..ctor(UserService userService, ConfigurationSettings configurationSettings, ILogger logger, ISigningProvider signingProvider) at Sitecore.Services.Infrastructure.Sitecore.Security.SigningTokenProvider..ctor() at Sitecore.Services.Infrastructure.Sitecore.Mvc.ServicesAuthenticationController..ctor() We are running Sitecore.NET 8.2 (rev. 161221). According to the documentation as far as I understand it, we should be able to use this API. My question, do I have to use a different JwtSecurityTokenHandler and if so, how do I do this? Or is there another solution to this problem?
We have done this using PageEvents by passing the search query as parameter. Here is the code that works and registers the search events public static bool TriggerSearchEventByQuery(string query) { if (!Tracker.IsActive) { Tracker.StartTracking(); } if (!Tracker.IsActive || Tracker.Current.CurrentPage == null) { Sitecore.Diagnostics.Log.Warn($&quot;Tracker current page is null&quot;, &quot;xDBHelper&quot;); return false; } try { var searchEvent = Tracker.MarketingDefinitions.PageEvents[AnalyticsIds.SearchEvent.Guid]; if (searchEvent == null) { Sitecore.Diagnostics.Log.Warn($&quot;Search event not found&quot;, &quot;xDBHelper&quot;); return false; } Tracker.Current.CurrentPage.Register(new PageEventData(searchEvent.Alias, searchEvent.Id) { Data = query }); return true; } catch (Exception ex) { Sitecore.Diagnostics.Log.Warn($&quot;Failed to trigger search event: {ex}&quot;, &quot;xDBHelper&quot;); } return false; } Hope this helps!
Popular search keywords not being tracked I am using Sitecore 9.3 and trying to track and display the popular search terms used on the website. However, I am not seeing the search keywords being tracked as intended in Internal search dashboard. Any ideas on what I am missing here? public static void TrackSearch(string searchTerm) { if (Tracker.Current != null &amp;&amp; Tracker.Current.IsActive) { var pageEventData = new PageEventData(&quot;Search&quot;, new Guid(Constants.Items.SystemSearchEvent)) { ItemId = new Guid(Constants.Items.Search), Data = searchTerm, DataKey = searchTerm, Text = searchTerm }; var interaction = Tracker.Current.Session.Interaction; if (interaction != null) { interaction.CurrentPage.Register(pageEventData); } } } Constants.Items.SystemSearchEvent is the guid corresponding to /sitecore/system/Settings/Analytics/Page Events/Search I am not seeing anything getting tracked here, even though the above code is getting executed successfully, and there are no errors in the logs file. I am trying to use the following code to fetch the tracked searches, but it is not returning anything, since nothing seems to be getting tracked: public static List<string> GetTopSearchQueries() { try { var reportingService = ApiContainer.Repositories.GetReportingService(); var reportQuery = GetReportQuery(); ReportResponse reportResponse = reportingService.RunQuery(reportQuery); var encoder = ApiContainer.GetReportResponseEncoder(); var result = encoder.Encode(reportResponse); if (result != null &amp;&amp; result.Data != null &amp;&amp; result.Data.Localization != null &amp;&amp; result.Data.Localization.Fields != null &amp;&amp; result.Data.Localization.Fields.Any()) { var searchFields = result.Data.Localization.Fields.FirstOrDefault(); if (searchFields != null) { return result.Data.Localization.Fields.FirstOrDefault() ?.Translations.Select(r => r.Value).ToList(); } } } catch (Exception ex) { Log.Info(ex.Message, ex); } return new List<string>(); }
Sitecore Client Account Managing is the right role to add/remove users. From Sitecore Documentation : Gives the user access to maintain users, roles, and domains in the Access Manager, the Domain Manager, the Role Manager, and the User Manager. https://doc.sitecore.com/en/developers/90/platform-administration-and-architecture/the-security-roles.html To view the members of this Role open Sitecore Client Account Managing role in user manager and click Members:
How do I find out which users have permissions to add/remove other users? From what I understand, There are 3 base roles which can do this: Sitecore Local Administrators Sitecore Client Securing Sitecore Client Account Managing So I suppose if I want to get the roles which inherit from these base roles I'll do a query to my database consisting partly of this: After to find out which users have this I'll do another query on the Users Database to find out which users have these rights. ANYWAYS, I suppose the question is really then which base roles have permissions to add/remove other users from sitecore?
The skin text is missing for the custom created App route and the error occurs only for few users. If we add the text field value as &quot;skin&quot; shown below. The error will be resolved.
Could not find file application skin file error in Sitecore Jss 10.1 For few users in Sitecore CM server while they are trying to access the content tree items, getting below attached error:
The first thing is you can now use the loading attribute to lazy-load images without the need to write custom lazy-loading code or use a separate JavaScript library. eg, <img loading=lazy> https://web.dev/browser-level-image-lazy-loading/ Now to render an image using Glass Mapper you should use RenderImage @Html.Glass().RenderImage(Model.LandingPage, x => x.Background_Image, new { MaxWidth = 1500, loading = &quot;Lazy&quot; }, isEditable: true) Or if want to use Editable @Html.Glass().Editable(Model.LandingPage, x => x.Background_Image, new { MaxWidth = 1500, loading= &quot;lazy&quot; }) Still, if you want to use class parameter on image tag for lazy loading: @Html.Glass().Editable(Model.LandingPage, x => x.Background_Image, new { MaxWidth = 1500, class = &quot;lazy&quot; })
Issue in applying lazyload for images in @Editable A Glassmapper is used in our running project and planning to apply lazy loading for all images. For this, I have to implement the renderField Pipeline to apply lazyload functionality to all images. It is working fine with the default Sitecore field @Html.Sitecore().Field(LandingPage.FieldIds.BackgroundImage.ToString(), Model.LandingPage.Item, new { MaxWidth = 1500 }) We are trying to apply lazyloading with Glassmapper. so we have written the below code. @Html.Glass().Editable(Model.LandingPage, x => x.Background_Image, new { MaxWidth = 1500 }) The above code is working fine in the Experience editor but not working on actual normal page. How we can apply lazyloading with Glassmapper @Html.Glass().Editable() for image field? Or is there any way to render renderfield pipeline for the image field forcefully? current output with glass().Editable(): <img src=&quot;/-/media/images/instron/landing-page-images/mastheads/products/webmasthead_testingsystems_2020.jpg?h=382&amp;amp;w=1500&amp;amp;la=en-IN&amp;amp;hash=89A18D0E8314CC8697DCA3BC8C93BDB7&quot; maxwidth=&quot;1500&quot; alt=&quot;demo&quot;> Expected output with glass().Editable(): <img src=&quot;data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==&quot; alt=&quot;demo&quot; width=&quot;1500&quot; height=&quot;382&quot; maxwidth=&quot;1500&quot; data-src=&quot;/-/media/images/instron/landing-page-images/mastheads/products/webmasthead_testingsystems_2020.jpg?h=382&amp;amp;iar=0&amp;amp;w=1500&amp;amp;hash=0A90A8CF5873BDA7CBFA8507EDF073C6&quot; class=&quot;lazy&quot;> Thanks
In this case, we should aliases text to children at the same level and this applies to all the fields, items. Here in this example SocialIcon and MenuList as aliases. { SocialIcon: children(includeTemplateIDs: [&quot;{GUID}&quot;]) { ... on Icon { name image { alt src } linkUrl { anchor linkType target url className } } } MenuList: children(includeTemplateIDs: [&quot;{GUID}&quot;]) { ... on Menu { name linkUrl { anchor linkType target url className } } } }
Fields "children" conflict because they have different arguments When trying to access the children of the different templates at the same level. We will be getting this error Fields &quot;children&quot; conflict because they have different arguments. Use different aliases on the fields to fetch both if this was intentional. Query=> children(includeTemplateIDs: [&quot;{GUID}&quot;]) { ... on Icon { name image { alt src } linkUrl { anchor linkType target url className } } } children(includeTemplateIDs: [&quot;{GUID}&quot;]) { ... on Menu { name linkUrl { anchor linkType target url className } } } }
If you are importing from the web database or a publishing target, it is by default trying to import to the same publishing target database i.e. web. Try the &quot;transfer&quot; command from the &quot;Copy To&quot; options instead.
Missing items from Sitecore, but when I try and import them via a package, wizard reports the item already exists I'm trying to track down some content items that appear to have gone missing from a client's Master database. Luckily they still exist in a different publishing target, so I created a package that contained them from there, and attempted to reinstall them in Master. However the wizard then warns me that the &quot;Item being installed already exists in database&quot;: However, the item doesn't exist under that path, and searching both the UI and the Item table in the database directly for that ID doesn't turn anything up. I've also checked the IDTable, Archive and ArchivedItem tables, but nothing. Where else can I look for these items?
We have used the following patch for the CM site to force login to Azure when they hit the CM backend and for admin path we force to identity server login. <configuration xmlns:patch=&quot;http://www.sitecore.net/xmlconfig/&quot; xmlns:set=&quot;http://www.sitecore.net/xmlconfig/set/&quot; xmlns:role=&quot;http://www.sitecore.net/xmlconfig/role/&quot; xmlns:security=&quot;http://www.sitecore.net/xmlconfig/security/&quot;> <sitecore role:require=&quot;ContentManagement&quot;> <sites> <!-- Force redirect to Azure login page --> <site name=&quot;shell&quot; set:loginPage=&quot;$(loginPath)shell/SitecoreIdentityServer/IdS4-AzureAd&quot; /> <!-- Force redirect to regular login page --> <site name=&quot;admin&quot; set:loginPage=&quot;$(loginPath)admin/SitecoreIdentityServer&quot; /> </sites> </sitecore> </configuration>
Federated authentication for external sites interfering login inside the cms I am using federated authentication to login/signup to the websites in multi sites architecture. No issues for the websites but for the cms when I open cmsurl.com/sitecore it takes to the website's login page I have created a patch config that has: pipeline processor, map entries for identityProvidersPerSites, and the designated identity provider for identityProviders. Wondering what can cause this? may be config patch order or something? Any insights or recommendations would be really helpful.
The root cause of this issue is using just a space character in the Windows service and path prefix field in the Install Solr search service installation step in SIA: You probably inserted a space to pass the validation on this section to enable the Install button, otherwise greyed out. The space is visible in the Solr service name in your error log as well. If you still want to use SIA to install Solr (instead of manually installing it with SIF), you can avoid this issue using a prefix value that is not a space. You can also edit the Solr.Service variable defined in the Solr-SingleDeveloper.json configuration file distributed with your installation, removing in its value definition the concatenation of prefix and the solr service name: &quot;Solr.Service&quot;: &quot;[concat(parameter('SolrServicePrefix'),variable('Solr.FileName'))]&quot; and instead using just the Solr.FileName variable: &quot;Solr.Service&quot;: &quot;[variable('Solr.FileName')]&quot;
Install Solr Search Service failed - Sitecore 10 I am installing Sitecore Experience Platform 10.1 Update-1 using a Graphical setup package for XP Single. After completion of pre-requisites when it install Solr Seach Service its failed and shows me the below message: I have checked the log and in the log, I found below entries: Can anyone please guide me what is the actual root cause behind this?
#1:href=&quot;~/link.aspx?_id=745F287C-B0F5-4C53-AE11-3890136019E3&amp;amp;_z=z&quot; #2:href=&quot;~/link.aspx?_id=C57C20CF-290B-4089-8A19-0969D42BD75D&amp;amp;_z=z#_ftn1&quot; Programmatic fix using sitecore powershell extensions: if ($_.Fields[&quot;Description&quot;] -match 'EditorPage.aspx?da=core&amp;amp;id=%7b[\w\d-]{36}%7d.*?&quot;' ){ $_.Fields[&quot;Description&quot;].Value = $_.Fields[&quot;Description&quot;].Value -replace '\b((http://[\w-.]*?.unwomen.org/sitecore/shell/Controls/Rich%20Text%20Editor/)|/)?EditorPage.aspx\?da=core&amp;amp;id=%7b([A-Z0-9\-]{36})[^#&quot;&quot;]*(#|&quot;)' , '~/link.aspx?_id=$3&amp;amp;_z=z$4' }
How to fix broken links in EditorPage.aspx url format Following are few broken link examples using EditorPage.aspx in Sitecore v8.2. How can an editor create such links and should those be transformed as mentioned in each example scenario. There are too many such links to fix and any ideas to programmatically fix them would be great. Please advice. Example 1(page): <p> <address><strong><a href=&quot;EditorPage.aspx?da=core&amp;amp;id=%7B745F287C-B0F5-4C53-AE11-3890136019E3%7D&amp;amp;ed=FIELD503494885&amp;amp;vs&amp;amp;la=es&amp;amp;fld=%7BA2697EB4-4868-471B-B969-7DC4CF9C29C0%7D&amp;amp;so=%2Fsitecore%2Fsystem%2FSettings%2FHtml%20Editor%20Profiles%2FRich%20Text%20UN%20Women&amp;amp;di=0&amp;amp;hdl=H503494925&amp;amp;mo&amp;amp;pe=0&amp;amp;fbd=1#&quot;></a></strong>Foto:&amp;nbsp;<em>Cinthia Sifa Mulanga, &quot;Self-sureness&quot;, 2021. T&amp;eacute;cnica mixta sobre lienzo tensado, 84cm x 118cm. </em></address> </p> ->Can this transformation be the fix in all possible querystring variations of EditorPage.aspx ?: &quot;~link.aspx?745F287C-B0F5-4C53-AE11-3890136019E3&amp;_z=z&quot; Example 2 (page): the Egyptian Government has ensured that 55.3% of measures in response to the pandemic are gender-sensitive.<a href=&quot;EditorPage.aspx?da=core&amp;amp;id=%7BC57C20CF-290B-4089-8A19-0969D42BD75D%7D&amp;amp;ed=FIELD1890614585&amp;amp;vs&amp;amp;la=en&amp;amp;fld=%7BA2697EB4-4868-471B-B969-7DC4CF9C29C0%7D&amp;amp;so=%2Fsitecore%2Fsystem%2FSettings%2FHtml%20Editor%20Profiles%2FRich%20Text%20UN%20Women&amp;amp;di=0&amp;amp;hdl=H1890614624&amp;amp;mo&amp;amp;pe=0&amp;amp;fbd=1#_ftn1&quot; name=&quot;_ftnref1&quot;><sup><span><sup><span>[1]</span></sup></span></sup></a> ->That superscript 1 in the link text, meant for footnote reference 1,has a completely different external website link in the page foot note references. and the id querystring value is pointing to the current page itself which tells me that intended link is not in the id querystring. So, 1st kind of url transformation doesn't sound right to be the broken link fix. Does other query string values help in finding the desired intention of the editors?
First of all, ensure that your goal is marked as a Goal, i.e. “Is Goal - indicates that the page event is a goal” checkbox in the Options section should be ticked off. In case of a multilingual setup check that your goal is created and deployed for all relevant language variants, otherwise, Sitecore will filter out the available goals based on the viewing language. This might explain why you don’t see your newly created goal in Experience Editor.
Goals are not showing in Experience Editor when setting up a Test in Sitecore 9.3 I have created a new Goal in Sitecore’s Marketing Control Panel to track a certain page visit and successfully deployed it. Now I want to use that goal to measure an experience effect for my AB Test, but for some reason it doesn’t appear in the &quot;Test Objective&quot; dropdown list. I have made sure that everything is published, indexes are up-to-date and marketing definitions are deployed. What else could be preventing a Goal from being available for a Test setup?
It turned out on of the config files had an unneccesary patch which we didn't need. <excludedAssemblies hint=&quot;list:AddExcludedAssembly&quot;> <excludedAssembly id=&quot;Sitecore.Services.Infrastructure.Sitecore&quot; patch:after=&quot;excludedAssembly[@id='RazorGenerator.Mvc']&quot;>Sitecore.Services.Infrastructure.Sitecore</excludedAssembly> </excludedAssemblies> After removing this AND obliberating the cache according to this post WebAPI Controllers not being found I was able to finally got it to work.
Sitecore (version 8.2) Itemservice returns a 404 NotFound As the title suggested, I'm getting a StatusCode NotFound (404). Everything as far as I know has been setup correctly. Been reading and following this to a T: https://doc.sitecore.com/en/developers/82/sitecore-experience-platform/sitecore-services-client.html I can authenticate but when I try to retrieve or post an item I get NotFound statuscode. Our solution has TDS and Glassmapper installed. I'm unaware of any issues caused by these but if anyone knows something please let me know. At first I'd figured there might be something wrong with routing but as I said before I'm able to login. Or is this setup in a different way?
Michael West's answer of using SPE Content Migrator in conjunction with SPE Remoting, instead of Sidekick's Content Migrator, worked a charm.
Trigger and monitor Content Migrator preset from SPE Does anyone know if there is a way of triggering Sitecore Sidekicks's Content Migrator from within Sitecore using SPE and monitor progress? Sidekick's Content Migrator scripting works for Powershell instances outside of Sitecore, which I could use with SPE remoting, but there is no way to monitor the progress of the migration. I'd like to be able to trigger a pre-defined content pull followed by an index rebuild, links database rebuild and a couple of custom scripts for shuffling some renderings around and finally a site republish. The reason for Content Migrator, and not some other form of content pull, is that there are about 150k items and Item Blaster seems to be the fastest way of getting them from one environment to the other.
1. Using PSCustomObject in array $list = [System.Collections.ArrayList]@() in for each loop assign value to info object and then add it to list $info = [PSCustomObject]@{ &quot;data1&quot;=&quot;test 1&quot; &quot;data2&quot; = &quot;test data 2&quot; } [void]$list.Add($info) then show it finally $list | Show-ListView 2. Using Class, example given below: class Topics { [string]$TopicId [string]$TopicPath [string]$TopicName } create its array object [Topics[]]$AllTopics = @() assign values to it $topicfolders|get-childitem |foreach-object{ $topic= [Topics]@{ TopicId = $_.Id TopicPath= $_.fullpath TopicName = $_.name } $AllTopics =[Array] $AllTopics + $topic } #then show $AllTopics 3. Directly assign value to psobject and show that $customItem = [pscustomobject]@{ &quot;ID&quot;=$Item.ID &quot;Icon&quot;=$Item.__Icon &quot;DisplayName&quot;=$Item.DisplayName &quot;ItemPath&quot;=$Item.ItemPath &quot;Version&quot;=$Item.Version &quot;Language&quot;=$Item.Language &quot;__Updated&quot;=$Item.__Updated &quot;__Updated by&quot;=$Item.&quot;__Updated by&quot; } $customItem | Show-ListView 4.using Expression of show-listview, either give your value in it or create a function and use that to get values.
How can we show value of a custom field inside Show-ListView We would like to show custom data such as custom string(&quot; Test Case 1&quot;,&quot;Test case 2&quot;). All these data do not inside any items in Sitecore. It is just a string in powershell script and would like to show in Show-ListView. We would like to add one column inside Show-ListView and show data under this column. Is this possible? Kindly assist someone on this.
Please use sc_mode=preview URL parameter: www.mysite.com?sc_mode=preview www.mysite.com?my_firstparam=1&amp;sc_mode=preview If you need to open a link in the tab then you need to use target=&quot;_blank&quot;: <a href=&quot;www.mysite.com?sc_mode=preview&quot; target=&quot;_blank&quot;>my site in preview mode</a> Or you can use Sitecore options if you're using link fields or RTE fields.
How to open Experience Editor with Preview mode in a new tab? The requirement is to open Experience Editor in the Preview mode in a new tab.
We identified the issue that occurred due to the Template Field name and Template name are the same. Eg: Carousel-> Template Name -> Slide -> Image -> Text Slide -> Template Name Once we renamed the template name as below, Our query started returning results. SlideItem -> Template Name Note: Field name and Template name should not be the same.
FieldEquals does not return results for certain fields We have cases wherein Sitecore GraphQL - FieldEquals() method does not return results for certain fields.
When Sitecore is deployed to Azure PaaS, XM and XP packages for app services contain additional config files for Application Insights in the folder \App_Config\Sitecore\Azure. The file \App_Config\Sitecore\Azure\Sitecore.Cloud.ApplicationInsights.config replaces default log file appenders with Application Insights appenders for standard Sitecore log files. Ensure that your custom logs switch to the Application Insights appender in Azure environments too. They should have configuration similar to standard Sitecore logs: <log4net> <appender name=&quot;YourCustomLogFileAppender&quot; type=&quot;log4net.Appender.SitecoreLogFileAppender, Sitecore.Logging&quot;></appender> <appender name=&quot;YourCustomLogFileAppender&quot; patch:instead=&quot;appender[@name='YourCustomLogFileAppender' and @type='log4net.Appender.SitecoreLogFileAppender, Sitecore.Logging']&quot;> <patch:attribute useApplicationInsights:require=&quot;false&quot; name=&quot;type&quot;>Sitecore.Cloud.ApplicationInsights.Logging.LevelTraceAppender, Sitecore.Cloud.ApplicationInsights</patch:attribute> <patch:attribute useApplicationInsights:require=&quot;!false&quot; name=&quot;type&quot;>Sitecore.Cloud.ApplicationInsights.Logging.Log4NetAppender, Sitecore.Cloud.ApplicationInsights</patch:attribute> <category useApplicationInsights:require=&quot;!false&quot; value=&quot;yourCustomLog&quot; /> </appender> </log4net>
Application Insights on Sitecore 10.1 not logging custom errros from the application I tried to install Application Insights on Sitecore 10.1 project in Azure PaaS. After installing the AI SDK and configuring the instrumentation key the app insights started to pick up Sitecore logs e.g. coming from Sitecore Kernel, but not our custom logs which we would like to log as well. We have not changed any logging configuration so we are using the default Sitecore Diagnostics Log.Error methods for that. The errors are being logged correctly on lower environments however in Azure this does not work at all. I checked the daily cup and we did not exceed it yet so it should be working. Could you please advise what to check or if there is any additional configuration required to make it work in AI?
Usually it is not recommended to modify Global.asax file in Sitecore solutions. This is because Sitecore has its own implementation of Global.asax and changing the file may cause problems during Sitecore version upgrade. In order to allow some flexibility in common Global.asax methods, Sitecore provides a set of pipelines such as <initialize> and <sessionEnd>, however there is no pipeline for GetVaryByCustomString. If GetVaryByCustomString is critical for your solution, you can create a class and inherit it from Sitecore.Web.Application: public class CustomApplication : Sitecore.Web.Application { public override string GetVaryByCustomString(HttpContext context, string custom) { //add your logic here } } Then you can reference the class in Global.asax and make sure it gets deployed to your website root folder: <%@Application Language='C#' Inherits=&quot;YourNamespace.CustomApplication&quot; %> Please note that ASP.NET MVC output cache will not be cleared by Sitecore event handlers so it is only suitable for caching data coming from external sources, for example third-party APIs. If your data is managed within Sitecore, the best approach would be to utilise Sitecore cache layers.
Sitecore 9.3 output cache VaryByCustom In Sitecore 9.3 solution I've got a few MVC controllers returning JSON data. I was planning on using the standard ASP.NET MVC OutputCache attribute which works absolutely fine. However, I also require implementing the custom vary by logic, which typically is implemented in Global.asax GetVaryByCustomString method. Quick investigation shown me that Global.asax file is no longer a part of Solution in Sitecore 9.3. In this case, where can I put my GetVaryByCustomString method?
This error occurs because sp_helpuser stored procedure invoked in the aspnet_Setup_RemoveAllRoleMembers stored procedure is not supported with Azure SQL Database. You could try to comment out the line where it is invoked and manually uncomment it after the migration (it is not supported in Azure SQL, so it is very likely not used by the Sitecore application). Personally, I would not use the Azure Database Migration tool to migrate the Sitecore databases from an on-prem SQL instance to Azure SQL, but instead I would: Create a bacpac of the databases to migrate. Upload the bacpac files to an Azure blob storage. Restore the Azure SQL databases using the uploaded bacpac files from the storage. Run the Create User SQL scripts (distributed within the WDP Sitecore packages of a release) to set new database users (if needed). If you are migrating all SQL databases for a Sitecore XP instance, independently of the approach taken, you will also need to update SQL server name references stored in the Xdb.Collection.ShardMapManager database (see this other SSE question for more details).
Sitecore SQL Migration to Azure is Blocked We have an on premises instance of Sitecore 10.1.1 and want to move the databases from SQL Server on VM to Azure SQL Database. We are leaving the Sitecore sites on VM for now. A migration blocker in the core database has been reported by the Data Migration Analyzer because the stored procedure 'sp_helpuser' is not supported in Azure SQL Database. What needs to be done so the database can be migrated? Issue Details IMPACT Azure SQL Database currently does not support certain system stored procedures that are available in SQL Server. See the &quot;Impacted Objects&quot; section for the specific unsupported procedures that were referenced. Objects referencing unsupported stored procedures will not work correctly after migrating to Azure SQL Database. RECOMMENDATION You will need to remove the references to these system stored procedures before migrating to Azure SQL Database. OBJECT DETAILS Type: Procedure Name: dbo.aspnet_Setup_RemoveAllRoleMemebers Object '[dbo].[aspnet_Setup_RemoveAllRoleMembers]' uses procedure 'sp_helpuser', which is not supported in Azure SQL Database. For more details, please see: Line 15, Column 10.
I don't think SXA provides this OOTB, we need to create QueryToken for Multlist With Search. The Multilist with Search field uses a SourceFilterBuilder class to parse its field source. Sitecore uses SourceFilterBuilderFactory to create the SourceFilterBuilder You can follow this blog - https://www.coreysmith.co/sxa-multilist-search-query-tokens/ Needs to extend SourceFilterBuilderFactory class - using System; using System.Linq; using Sitecore; using Sitecore.Buckets.FieldTypes; using Sitecore.Data.Items; using Sitecore.XA.Foundation.SitecoreExtensions.Services; namespace CoreySmith.Foundation.SitecoreExtensions { public class QueryTokenSourceFilterBuilderFactory : SourceFilterBuilderFactory { private readonly IQueryService _queryService; public QueryTokenSourceFilterBuilderFactory(IQueryService queryService) { _queryService = queryService ?? throw new ArgumentNullException(nameof(queryService)); } public override SourceFilterBuilder CreateSourceFilterBuilder(Item targetItem, string fieldId, string fieldSource) { if (targetItem == null) throw new ArgumentNullException(nameof(targetItem)); if (fieldId == null) throw new ArgumentNullException(nameof(fieldId)); if (fieldSource == null) throw new ArgumentNullException(nameof(fieldSource)); var startSearchLocation = StringUtil.ExtractParameter(&quot;StartSearchLocation&quot;, fieldSource); if (!StartSearchLocationContainsQueryToken(startSearchLocation)) { return base.CreateSourceFilterBuilder(targetItem, fieldId, fieldSource); } var resolvedStartSearchLocation = ResolveStartSearchLocation(startSearchLocation, targetItem); var resolvedFieldSource = fieldSource.Replace(startSearchLocation, resolvedStartSearchLocation); return base.CreateSourceFilterBuilder(targetItem, fieldId, resolvedFieldSource); } private static bool StartSearchLocationContainsQueryToken(string startSearchLocation) { return !string.IsNullOrEmpty(startSearchLocation) &amp;&amp; startSearchLocation.StartsWith(&quot;query:&quot;) &amp;&amp; startSearchLocation.Contains(&quot;$&quot;); } private string ResolveStartSearchLocation(string startSearchLocation, Item targetItem) { var query = ParseStartSearchLocationIntoQuery(startSearchLocation); var resolvedStartSearchLocation = _queryService.Resolve(query, targetItem.ID.ToString()); // Multilist with Search fields only support one StartSearchLocation. If a pipe-delimited list // is set on the field source, no results will be returned; instead, return the first result. var firstStartSearchLocation = resolvedStartSearchLocation.Split('|').FirstOrDefault(); return $&quot;query:{firstStartSearchLocation}&quot;; } /// <summary> /// The StartSearchLocation parameter requires '->' in place of '=' within Sitecore queries. /// For example: StartSearchLocation=query:/sitecore/content//*[@@template->'SomeTemplate'] /// The SXA query token resolver doesn't like '->', so replace with '=' for the Sitecore /// query engine. /// </summary> private static string ParseStartSearchLocationIntoQuery(string startSearchLocation) { return startSearchLocation.Replace(&quot;->&quot;, &quot;=&quot;); } } } Then register the QueryTokenSourceFilterBuilderFactory with Sitecore's DI container. This will replace the SourceFilterBuilderFactory implementation that Sitecore uses out of the box. using Microsoft.Extensions.DependencyInjection; using Sitecore.Buckets.FieldTypes; using Sitecore.DependencyInjection; namespace CoreySmith.Foundation.SitecoreExtensions { public class SitecoreExtensionsConfigurator : IServicesConfigurator { public void Configure(IServiceCollection serviceCollection) { serviceCollection.AddSingleton<SourceFilterBuilderFactory, QueryTokenSourceFilterBuilderFactory>(); } } } Patch the configurator in through config: <configuration> <sitecore> <services> <configurator type=&quot;CoreySmith.Foundation.SitecoreExtensions.SitecoreExtensionsConfigurator, CoreySmith.Foundation.SitecoreExtensions&quot; /> </services> </sitecore> </configuration> Then use it like below - StartSearchLocation=query:$site/*[@@name='Data']/*[@@templatename='Video Folder']&amp;TemplateFilter={ADE9EFF4-DA78-4E26-9248-B01BD93EAE95}
Load Site based item only in 'Multilist With Search' I am working on Sitecore 9.1 with SXA multisite application. I have a folder in every site e.g Site-1/data/Tags/ I created page items with a field Multilist With Search type Now I want to load data in this field only with Tags data belonging to that site only. I am trying to pass source in 'multilist with search' like StartSearchLocation=query:$site/Data/Tag Repository/*[@@templatename='Tag']&amp;Filter=+_templatename:Tag But it does not work. If I pass query like StartSearchLocation={11111111-1111-1111-1111-111111111111}&amp;Filter=_template:{68BA23FD-8270-4675-97EA-4FAFC7CF3AB9} then 'Multilist with Search' field loads data from all the sites. Please suggest me how can I make sure data loads only from that site where item is created.
I'm working on a SXA/JSS solution in Sitecore 10.3 and I had the same issue. To fix this I created a custom field serializer and added it to the layout service. First, you should create a class that inherits from BaseFieldSerializer and override the WriteValue method, I called this class TokenizedTextFieldSerializer. public class TokenizedTextFieldSerializer : BaseFieldSerializer { protected Regex RegexTokenInputs { get; } = new Regex(&quot;\\$\\(([^$()]+)\\)&quot;, RegexOptions.Compiled); protected IContext Context { get; } = ServiceLocator.ServiceProvider.GetService<IContext>(); public TokenizedTextFieldSerializer(IFieldRenderer fieldRenderer) : base(fieldRenderer) { } protected override void WriteValue(Field field, JsonTextWriter writer) { Assert.ArgumentNotNull((object)field, nameof(field)); Assert.ArgumentNotNull((object)writer, nameof(writer)); string result = field.Value; foreach (Match match in this.RegexTokenInputs.Matches(field.Value)) { string tokenValue = this.GetTokenValue(match.Groups[1].Value); if (!string.IsNullOrWhiteSpace(tokenValue)) result = result.Replace(match.Value, tokenValue); } writer.WriteValue(result); } private string GetTokenValue(string tokenKey) { ID keyFieldId = ID.Parse(&quot;{02F6FB63-FE92-44E8-AFA2-20747C893502}&quot;); ID valueFieldId = ID.Parse(&quot;{1B9D1028-C20C-407B-9DCD-AFFE86A6F793}&quot;); if (!string.IsNullOrWhiteSpace(tokenKey)) { ID contentTokenId = ((IEnumerable<ID>)this.Context.Database.DataManager.DataSource.SelectIDs(keyFieldId, tokenKey)).FirstOrDefault<ID>(); Item tokenItem = this.Context.Database.GetItem(contentTokenId); if (tokenItem != null) { return tokenItem[valueFieldId]; } } return string.Empty; } } Now create a class that inherits from BaseGetFieldSerializer, and override the SetResult method to set an instance of the previous class as the value of args.Result, I called this class GetTokenizedTextFieldSerializer. public class GetTokenizedTextFieldSerializer : BaseGetFieldSerializer { public GetTokenizedTextFieldSerializer(IFieldRenderer fieldRenderer):base(fieldRenderer) { } protected override void SetResult(GetFieldSerializerPipelineArgs args) { args.Result = new TokenizedTextFieldSerializer(this.FieldRenderer); } } Now you should add the GetTokenizedTextFieldSerializer processor to the getFieldSerializer, and patch it before GetDefaultFieldSerializer processor. Do not forget to specify the field types that this field serializer should be applied to, in our case single-line text and multi-line text field types. <configuration xmlns:patch=&quot;http://www.sitecore.net/xmlconfig/&quot;> <sitecore> <pipelines> <group groupName=&quot;layoutService&quot;> <pipelines> <getFieldSerializer> <processor patch:before=&quot;*[@type='Sitecore.LayoutService.Serialization.Pipelines.GetFieldSerializer.GetDefaultFieldSerializer, Sitecore.LayoutService']&quot; type=&quot;Your.Namespace.GetTokenizedTextFieldSerializer, your.dllName&quot; resolve=&quot;true&quot;> <FieldTypes hint=&quot;list&quot;> <fieldType id=&quot;1&quot;>single-line text</fieldType> <fieldType id=&quot;3&quot;>multi-line text</fieldType> </FieldTypes> </processor> </getFieldSerializer> </pipelines> </group> </pipelines> </sitecore> </configuration> Now you can use SXA Content Tokens as you use in a regular MVC solution $(tokenKey). Here is a good article that explains in more detail how to implement it. https://www.andreandrade.blog/2023/05/how-to-use-sxa-content-tokens-in-jss.html
SXA Content Tokens in Layout Service I'm attempting to use a Content Token named BrandName in a Page Title field in a multi-site headless solution (Sitecore 10.1.1 Headless 18). The hope was that I could setup the Standard Values for the field as follows: $name | $(BrandName). This would replace the $name token with the name of the Route item and the $(BrandName) token with the value specified within the Data folder of the site. Based on the SXA documentation The logic of content tokens replacement is implemented in the RenderContentToken processor of the renderField pipeline. You can reference a content token in a rich text, single-line text, and multi-line text field by using the $ key and the name of the content token in parentheses. I have confirmed that this does work as expected with Rich Text fields, but not with Single Line Text or Multi-line Text fields. In my example below, the token key is BrandName and the value is Super Huge Brand. The Route name is Home. { &quot;sitecore&quot;: { &quot;context&quot;: { &quot;pageEditing&quot;: false, &quot;site&quot;: { &quot;name&quot;: &quot;Super Huge Brand&quot; }, &quot;pageState&quot;: &quot;normal&quot;, &quot;language&quot;: &quot;en&quot;, &quot;itemPath&quot;: &quot;/&quot; }, &quot;route&quot;: { &quot;name&quot;: &quot;Home&quot;, &quot;displayName&quot;: &quot;Home&quot;, &quot;fields&quot;: { &quot;Page Design&quot;: { &quot;id&quot;: &quot;640c1013-1a08-4301-bdae-324e0953b5fd&quot;, &quot;url&quot;: &quot;/sitecore/content/Client A/Super Huge Brand/Presentation/Page-Designs/Primary-Page-Design&quot;, &quot;name&quot;: &quot;Primary Page Design&quot;, &quot;displayName&quot;: &quot;Primary Page Design&quot;, &quot;fields&quot;: { &quot;PartialDesigns&quot;: { &quot;value&quot;: &quot;{79FDD9F5-E3ED-4597-BB59-C8C4E8187D10}|{3232D922-6C2E-447C-834D-50E5D1EE8A86}|{D3FFF78A-284E-4135-B826-FD91E8505DBB}|{7296CF96-E7F6-4F04-84C0-032592C57BCF}&quot; } } }, &quot;PageTitle&quot;: { &quot;value&quot;: &quot;Home | $(BrandName)&quot; }, &quot;RichPageTitle&quot;: { &quot;value&quot;: &quot;Home | Super Huge Brand&quot; }, &quot;MultiLinePageTitle&quot;: { &quot;value&quot;: &quot;Home | $(BrandName)&quot; } }, &quot;databaseName&quot;: &quot;web&quot;, &quot;deviceId&quot;: &quot;fe5d7fdf-89c0-4d99-9aa3-b5fbd009c9f3&quot;, &quot;itemId&quot;: &quot;706a68e8-349c-4a5d-bd38-38f0766171b1&quot;, &quot;itemLanguage&quot;: &quot;en&quot;, &quot;itemVersion&quot;: 1, &quot;layoutId&quot;: &quot;9a4810a8-5fd1-42ac-97d8-4ad65b56c7ed&quot;, &quot;templateId&quot;: &quot;34e6c385-eb0d-4858-b173-8b0cbc919149&quot;, &quot;templateName&quot;: &quot;App Route&quot;, &quot;placeholders&quot;: {} } } } My question is: Am I doing something wrong or is this a bug that I need to log with Sitecore?
If you are working with a multisite structure, then first of all you'll need to loop through all the configured sites and get the home page of current item. // Current item var item = Sitecore.Context.Item; //Since you're working on Core DB, so Sitecore.Context.Database will return core, instead you can use ContentDatabase Sitecore.Data.Database contentDB = Sitecore.Context.ContentDatabase; // loop through all configured sites foreach (var site in Sitecore.Configuration.Factory.GetSiteInfoList()) { // get this site's home page item var homePage = contentDB.GetItem(site.RootPath + site.StartItem); // if the item lives within this site, this is our context site if (homePage != null &amp;&amp; homePage.Axes.IsAncestorOf(item)) { // Write your logic. This is homePage for your current item. } }
Find the home path of an item I have custom button in Core database and I want to get the home path of an item. This is the item /sitecore/content/Test/Retail/TestShop/home/whats-on/event-1 This is the home path '/sitecore/content/Test/Retail/TestShop/home' I am able to find the home item using the following code var item = &quot;/sitecore/content/Test/Retail/TestShop/home/whats-on/event-1&quot;; string split = &quot;home&quot;; int index = item.LastIndexOf(split); if (index > 0) item = item.Substring(0, index+ split.Length); Is there a better way finding item's home item?
Please add the following source in the NuGet.config file with the developer collection feed and it would resolve the error. <add key=&quot;SVSComponents&quot; value=&quot;https://sitecore.myget.org/F/sc-developer-collection/api/v3/index.json&quot;/>
NU1101: Unable to find package SVS.Build.No packages exist with this id in source(s) When we were trying to create a build pipeline the scs project getting the below error ##[error]The nuget command failed with exit code(1) (NU1101: Unable to find package SVS.Build. No packages exist with this id in source(s): NuGetOrg)
You can override QueryState method like that: public override CommandState QueryState(CommandContext context) { var item = context.Items[0]; if (item.TemplateID != MyTemplateId) return CommandState.Hidden; return base.QueryState(context); } EDIT After OP's question. There is no additional configuration needed. It's just one more method you need to override. So if you copied code from the link you added in your question and wrote your custom code in Execute method, you need to do the same with QueryState method: using Sitecore.Shell.Framework.Commands; using System; namespace Sc.Int.MiniBizz.Customaztion { class MBCustomButtonImport : Command { public override void Execute (CommandContext context) { Sitecore.Context.ClientPage.ClientResponse.Alert(&quot;Testing my button&quot;); } public override CommandState QueryState(CommandContext context) { var item = context.Items[0]; if (item.TemplateID != MyTemplateId) return CommandState.Hidden; return base.QueryState(context); } } }
Add button to ribbon by template I need to add a new button on the ribbon in ContentEditor for a specific template. It follows the instructions: https://community.sitecore.net/technical_blogs/b/sitecore_what39s_new/posts/adding-a-custom-button-to-the-ribbon The problem is the lack of information how I can associate such an operation with the template. This means: the new part of the menu will be shown, e.g. for the media folder, and for other templates it will not appear.