output
stringlengths
34
25.7k
instruction
stringlengths
81
31k
input
stringclasses
1 value
There's no out of the box functionality to approve child items Sitecore, but it is a common enough of a problem. Basically you would need to write a custom approval action that checks all related items when the main item is approved, and sets the workflow of the related items (or subitems) to approved state. Here's one example of how this could be done: http://sitecorepromenade.blogspot.com/2015/10/workflow-with-auto-publish-related-items.html
Approve child items if parent item approved in Sitecore workflow How to approve child items automatically if parent item is approved by reviewer in Sitecore Workflow?
In Helix documentation View Renderings are considered Sub-Layouts. As layouts and sub-layouts (in MVC defined as View Renderings) typically control the overall page design and therefore contain very site or project specific mark-up, they belong in Project layer modules. http://helix.sitecore.net/principles/layout/layouts.html
Habitat - Renderings vs Sublayouts All of the common CSHTML views in Habitat are in a folder called Sublayouts. https://github.com/Sitecore/Habitat/tree/master/src/Project/Common/code/Views/Common/Sublayouts However, I'd usually call these Renderings vs Sublayouts, because they're Razor views. Specicifally, I'd call them View Renderings. This is backed up in the Content Editor, where these items exist as Renderings: Is there some terminology difference in Habitat that I'm not aware of? Or is it just confusing naming within the Habitat codebase?
Go to Core DB and navigate to '/sitecore/content/Applications/WebEdit/Default Rendering Buttons/Options' & apply corresponding security on this item. It would look like :
Disable the "Edit Experience Editor Options" button for my editor users I have a number of users which should have access to create/edit/delete content on my site, including inserting new components to pages. To ensure that they can insert and change components I have given them the roles: sitecore\Designer sitecore\Author With the above roles, the users also get access to the "Edit Experience Editor Options" which is not something I wan't ordinary editors to have access to. Is it possible to limit the access to this?
When you directly set up your IIS site to use your folder where the Visual Studio solution placed it can happen because of the Rebuild. Rebuild means cleaining up your bin folder and only take the assemblies which are in your Visual Studio project. So if the Sitecore.Form.Core.dll is not used in your project then the Rebuild removes it. If you setup the site like this then you should only Build. I suggest to you to setup a different root folder for your IIS and do a publish from Visual Studio to the clean Sitecore instance. Here is a good article how to setup Sitecore with Visual Studio project - https://doc.sitecore.net/sitecore_experience_platform/developing/developing_with_sitecore/set_up_sitecore_and_visual_studio_for_development.
Could not resolve type name: Utility.HttpContextPerRequestStorage following WFFM install I'm trying to install WFFM into Sitecore XP 8.1. Following installation, the WFFM options appear in the desktop as expected. However, if I then do a clean and rebuild in Visual Studio, I then get the following error whenever I try to access any page on the site/in sitecore: Could not resolve type name: Sitecore.Form.Core.Utility.HttpContextPerRequestStorage, Sitecore.Forms.Core (method: Sitecore.Configuration.Factory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert)). I then have to roll back all changes in order to bring the site back up - when I do this, the WFFM option is still present in my desktop menus, but then disappears again when I sync with Unicorn. Can anyone enlighten me on this? I'm very new to Sitecore (picking up a project from someone else), and there seems to be no documentation for if things go wrong like this... Thanks!
Assuming that you use Chrome, I've seen this error a couple of times myself, and it seems to be related to caching within the browser itself (which is why it can appear randomly). A colleague of mine had this issue and was suggested trying a different browser. Once he fired up firefox, everything worked fine. Once he deleted all the cache from Chrome, and the error disappeared. You can read the full story over here: https://codebuildplay.wordpress.com/2016/08/10/webedittexts-not-found/
Sitecore error: The item "/sitecore/content/Applications/WebEdit/WebEdit Texts" was not found. It may have been deleted by another user All of a sudden, Whenever I try to use the Sitecore experience editor, I get the error: The item "/sitecore/content/Applications/WebEdit/WebEdit Texts" was not found. It may have been deleted by another user. I've checked that item, and it definitely exists. I found an article (https://codebuildplay.wordpress.com/tag/error/) that suggests that this error is a caching issue, but I've ruled that out. Any ideas on what might be causing this? The specific error ini the error log is: Nested Exception Exception: Sitecore.Exceptions.ItemNullException Message: The item "/sitecore/content/Applications/WebEdit/WebEdit Texts" was not found. It may have been deleted by another user. Source: Sitecore.Kernel at Sitecore.Client.GetItemNotNull(String itemPath, Language language, Version version, Database database) at Sitecore.Xml.Xsl.ImageRenderer.GetDefaultImage() at Sitecore.Xml.Xsl.ImageRenderer.Render() at Sitecore.Pipelines.RenderField.GetImageFieldValue.Process(RenderFieldArgs args) at (Object , Object[] ) at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) at Sitecore.Mvc.Helpers.SitecoreHelper.BeginField(String fieldName, Item item, Object parameters) at Sitecore.Mvc.Helpers.SitecoreHelper.Field(String fieldName, Item item, Object parameters) at [XXXXX]_cshtml.Execute() in [XXXXX].cshtml:line 75 at System.Web.WebPages.WebPageBase.ExecutePageHierarchy() at System.Web.Mvc.WebViewPage.ExecutePageHierarchy() at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) at Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer)
After installing a second instance, I copied the Model layout fields to my other instance. Apparently, my current Model layout was completely empty. Acter changing the values to the original values, all worked perfect!
Assign a Model type Following the Getting started (Part 2), it shows assigning a defined Model Type to the Sitecore Model.Item. However, when I open the Model.Item it does not seem to have a Model.Type input. Through Sitecore Rocks And Sitecore Content Editor And as expected, when attaching the model to the Rendering: @using Sitecore.Mvc @model Sitecore_first.Models.Car <div> @Html.Sitecore().Field("Name") </div> I get the error: Inner Exception: Model definition item does not contain a model type name. Item path: /sitecore/layout/Models/Car. Model type field name: Model Type What could cause the behavior of no Model.Type input field to define the Model class path? Specifications Sitecore rocks 2.0.39.0 Visual studio 2015 Community Sitecore 8.2
The sitecore/virtualssuser (Virtual ScreenShot User) is a virtual user used by the pre-emptive screenshot generation event handler. Being a virtual user, the user should never be persisted or appear in the user manager as it's not a real user account. In addition, the virtual user is destroyed once the screenshot generation has completed. It is used by Content testing: https://doc.sitecore.net/products/sitecore%20experience%20platform/content%20testing
What is sitecore\virtualssuser I see a number of sitecore\virtualssuser "logged in" in /sitecore/shell/sitecore/client/Applications/LicenseOptions/KickUser Anyone know what they are and if they are using Editor license place?
The user can still be matched in Pattern Card A or B. Let us take the following scenario: Pattern Card A is assigned to users who are more involved in reading articles that concerns Exercises. Pattern Card B is assigned to users who are more involved in reading articles that concerns Swimming. So, if your user is tag with the Pattern Card A, this means that the user has a preference for exercises articles. For the user to be tag with the Pattern Card B, you need to make him/her to read Swimming articles. To do so, you will require to make use of Goals and Engagement Values which will drive the user to start reading articles about swimming. As long as the user keeps reading Exercises articles, he/she will stay in the Pattern Card A. It all depends on how you set the rules and what you want your users to do on the site. Update Sitecore Rules evaluation is like this: Once a condition is met, it will return the action. So, if there are other rules below, they will not be executed. The issue here is that both Exercises and Swimming are 100 and if Exercises Rule is above the Swimming Rule, it will always return Exercises. So, you will need to either rethink on how to set the points or modify the rule to add a certain time limit of displaying the Banner or how to tag your content with the pattern cards. If I am not mistaken, you may tag a content with more than 1 profile card. I would suggest to work on the points because personalization is mostly based on what the user wants. Also, it is Sitecore in its core who calculates in which pattern it will place the user. It all depends which profile cards have been used to tag content and base of each profile card weightage, Sitecore determines in which pattern the user falls.
Personalization and Pattern Card Matching Using 8.1 I would like to implement some personalization on the top banner of a page. So, if the user matches Pattern Card A, they see banner A, if they match Pattern Card B, they see banner B, and so on. My problem is that if the match Pattern Card A first, they can never get to Pattern Card B because in the hierarchy of the rules, once they match A, the always match A and can never change to B because their values still match A. I'm not sure if I am misunderstanding how pattern card matching is working? Or not setting up my rules correctly? UPDATE On my banner, I have the following Rules: Condition 1. where the current contact matches Exercises in the MyCustomPersona profile : Show the Exercise banner Condition 2. where the current contact matches Swimming in the MyCustomPersona profile : Show the Swimming banner Default Condition. Of none of the other conditions are true, the default condition is used. MyCustomPersona is a Profile, with several Profile Keys: Exercise, Swimming, etc... My profile cards are all or nothing, meaning the profile card for Exercise is Exercise = 100, my profile card for swimming is Swimming = 100 And what is happening is that once a user meets the Exercise = 100 threshold, I only ever see the Exercise banner, no matter what else I do on the site. AND, this seems to be the case when my rules are based on Visitor. If I use rules based on Visit I seem to be OK. But I really want historical data. Meaning if I browse on the site one day and meet the Exercise threshold, I should be able to come back to the site and it still be personalized for Exercise.
Adding some additional context, mentioned in other answers, the Sitecore Scaling Guide which is available on the old Sitecore Developer Network site is intended for versions of Sitecore 7.0 to 7.2. In this guide, Chapter 2.4 specifically, talks about how to convert a CM instance (which is the standard Sitecore install) and make it a content delivery server. Since this document has come out, there have been some enhancements that the community has provided. One of them is the SwitchMasterToWeb.config which step 2.4.3 (and referencing Section 4.6) refer to, which you can download on the SDN Scaling Guide Site. A Revised version of this config file was made available by Adam Simsy. Security Hardening Additionally, while on the topic of setting up Content Delivery servers, when working in production environments, you also want to ensure you are paying attention to the Sitecore Security Hardening Guide, which includes additional information specifically for hardening the security of Content Delivery servers.
Configure content management and content delivery on Sitecore 7.2 I am looking for a guideline on configuring CD and CM servers. Sitecore provided this guideline but it is for Sitecore 8.0 and up. I am looking for Sitecore 7.2 guideline. Please let me know if there's any.
Session locking only affects requests from a single source. It's more evident in load testing than it is in real world situations, since most of the traffic is coming from a single source, or relatively small number of sources. We have seen performance improvements in code using the ReadOnly attributes for controllers in a load test scenario, but these don't translate to significant gains in live sites. It does seem that the SessionState acquisition is the first really "expensive" step in the page delivery process since it often involves a connection to a remote service. Stands to reason, then, this is the place we see things "stuck" during heavy load scenarios. Short of removing session altogether or replacing the process with a much faster model, there's not going to be much can be done about that, I would say. I've also done a bit of research on this topic and pretty much given up trying to unlock the process here.
AcquireRequestState causing slow page load times We're currently doing some performance optomisation of our Sitecore 8.1 Website and one of the slowest operations were seeing in New Relic is AcquireRequestState. I've read around this quite a bit about it (e.g https://discuss.newrelic.com/t/digging-into-the-acquirerequeststate-event/40468) and know that ASP.NET can cause Session Locking and wait for the request to complete before it releases the lock. This can cause significant slowdowns on page load. I've also read a few Sitecore related articles on this (e.g: https://blog.wesleylomax.co.uk/2015/10/08/sitecore-8-ajax-controller-blocking/) and it looks like it should be possible to disable session on a per Controller basis using: [SessionState(System.Web.SessionState.SessionStateBehavior.ReadOnly)] New Relic and the article above though suggest that some of Sitecores default controllers can potentially be causing this and not our custom ones. Has anyone else seen this issue and did you implement this for your custom controllers or patch any out of the box Sitecore controllers? Further info: Sitecore 8.1 Update 2 MVC 3 front end CD servers (Load Balanced) Session stored out of process in SQL Database
The issue is that the classic Sitecore publish works with one item at a time, once you add network latency to that single operation and then multiply by number of targets and languages you can see why it takes so long in some configurations. Im sorry this doesn't help directly with you answer. My colleague wrote a blog post on classic Sitecore publishes on Azure and this emphasises why we made the new Publishing Service the way we did and the improvements it gives by reducing latency across the board. From UK -> West Coast US : Publish of 2hrs 53 mins reduced to 17 seconds. http://www.ehabelgindy.com/the-awesome-performance-of-sitecore-publishing-service-v2/
Sitecore publishing in SQL Azure running slow We have a server setup of the following using 8.1 Update 2, so the CM/CDs are on Azure classic VMs: CM on US with SQL Azure in US CD on US with SQL Azure in US CD on EU with SQL Azure in EU We're finding that publishing from CM to the CDs is taking an extraordinary amount of time. Doing a smart publish of the entire site, we found that going from the CM to the US CD took about 90 minutes, and from the CM to the EU CD took over 3 hours. The item count at the end was just over 88,000, so not a great amount considering a site publish. We need to drastically reduce these deployment times. Is this a matter of giving more power via Azure configuration to the VMs or, more likely, the SQL Azure servers? There's always a cost/benefit to doing that, but I'm looking for an optimal solution and we can work back to the practical cost-wise later.
Yes it's totally possible. When an item is controlled by Unicorn, you can use the Developer tab controls in the Sitecore ribbon to do partial syncing or partial reserialization. Unicorn takes over the standard Sitecore serialization in those cases. See https://kamsar.net/index.php/2015/09/Unicorn-3-What-s-new/#Unicorn-enabled-serialize-commands
Is it possible to reserialize a single item with Unicorn? I had this issue when syncing a configuration on one of my projects: "You can resolve this warning by reserializing the master:/sitecore/content/Modules/Links/Charts/Chart 1/Symptoms/Results item, or manually removing the deleted field value from the serialized item." this message got me thinking. I know I can reserialize the whole configuration and all items of it get reserialized but do it for just a single item I wouldn`t know how to do it. anyone knows?
As stated in the SO answer, the real issue is that without enabling the Sitecore.Speak.MVC.config, there's no route pattern matching just {controller}/{action}. The answer that will solve your problem is that you need to enable a config on the Content Delivery Servers that enable this route. There are a couple ways you can do this: Option 1: Enable Sitecore.Speak.MVC.config Let's take look at what this config is doing: <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <pipelines> <initialize> <processor type="Sitecore.Mvc.Pipelines.Initialize.InitializeCommandRoute, Sitecore.Speak.Client" patch:before="processor[@type='Sitecore.Mvc.Pipelines.Loader.InitializeRoutes, Sitecore.Mvc']"/> </initialize> <mvc.renderPlaceholder> <processor type="Sitecore.Mvc.Pipelines.Response.RenderPlaceholder.RenderAddedContent, Sitecore.Speak.Client"/> </mvc.renderPlaceholder> </pipelines> <mvc> <precompilation> <assemblies> <assemblyIdentity name="Sitecore.Speak.Web" /> </assemblies> </precompilation> </mvc> </sitecore> </configuration> This config is doing three things: Initializing the Command Route (which is really the piece you need) Adding a <renderPlaceholder> processor that renders added content. Adds the Sitecore.Speak.Web assembly to the list of precompiled assemblies. So, in a nutshell, there isn't much here that will harm a CD if this config is enabled, but the last two points aren't needed by the Content Delivery server. Option 2: Enable Command Route Manually You can create a patch config that patches in the InitializeCommandRoute processor above to the <initialize> pipeline. If this patch config exists on the CM, where this processor is already defined, it won't conflict. <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <pipelines> <initialize> <processor type="Sitecore.Mvc.Pipelines.Initialize.InitializeCommandRoute, Sitecore.Speak.Client" patch:before="processor[@type='Sitecore.Mvc.Pipelines.Loader.InitializeRoutes, Sitecore.Mvc']"/> </initialize> </pipelines> </sitecore> </configuration>
Html.Sitecore().Controller on a CD - No route in the route table matches the supplied values I am having a similar problem to InvalidOperationException: No route in the route table matches the supplied values That is, I am getting the error: No route in the route table matches the supplied values On a Content Delivery Server because I have disabled Sitecore.Speak.Mvc.config (I have confirmed, if I enable this config, my code works). My problem is this. The code that is failing is using: @Html.Sitecore().Controller(GlobalControllers.Page.Name, GlobalControllers.Page.Actions.HeadHTML) The above SO thread suggests manually adding the route, as in: RouteTable.Routes.MapRoute( "Bogus-Required-Route", "bogus-required-route/{controller}/{action}", ); But I'm not actually calling a route. I'm just feeding the controller name and action, so I would need to add just the basic route: RouteTable.Routes.MapRoute( {controller}/{action}", ); But doesn't that route already exist? If I add if for CDs, won't it blow up on the CM where I have the config enabled? What's the downside to just enabling this config on the CD?
Your list though simple, goes several different directions. Lets cover this at a high level and maybe ask questions for each one to get a more detailed answer. Sitecore xDB is configurable and extendable. Its what makes it so powerful. You can accomplish all of this using xDB and a little bit of code. Create a list of the most liked videos in ranked order. You can think of this the same way you think of how Sitecore keeps track of search terms people have entered. Page Events are your best friend in this case. Create a new page event for Video's watched an fire that event from code. Maybe even client side via an API. https://doc.sitecore.net/sitecore_experience_platform/developing/marketing_operations/events/register_a_page_event_programmatically You call up the videos watched page event and put the video on the data of the event. var interaction = Tracker.Current.Session.Interaction; var pageEventData = new PageEventData(name, definitionId) { ItemId = itemId, Data = [Video ID, or Name, or Url], Text = text }; interaction.CurrentPage.Register(pageEventData); Then you will want to add the report of your top videos to experience analytics. This will require creating a dimension from your page event and create a new report using Speak in the experience analytics. This a great how to, to get you started on creating the dimension and the custom report by copying an existing one. https://community.sitecore.net/developers/f/9/t/127 Be able to identify trends (e.g. current user likes certain tags). This would be the same as above. Just a different page event for the video tag. You could then see, in the last 7 days certain tags have been more popular than others. Be able to profile users by videos they liked (e.g. they liked these 5 videos so we can predict they'll like these ones). This is will be handled by profile and patterns cards in Analytics. You will want to make a new profile card for your video and add profiles for each tag you want to offer. Then you will want to make pattern cards for how you want organize your video users. And example of this would be to create profiles for cars, computers, watercraft and hot air balloon. Then create pattern cards for cars, water, inside and outside. Notice that its not one to one with your profiles. It could be anything you like. Then score the pattern cards to place users in the appropriate patter. And example is that Cars pattern would be a 5 for cars, 0 watercraft, 0 inside, and 2 outside. When the user gets votes on 3 or more (it's Sitecore setting) video, the video that vote on will trigger them to be put into a pattern card there profile scores line up with. I wrote a good answer (my opinion :) ) in this answer how profiles work. Behavioral personalization? After you have scored your user, you can then personalize their experience by offering them videos based on the pattern they are in. If they are in the outside pattern, you offer video that are tagged as cars and watercraft. You can certainly tailor your profiles and patterns to get you the spread you need. Keep a history of videos a user has seen so future suggestions aren't repeated. This is going to be a custom facet on the user's xDB profile. You are going to want to create a custom IElementDictionary facet and for each video the user watches, put a new record in the user xDB profile. When you are showing the user a list of videos, query their tracker profile for their past videos. You can then mark them as "watched" or just hide them. var data = Tracker.Current.Contact.GetFacet<IVideos>("Videos"); data.videoId = Id; data.Tag = Tag; I wrote an article of how to set up a IElementDictionary facet in this article. http://www.waitingimpatiently.com/multi-node-xdb-facet/ Jonathan Robbins has a good article here that can get you started.https://jonathanrobbins.co.uk/2015/12/08/how-to-extend-sitecore-experience-database/
Personalisation of videos Using OOTB Sitecore functionality: I have a bucket of video items, when a visitor views a video we have a control for them to say whether they like or dislike the video. What would be the best way to store this information with the intention of being able to generate the following results: Create a list of the most liked videos in ranked order. Be able to identify trends (e.g. current user likes certain tags). Be able to profile users by videos they liked (e.g. they liked these 5 videos so we can predict they'll like these ones). Keep a history of videos a user has seen so future suggestions aren't repeated.
The reason why the installation is not working is because mongoDB is not present. By default, when Sitecore is installed, the connection string of the mongoDB is already available in the ConnectionStrings.config file and Sitecore Analytics is enabled. Due to this, when Sitecore runs, it will try to connect to the MongoDB. This is the reason why the installation may takes lot of time to complete or having the never end installation issue like the one your are experiencing. You will have the same issue with other package installation. So, as you already mention, disabling the Analytics will fix the problem. Though, instead of changing the Sitecore config file directly, it is recommended to patch the setting as follows: <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <settings> <setting name="Xdb.Enabled" value="false" /> </settings> </sitecore> </configuration> and name the file as z.DisableSitecoreAnalytics.config so that it overrides the Sitecore configuration file. This will prevent any issues tomorrow when upgrading the Sitecore Version as it may overwritten the Sitecore Analytics config file when performing an upgrade. However, if you do not intend to make use of the MongoDB at all, it is preferable to remove the connection string of the MongoDB. Update Sitecore will make use of both mongoDB analytics and the Sitecore analytics DB. What happens is that data are captured and store in mongoDB then when session is expired ( default is 20mins), Sitecore flushes the data from MongoDB to the Sitecore Analytics DB. The results can be viewed from the experience analytics
Excel Transfer Utility installation issue I tried to install "Excel Transfer Utility" package in Sitecore 8.1 instance but it's continuously spinning only and doesn't install. Does this utility is not compatible with Sitecore 8.1? https://marketplace.sitecore.net/en/Modules/Excel_Transfer_Utility.aspx thanks
Please look on changelog of Sitecore Rocks Github Repository. Looks like you don't need on this version ‘Sitecore.Rocks.Lucene*.dlls. Please make a new install of the module and see if you still have the error. If you still have please delete Sitecore.Rocks.Lucene*.dlls and other dll that are not needed anymore. https://github.com/JakobChristensen/Sitecore.Rocks/blob/03c1f02eb1487feab431614ef1bde1bf65440bd9/CHANGELOG.md
Using Sitecore Rocks for Solr Search Enabled Sitecore instance I have noticed this strange error in my instance after attempting to connect sitecore rocks with my local sitecore instance which I have recently migrated to solr from Lucene search provider. Actual Issue: I have been playing around with sitecore rocks for long time &amp; it was with Lucene enabled instances. All (including mine) instances were migrated to SOLR provider &amp; when I tried to connect Sitecore rocks with my local instance, I have received ‘Connection failed’ even after deploying Sitecore rocks component dlls &amp; service files. Now when I try to access sitecore login page or any page, I have received this error. Some Analysis: There was no much information and also specially no errors in the sitecore logs &amp; I have started disabling all config files step by step but which went in vain. When I had a close look at the log entry, I see log entry stopped logging soon after ‘Sitecore.Rocks.Server.dll’ &amp; it should have recorded ‘Sitecore.Rocks.Lucene*.dlls’ log entries Which were missing. Temporary solution: As soon as i delete ‘Sitecore.Rocks*.dlls including ‘Sitecore.Rocks.Lucene*.dlls’ I’m able to get the sitecore login page. :) Queries: Do we have Sitecore rocks for solr enabled sitecore instance ? or should I perform any alternate steps to connect my local instance(SOLR enabled) ? If no, are we restricted to connect Sitecore rocks only if your instance is with lucene search ? :(
EXM stores all attachments in /sitecore/media library/Email Campaign/Attachments
where pdf from EXM attachment stored? do you know where PDF is stored when we upload it as email attachment from Email Experience Manager? I am using exm 3.1 Thanks.
I ended up engaging with Hedgehog Support on this and they provided two resolutions. One is to modify your registry. Back up your Windows Registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0, and edit it by adding inside the MSV1_0 folder a Multi-String Value called ‘BackConnectionHostNames’. Modify that Multi-String Value by adding the host name that you chose for your local site. Close the registry and restart IIS and Visual Studio, then retry the TDS connection. The other is a bit simpler...set anonymous authentication to be on for only the _DEV folder, and it works as well. Also, if you do this, you don't need to do any other config changes from the earlier blog.
TDS authentication issue with Windows authentication We have Windows authentication "wrapping" our Sitecore site to prevent access to a development server. We have Visual Studio and TDS installed on this server for pushing changes. After I set up Windows auth (and turned off anonymous authentication), I got the following error: "The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'. I found the following TDS article referring to this with a suggested config change: https://www.teamdevelopmentforsitecore.com/Blog/setting-authenticated-access-tds. After making this change, I still get the error, but now it says "Negotiate" instead of "Anonymous". So it's closer, but not correct still. Does anyone have experience with this and the correct setup?
Correct. Client side telemetry is normally part of layouts which are supplied with the website. Sitecore does not yet implement client-side telemetry, but we may implement relevant renderings in the future. We have not tested Sitecore with Application Insights Profiler, and this is an experimental feature, so it should only be enabled during profiling sessions and should not be enabled on a permanent basis. Role is assigned automatically when Sitecore environment is provisioned and allows to identify telemetry coming from a particular role (CM, CD, Processing, Reporting). Tag is empty by default but can be used to tag and identify telemetry coming from e.g. a staging slot
Sitecore 8.2 update 1 App Insight Configurations I've few questions on app insight configuration with sitecore 8.2 update 1 below: I assume we need to manually add the client side telemetry? When I click on Server Response Time I noticed below. Is it good practice to enable this? Not sure the performance impact. "Enable Application Insights Profiler to collect detailed performance trace". What's the difference between below and examples. I would they both are same: a. ApplicationInsights.Tag b. ApplicationInsights.Role
You haven't said which version of Sitecore / WFFM you are using but you should be able to create a custom field validator to validate the date like so (obviously you would need to add your own logic here): public class DateInFutureValidator : FormCustomValidator { public DateInFutureValidator() { this.ServerValidate += this.OnDateValidate; } private void OnDateValidate(object source, ServerValidateEventArgs args) { DateTime time = Sitecore.DateUtil.IsoDateToDateTime(args.Value).Date; if (time >= DateTime.UtcNow) { args.IsValid = true; return; } args.IsValid = false; } } more info here: https://doc.sitecore.net/web_forms_for_marketers/working_with_actions_and_validations/validations/walkthrough_create_and_assign_a_custom_fieldtype_validator and here: https://jonathanrobbins.co.uk/2015/06/09/sitecore-webforms-for-marketers-mime-type-sniffer-custom-field-validator/
How to validate date in WFFM Hi we need to validate date in web forms for marketers, should we make a custom field or override the script. Usually,i override the existing validation like date-picker field and etc and it works. We need to validate date-box to display date from 21 years ago until 10 years ago. Here is date-box script: Date-box script could you give any solution or reference link? thanks
I wrote a PowerShell cmldet for merging Final Renderings back into Shared Renderings. function Merge-Layout { [CmdletBinding()] param( [Parameter(Mandatory = $true,Position = 0,ValueFromPipeline = $true)] [item]$Item ) process { $layoutField = New-Object "Sitecore.Data.Fields.LayoutField" -ArgumentList ($Item.Fields[[Sitecore.FieldIDs]::LayoutField]); $finalLayoutField = New-Object -TypeName "Sitecore.Data.Fields.LayoutField" -ArgumentList $Item.Fields[[Sitecore.FieldIDs]::FinalLayoutField] if ($layoutField -eq $null) { Write-Error "Couldn't find layout on: $($Item.Name)" } if ($finalLayoutField -eq $null) { Write-Error "Couldn't find final layout on: $($Item.Name)" } if ($finalLayoutField.Value -eq $null -or $finalLayoutField.Value -eq "") { return; } $finalLayoutDefinition = [Sitecore.Layouts.LayoutDefinition]::Parse($finalLayoutField.Value) $Item."__Renderings" = $finalLayoutDefinition.ToXml(); Reset-ItemField -Item $Item -Name "__Final Renderings" -IncludeStandardFields } } Code is available on my gist: https://gist.github.com/alan-null/a7dd2cd01d9d851b39a6ec5fca96ac0b If you want C# code, here is a source from where I got this approach: http://www.rockpapersitecore.com/2016/07/07/merging-final-renderings-back-down-into-shared-renderings/
Copy final layout to shared layout Our content authors, makes a lot of mistake when whey work in Experience Editor. Quite often they do some changes on final layout, but expect to have it on shared layout. Is is any tool exist that could handle this case and clear final layout after it ? For simplicity copy only latest version in a one language.
The implementation that you are describing is meant to add similar support to Sitecore as the .NET MVC RenderSection functionality that Sitecore MVC does not natively support. Basically, what you need to do is take the <link> (I am assuming that you have the <link> node in your <iframe> but this solution will work for <style> nodes or just the CSS file URL too, with very minor tweaks) element that was added to the <iframe id="scLoadingFrame"> and move it to the <head> of the actual page. However, bear in mind the following: Should only run when in the Experience Editor Should only run when a new component that has an associated CSS file is added to the page and should only run for that component With that in mind, you can implement what you are looking for by doing the following: First, create a partial view, _ExperienceEditorDynamicCssLoader, that you statically pull into the bottom of your Layout's view via the following: if (Sitecore.Context.PageMode.IsExperienceEditor) { @Html.Partial("~/path/to/_ExperienceEditorDynamicCssLoader.chstml"); } Second, in your new _ExperienceEditorDynamicCssLoader partial view, write a delegated JavaScript event handler (you don't have to use jQuery, but their docs do a good job of explaining event delegation) to your page that will listen for components being added or <link> elements being added to an <iframe>. I haven't tried this with the Experience Editor, so you may need to experiment a bit in order to find the best place to assign this handler and the best event to listen for, but know that events should propagate up the <iframe>. Note that you need a delegated JS event handler because a delegated handler listens for events that occurred on child/descendant elements, rather than listening for an event from a specific element or set of elements. This means that a delegated handler can actually listen for elements that are't on the page when the handler was attached. Third, write the body of your delegated event handler such that it takes the <link> element from the <iframe> and moves it to the <head> of the current page. The following are a few examples of what this might look like in jQuery (which, again, is optional). If the actual <link> node is what gets added to the <iframe> then the body of your handler should be pretty simple and similar to following: $(this).find("link").appendTo("head") Alternatively, if you only have the URL of the CSS and not the actual <link> element in the <iframe> then you may need to writing something similar to the following: // get the elements with the URLs from the iFrame $(this).find("selector for elements containing the CSS file URLs") // move the link from each to the head of the page .each(function() { var cssFileUrl = $(this).GetCssFileUrl(); // replace this call with your own $('<link rel="stylesheet" type="text/css" href="' + cssFileUrl + '" >') .appendTo("head"); }); This will actually construct the <link> node for you to append to the <head>. Once you have that, you should be good to go. Your rendering should only ever render in the Experience Editor and all it should do is add the delegated handler, listen for <link> elements being added to the page and then move those elements to <head> of the page you are currently editing. The styles should apply as soon as the <link> element is added to the <head>.
CSS files are getting added through Experience Editor are inserted into iframe until the page is saved The site that I am working on has a list of CSS files. The CSS files are added to the list within a component’s view, then the main layout’s view will add all of the CSS files within this list to the header of the page. When a user adds a new component to the page through Experience Editor, the CSS file is added to an iframe with an ID of scLoadingFrame. This causes the component not to have the styles applied to it. When the page is saved, and it reloads, then the CSS file is put into the header of the webpage, and the component has the styles applied to it. Is there a way to get the main layout’s view to put the CSS references outside of the iframe when adding a component through Experience Editor?
The API is not quite obvious here. By default, all the items are added to the content. If you need to add an item to the Media Library, you should set the fakeItem.ParentID property: var mediaFakeItem = new DbItem("my-image") { ParentID = Sitecore.ItemIDs.MediaLibraryRoot }; Since DbItem has got mutable ParentID and FullPath properties, it's quite challenging to keep them in sync (e.g. when you change the FullPath only). I created a FakeDb issue to address it (if possible without introducing breaking changes).
Adding DbItem under media library with FakeDb When using FakeDb, and I set the full path of a DbItem to go under the media library, the path gets changed to the /sitecore/content/home/image-item. //Method starts here public void MediaItemPath() { Sitecore.Data.ID mediaItemId = Sitecore.Data.ID.NewID; // create some media item. Location, fields and template are not important using (Sitecore.FakeDb.Db db = new Sitecore.FakeDb.Db()) { var mediaFakeItem = new Sitecore.FakeDb.DbItem("my-image", mediaItemId); mediaFakeItem.FullPath = "/sitecore/media library/my-image"; db.Add(mediaFakeItem); Sitecore.Data.Items.Item mediaItem = db.GetItem(mediaItemId); Assert.AreEqual("/sitecore/media library/my-image", mediaFakeItem.FullPath); } } How can I add an item to the media library?
I'm not sure if you can do that using the shared layouts. I know you can do that using the final layout. In order for you to do that using the final layout you need essentially two things: Have a version on the standard values for each language you need Set the rendering parameters on the Final Layout and not on the shared one. You can make a test and using the standard values for each language set different values for a field using the final layout and you will see it in action.
Different rendering parameters by language I have a component rendering, which is added to the shared layout of the standard value of a page template. This page template has multiple language versions to have different values per language. Is there a way in Sitecore to make the rendering, which is on the standard values, have different rendering parameter defaults per language? Right now if I add one value to the shared layout it reflects across all languages.
It would appear to me that based on the above error messages and defined configurations, that somehow, "FacebookNetworkProvider" was set as the type of the Facebook Network Provider configuration "type". Similar to so: <social patch:source="Sitecore.Social.Facebook.config"> <networks> <network name="Facebook" ItemId="{D7429409-D6DA-46CD-91DD-8702781AE3C4}" prefix="fb" icon="facebook" url="https://www.facebook.com"> <providers> <provider type="FacebookNetworkProvider, Sitecore.Social.Facebook"/> </providers> </network> However, your provided configuration doesn't appear to indicate this. However, the provided error messages do. So how did I arrive at this conclusion? Let's step through backward beginning with the error message. WARN Could not find type in ReflectionUtil.CreateObject: FacebookNetworkProvider This error message contains one clear clue: FacebookNetworkProvider which is a string representation of the class that RefelctionUtil.CreateObject is expecting. We can see that here: public static object CreateObject(string assembly, string className, object[] parameters) { Assembly assembly1 = ReflectionUtil.LoadAssembly(assembly); if (assembly1 != (Assembly) null) { Type type = assembly1.GetType(className, false, true); if (type != (Type) null) { SystemCount.ReflectionTypesResolved.Increment(1L); return ReflectionUtil.CreateObject(type, parameters); } Log.Warn("Could not find type in ReflectionUtil.CreateObject: " + className, (object) typeof (ReflectionUtil)); SystemCount.ReflectionTypesNotResolved.Increment(1L); } return (object) null; } Notice that className is used in the error message. However, most class names should be in the form of Some.Name.Space.Class (In this case, it should be Sitecore.Social.Facebook.Networks.Providers.FacebookProvider). In addition, ReflectionUtil is specifically using the CreateObject(string assembly, string className, object[] parameters) method because it detected a comma in the typeName public static object CreateObject(string typeName, object[] parameters) { if (typeName == null || typeName.Length == 0) return (object) null; int length = typeName.IndexOf(','); if (length >= 0) { string className = typeName.Substring(0, length).Trim(); return ReflectionUtil.CreateObject(typeName.Substring(length + 1).Trim(), className, parameters); } //Snipped } But, this only provides a warning and instead returns null for the value of the created object, which in this case is supposed to be a network provider. ERROR Sitecore.Social: Can't cast the instance of type "" to NetworkProvider type So, now that the Reflection.Util has tried to create a FacebookNetworkProvider to wit it had zero success in doing, the NetworkProviderFactory checks to see if the object returned is of subtype NetworkProvider. public NetworkProvider GetNetworkProvider(Application application) { Assert.IsNotNull((object) application, "Application is not defined"); Assert.IsNotNull((object) application.Network, "Network of application is not defined"); string providerTypeName = this.GetNetworkProviderTypeName(application.Network.Name); try { object obj = ReflectionUtil.CreateObject(providerTypeName, new object[1] { (object) application }); if (!(obj is NetworkProvider)) this.logManager.LogMessage(string.Format((IFormatProvider) CultureInfo.CurrentCulture, "Can't cast the instance of type \"{0}\" to NetworkProvider type", new object[1] { obj }), Sitecore.Social.Infrastructure.Logging.LogLevel.Error, (object) this); return obj as NetworkProvider; } catch (Exception ex) { this.logManager.LogMessage(ex.Message, Sitecore.Social.Infrastructure.Logging.LogLevel.Error, (object) this, ex); } return (NetworkProvider) null; } Since it is not, NetworkProviderFactory logs an error to the log indicating Can't cast the instance of type \"{0}\" to NetworkProvider type", new object[1], which in this case object[1] is null because no provider object was created, and nulls translate to nothing in string format notation hence the empty quotes in the error message. ERROR Sitecore.Social: The network provider is not found for Facebook network. Last but not least, is the SocialLogin.ProcessRequest() method ends up throwing an error (in a try catch) NetworkProvider networkProvider = ExecutingContext.Current.IoC.Get<INetworkProviderFactory>().GetNetworkProvider(authArgs.Application); string name = authArgs.Application.Network.Name; if (networkProvider == null) throw new NetworkProviderNotFoundException(name); Because NetworkProviderNotFoundException() is not listed as one of the Exception classes to catch, it falls into the Exeception catch: catch (Exception ex) { AuthException authException1 = new AuthException(); authException1.DetailedMessage = ex.Message; AuthException authException2 = authException1; ExecutingContext.Current.IoC.Get<ILogManager>().LogMessage(authException2.DetailedMessage, Sitecore.Social.Infrastructure.Logging.LogLevel.Error, (object) this, ex); Guid exceptionKey = new ExceptionManager().Put(new SocialExceptionInfo((ISocialException) authException2)); SocialLogin.RedirectWithError(authArgs, exceptionKey, httpContext); } This is important, because the SocialLogin.RedirectWithError will actually redirect the client browser to the Callback Url with query parameters with state and authError which you are seeing. http://mysite.org/sign-in?state=e0d7a932-9730-4fb2-9d99-50245f235399&amp;authError=29b6cf66-c902-4ee8-91dd-6b89eaf80eff private static void RedirectWithError(AuthArgs authArgs, Guid exceptionKey, HttpContext httpContext) { if (authArgs == null) { httpContext.Response.ContentType = "text/plain"; httpContext.Response.Write(Translate.Text("Session has been expired.")); } else { string str = authArgs.InternalData == null || authArgs.InternalData["UrlReferrer"] == null ? (string) null : authArgs.InternalData["UrlReferrer"].ToString(); string uri = authArgs.CallbackUrl ?? str; if (uri == null) return; UriBuilder uriBuilder = new UriBuilder(uri); SafeDictionary<string> queryString = WebUtil.ParseQueryString(uriBuilder.Query); if (exceptionKey != Guid.Empty) queryString["authError"] = exceptionKey.ToString(); queryString["state"] = authArgs.StateKey.ToString(); uriBuilder.Query = WebUtil.BuildQueryString(queryString, false, false); RedirectUtil.Redirect(uriBuilder.ToString(), httpContext); } } Auth Error Messages Coincidently, any time that the Social Connect encounters an error during this process, it saves the error message to the client browsers HttpContext.Current.Session as a Hashtable of exceptions called socialExceptionCollection, where the key of the exception thrown equal the Guid that is provided in the authError query string parameter. Additional Possibilities In trying to figure how in the world this is occuring, another possibility is that there is an additional config (or multiple configs) laying around in the Include folder that potentially could be interferring with this node. (This is an assumption). Additionally, I would make sure that for some reason, the facebook network config node doesn't show up more than once in the ShowConfig.aspx.
Unable to use Social Login I'm trying to create a Facebook Social Login on my site and followed these steps. Have a Sitecore 8.0 initial release which is upgraded to update 5. The instance name is mysite.org and this is not a live site yet. Created an app in facebook and set the Site URL value as http://mysite.org Ensured that this items exists: /sitecore/system/Social/Networks/Facebook Entered App ID, secret key and selected Facebook as network for this item: /sitecore/system/Social/Applications/Default/Facebook Checked that this item exists: /sitecore/layout/Renderings/Social MVC/Connector/Login with Facebook The controller for this is : Sitecore.Social.Facebook.Client.Mvc.Areas.Social.Controllers.FacebookConnectorController, Sitecore.Social.Facebook.Client.Mvc In the view, rendering the content as: @Html.Sitecore().Rendering("{A58672D4-0B34-41B2-9CCF-5A48C275FD40}") The html is rendered as: <form action="/Social/FacebookConnector/Login" method="post" style="display:inline"> <input id="Parameters" name="Parameters" type="hidden" value=""> <input type="image" title="Login with Facebook" src="/~/media/Images/Social/Connector/Facebook.ashx"> </form> When I click on the facebook icon, the page does a postback and the url changes to: http://mysite.org/sign-in?state=e0d7a932-9730-4fb2-9d99-50245f235399&amp;authError=29b6cf66-c902-4ee8-91dd-6b89eaf80eff In the showConfig.aspx, I can see this: <social patch:source="Sitecore.Social.Facebook.config"> <networks> <network name="Facebook" ItemId="{D7429409-D6DA-46CD-91DD-8702781AE3C4}" prefix="fb" icon="facebook" url="https://www.facebook.com"> <providers> <provider type="Sitecore.Social.Facebook.Networks.Providers.FacebookProvider, Sitecore.Social.Facebook"/> </providers> </network> In the error log I find this: 31228 11:39:08 WARN Could not find type in ReflectionUtil.CreateObject: FacebookNetworkProvider 31228 11:39:08 ERROR Sitecore.Social: Can't cast the instance of type "" to NetworkProvider type 31228 11:39:08 ERROR Sitecore.Social: The network provider is not found for Facebook network. Exception: Sitecore.Social.NetworkProviders.Exceptions.NetworkProviderNotFoundException Message: The network provider is not found for Facebook network. Source: Sitecore.Social.Client at Sitecore.Social.Client.Connector.SocialLogin.ProcessRequest(HttpContext httpContext) There is no call to facebook site in the browser console. I followed the same steps for v8.2 and it worked. What am I missing here.
At this time, you cannot. WFFM is not currently compatible with Sitecore PaaS on Azure. Reference: Sitecore XP on Microsoft Azure Compatibility Table
Setting up WFFM for "Sitecore® Web Experience Manager 8.2" on Azure how to setup Web form for marketers on azure. i have created app services using "Sitecore® Web Experience Manager 8.2" on azure.
Searching Sitecore Data In one of your comments (now removed), you mentioned that the data that you want to search is all in the Sitecore database - implicitly the master database. As such, when you say that you want to attach a "custom data source" I infer that you mean that you want a specific piece of the Sitecore tree to be searched or a special query to be performed. Assuming the above, I believe that what you are looking for are search facets and search filters. If yoou are looking to customize content search within the Sitecore client beyond that, you will likely have to create your own interface. Searching External Data If your data is not stored in Sitecore, then the comments from @AdamSeabridge should put you on the right path. Basically, you will need to create a custom data provider. You can do so with fairly limited effort or a very high amount of effort, depending on your implementation. You can find some pretty good documentation to help get you started, here. Note that if you write a custom data provider, your content authors can search directly within the same content search tab as they would have otherwise, provided that you code your data provider to support content search. In other words, no additional tabs or custom SPEAK applications will be necessary, unless you have additional requirements for them that need to be satisfied. Note that if your data is actually stored in Sitecore then you should avoid writing a custom data provider.
Is it possible to extend the Content Editor search? My website requires that Content Editors have access to a custom Search mode which shows them results based in a format that's not directly available in Sitecore. Is it possible to extend the Search functionality somehow to avoid writing a fully custom Search page? I'm referring to this Search tab:
Choosing a Storage Location If you have a scaled instance of Sitecore or if you want your instance to be extensible and scalable, then you need to avoid storing data in the master database, as CD instances wouldn't have access to it. The web database is also not an option, as you would lose the data on publish. You basically have three options: Add another Sitecore database for storing your form data. This would be a database that both the CM and CD connect to, but not a publishing target. Add an external SQL or NoSQL database that you create yourself. Write custom logic to store your form data in MongoDB, which both the CM and CD connect to. In a situation like the one you are describing, I would typically advise you to go with option 1, and use an extra Sitecore database. This will not violate your Sitecore license in any way, and will likely be the lowest effort solution. This is largely due to the amount of known structure that you have with your data, since it the results from a user poll. Have a look at this answer to a different question on how to store user-generated content (UGC) in a Sitecore solution. In the answer, I break down the various factors that go into choosing where the data should be stored and why. Storage Structure Assuming you went with option 1, above, (if you didn't then that's fine - you can just translate this structure into SQL or NoSQL) then I suggest that you use the structure described below for your data. First, you will need to create an item template to represent the user-poll that it will contain the results of. Next, you will create another item template to represent the data record from a user form submission. My recommendation would be to then have a third template to represent a form field. Based on the fields that are filled out by the user, you could programmatically add all of the fields from the submission to Sitecore, and not have to worry about carrying over changes to the form that are made later. I recommend that you use a bucketing strategy for the records, as this will help you avoid slow-downs when querying, if your polls are to be filled out by a large number of users. You can use content search to access the results of the poll via query, and create a custom reporting tool that displays them.
What is the recommended approach for storing custom data within Sitecore? Our Sitecore project needs to store some custom data (results from a user poll). Is there some sort of a built-in functionality for storing that data on Sitecore sites? The obvious solution is to create a separate custom database, but I'd like to know if Sitecore offers a better approach.
What are the relations? As we briefly discussed in comments; how articles relate can be a very complicated setup. In this instance the assumption will be that of category affinity. So put very simply; the more categories two articles have in common, the more related they are. While a very simplified approach, this is actually a surprisingly good starting point for many scenarios. If the need is, to be more advanced, it would be possible to differentiate the weighting based on super- and sub-categories. For this example, I'll not go into that. The setup Much as per my 2009 blog post listed above (although I am even more lazy with the test data this time around) - I've done a simple Sitecore IA to demonstrate this. Template setup A very simple Article and Category template. Article holds a MultilistField to tag categories. Can be any of Sitecores Multi link field types, I use TreelistEx here. Content Setup Just a few articles. A bit of test code to demonstrate A quick .aspx mockup. Nothing special here. var articlesRoot = Sitecore.Context.Database.GetItem("/sitecore/content/Home/Articles"); var articles = articlesRoot.GetChildren(); foreach (Item article in articles) { Response.Write("<strong>Article: " + article.Paths.FullPath + "</strong><br />"); foreach (var relatedArticle in GetRelatedArticles(article)) { // Do something with these Response.Write(relatedArticle.Paths.FullPath + "<br />"); } Response.Write("<hr />"); } The core of the problem With all of that out of the way; I will demonstrate how to solve this using the built-in Sitecore LinkDatabase. A little known gem, even if I do my best to promote it whenever I can ;-) In short steps; this is how the method GetRelatedArticles operates. Get all referenced categories from the article in question For each of those categories, collect all articles that use the category Record the number of articles count for the category In code, this comes out as: private IEnumerable<Item> GetRelatedArticles(Item article) { // Dirty; no argument checking, no null checking. Just barebones. var referenceCount = new Dictionary<ID,int>(); MultilistField mlf = article.Fields["Article Categories"]; foreach (Item categoryItem in mlf.GetItems()) { var articleLinksInCategory = Globals.LinkDatabase. GetItemReferrers(categoryItem, false). Where(al => al.SourceFieldID == mlf.InnerField.ID); foreach (var articleLink in articleLinksInCategory) { if (articleLink.SourceItemID != article.ID) { if (referenceCount.ContainsKey(articleLink.SourceItemID)) referenceCount[articleLink.SourceItemID]++; else referenceCount[articleLink.SourceItemID] = 1; } } } The code then continues to: Build up a list of all the referenced articles, along with their count Comes out like this: var articlesWithCount = new List<Tuple<ID,int>>(); foreach (var articleReference in referenceCount.Keys) { articlesWithCount.Add( new Tuple<ID, int>(articleReference, referenceCount[articleReference]) ); } Sort the articles, so the most relevant comes out top Like this: articlesWithCount.Sort((x, y) => y.Item2.CompareTo(x.Item2)); And finally, return just the Item part of the Tuple List. return articlesWithCount.ConvertAll(i => article.Database.GetItem(i.Item1)); } For the copy/pastyness, here is the method in its completeness: private IEnumerable<Item> GetRelatedArticles(Item article) { // Dirty; no argument checking, no null checking. Just barebones. var referenceCount = new Dictionary<ID,int>(); MultilistField mlf = article.Fields["Article Categories"]; foreach (Item categoryItem in mlf.GetItems()) { var articleLinksInCategory = Globals.LinkDatabase. GetItemReferrers(categoryItem, false). Where(al => al.SourceFieldID == mlf.InnerField.ID); foreach (var articleLink in articleLinksInCategory) { if (articleLink.SourceItemID != article.ID) { if (referenceCount.ContainsKey(articleLink.SourceItemID)) referenceCount[articleLink.SourceItemID]++; else referenceCount[articleLink.SourceItemID] = 1; } } } var articlesWithCount = new List<Tuple<ID,int>>(); foreach (var articleReference in referenceCount.Keys) { articlesWithCount.Add( new Tuple<ID, int>(articleReference, referenceCount[articleReference]) ); } articlesWithCount.Sort((x, y) => y.Item2.CompareTo(x.Item2)); return articlesWithCount.ConvertAll(i => article.Database.GetItem(i.Item1)); } And if you only need 10 article references, a bit of late night lazy LINQ solves that too. The less items you resolve in this method, the better it performs. return articlesWithCount.Take(10).ToList().ConvertAll(i => article.Database.GetItem(i.Item1)); Performance? It really is very good. While I did no measurements in this specific test, I have previously tested LinkDatabase performance and it continues to come up very high. If you reach the breaking point of this; the next step is to implement this via Sitecore ContentSearch. Has a larger setup footprint but will scale you into the 100s of 1000s of articles in as many categories.
How can I show a list of related/similar pages? Our website needs to show a list of related questions, very much in the same way as it works on StackExchange: Is there some sort of built-in functionality to achieve this? What about existing Marketplace components?
No, there is not. mediaProvider definition in Sitecore is limited to <mediaProvider type="Sitecore.Resources.Media.MediaProvider, Sitecore.Kernel" /> while LinkProvider definition contains lot of properties which are used as default options: <add name="sitecore" type="Sitecore.Links.LinkProvider, Sitecore.Kernel" addAspxExtension="false" alwaysIncludeServerUrl="false" encodeNames="true" languageEmbedding="asNeeded" languageLocation="filePath" lowercaseUrls="false" shortenUrls="true" useDisplayName="false" /> That's why Sitecore uses MediaUrlOptions.Empty when options are not specified: public virtual string GetMediaUrl(MediaItem item) { return this.GetMediaUrl(item, MediaUrlOptions.Empty); } public virtual string GetMediaUrl(MediaItem item, MediaUrlOptions options) { ... }
Is there a GetDefaultMediaUrlOptions function? Does Sitecore (7.2+) have something like Sitecore.Links.LinkManager.GetDefaultUrlOptions() except for media URLs? We have a library of extension methods off of Item to make things easier and it looks like when that was created over a year ago I ended up just using new Sitecore.Resources.Media.MediaUrlOptions(). My searches aren't turning up anything, so I'd like to know if I'm just missing something or if that's the solution. Thanks!
Background information During dispatch, all links are replaced with a link to /sitecore/RedirectUrlPage.aspx with additional query string parameters such as contact id and message id. RedirectUrlPage.aspx runs the redirectUrl pipeline, which is responsible for several things, e.g. adding click events based on the query string parameters. After running the pipeline, it will redirect you to the actual link e.g. /sitecore/unsubscribe.aspx. The link to redirect to is set in the redirectUrl/SetRedirectToUrl pipeline processor. Now, because some links require the query string parameters, those query string parameters needs to be passed along from RedirectUrlPage.aspx to the next page. The redirectUrl/SetRedirectToUrl pipeline processor does this using the internalCarryoverFields configuration of the processor, e.g.: <internalCarryoverFields hint="list:AddInternalCarryoverField"> <carryoverField type="Sitecore.EmailCampaign.Cd.Pipelines.RedirectUrl.CarryoverField, Sitecore.EmailCampaign.Cd"> <param desc="fieldKey" value="mid" /> <param desc="urlPattern">.*Unsubscribe.aspx</param> </carryoverField> </internalCarryoverFields> The fieldKey being the query string parameter, and the urlPattern the url pattern where the fieldKey should be passed to. In this case we're telling that the query string parameter "mid" should be passed on to any internal urls matching the .*Unsubscribe.aspx pattern. So, to reiterate: Link in email: <a href="http://www.yourdomain.com/Unsubscribe.aspx">Unsubscribe</a> Is transformed by EXM into: <a href="http://www.yourdomain.com/RedirectUrlPage.aspx?eq=encryptedquerystring">Unsubscribe</a> Contact clicks the link and RedirectUrlPage redirects you to: http://www.yourdomain.com/Unsubscribe.aspx?mid=value Problem and solution The urlPattern matching is case-sensitive, so you need to either change your links to Unsubscribe.aspx (with capital U), or add the lower-case variation to your configuration (Sitecore.EmailExperience.ContentDelivery.config). This bug is fixed in the next EXM release.
In EXM 3.3 why does the link to Unsubscribe.aspx return a 404? We have a Sitecore 8.1-3 / EXM 3.3 production instance. We have sent out a test email blast. In the footer of the email is a link to /sitecore/unsubscribe.aspx. I notice that when the email actually gets sent out by EXM that the actual url in the unsubscribe link gets changed to /sitecore/redirecturlpage.aspx?ec_eq=blahblahblah... However after looking in the IIS logs what I see is that when the user clicks on the Unsubscribe link it generates a 302 redirect to /sitecore/unsubscribe.aspx. And this request generates a 404 error. However I have looked on our CD servers and that file is definitely there. I can not figure out why the request for /sitecore/unsubscribe.aspx is generating a 404 error. Any ideas? Corey
You can set context language using Syntax: #get language to be switched $lan = [Sitecore.Globalization.Language]::Parse("$switchLanguage") #Set Context language, use 'ispersistent' parameter based on your requirement.in my case it should be for a while i.e. creation of master content. [Sitecore.Context]::SetLanguage( $lan,$false) Below is one of the PS script used in one of my project. :) Snapshot: Actual Script: $defaultContextLang = [Sitecore.Context]::Language.Name Write-Host "Default context language is '$defaultContextLang'" $switchLanguage = "en-US" $lan = [Sitecore.Globalization.Language]::Parse("$switchLanguage") [Sitecore.Context]::SetLanguage( $lan,$false) $switchedContextLang = [Sitecore.Context]::Language.Name Write-Host "Switched context language is '$switchedContextLang'"
Set Powershell script language I would like to know if there's a way to set the current script's context language through code. I know there's a way to set it in the ISE but I need some code that could override it and force a specific script to always run in a certain language. Something like this: $Context.Language = [Sitecore.Data.Managers.LanguageManager]::GetLanguage("nl")
A colleague worked this out, by wrapping a SecurityDisabler using statement around the foreach loop of the content we wanted to retrieve in the view.
Using SecurityDisabler with Glass Mapper GlassView We have content that we want to display that is in an area of the site secured from anonymous access. The idea is to show a group of pictures with a link to the content, and if you click it and aren't authenticated, you're bounced to the login page. The catch is, if you aren't logged in, you can't even see that content. Using the SecurityDisabler is an easy solution, but we want that content to be editable in experience editor as well. We usually use GlassView over the controller rendering, so perhaps one solution is to fill the model via a controller rendering and wrap the get call in SecurityDisabler. What I was wondering if there was a way using GlassView to call the model with SecurityDisabler functionality in it, a switch or option in the model setup perhaps.
The EventQueue - the medium of communication between your Sitecore instances - is timestamp-based, which can lead to issues if you are using replication and something happened that caused your SQL instance to re-initialize/failover or if the EventQueue's last processed timestamp becomes corrupted. In order to ensure that this is not the issue, connect to each of your databases (you could do this just for Web, but if it affects one it likely affects all of them) and execute the following SQL commands (order matters; see below for details): DELETE FROM [EventQueue]; --optionally, you can change this command to delete older than a certain date instead DELETE FROM [Properties] WHERE [Key] LIKE 'EQStamp_%'; What did I just do? Cleared the EventQueues It is safe to clear the EventQueues for your databases, and often times this will result in a performance boost - sometimes noticeable; other times not. When these tables become too large, Sitecore often has trouble processing them, hence why Sitecore includes Cleanup Agents for the EventQueues to delete old records. Basically, all you are doing here is resetting the stage and giving your environment a "clean slate" as far as events queuing is concerned. Side-note about the Cleanup Agents: since the agents run on a relatively long default interval, the EventsQueue can get very large on a bigger site. Additionally, since agents can be troublesome when longer intervals are used (reference the section "The Problem with Agents" in this post), I typically create Windows Scheduled tasks to regularly clean out the EventQueues for larger sites, due to the greater reliability of the scheduling. Cleared the Reported Times the EventQueues were Last Processed Sitecore stores the value that represents the last time a database's EventQueue was processed in the Properties table. The Key for this value is EQStamp_<MachineName>-<IISAppPoolName>. By deleting all values from the Properties table with a Key that starts with the value 'EQStamp_' (via the % wildcard and the LIKE operator), you are essentially "resetting" the last recorded time the EventQueues were processed to "never." As such, the next time Sitecore goes to process the EventQueue for that database it will see any records in the EventQueue table as new events, and will thus begin to process them. As such, it is important that you clear your EventQueues before doing this step. If you do not, your instances will see all of the records in the EventQueue table, including those already and not yet processed - as new events and will begin to process them all. If you have a large amount of records in your EventQueue this can take a very long time, so be sure that your EventQueue is cleared before you clear the last processed timestamp. Why did I do that thing I just did? Database-Relative Time and the Last Processed Time The EventQueue uses the recorded last processed time for determining which events are new, so as to retrieve them for processing. In order to retrieve new events for processing, Sitecore requests all events from the EventQueue that are newer than the last-processed event, as determined by comparing the timestamp values. The way that the EventQueue's last processed time is recorded is by creating a a copy of the [EventQueue].[Stamp] column value of the last processed event. The [EventQueue].[Stamp] column is of the timestamp type (deprecated since SQL 2008), and its value is copied to the Properties table as a string (stored in an ntext type column). The newly created record in the Properties table is the one that we cleared out, with the Key column value of EQStamp_<MachineName>-<IISAppPoolName>. The timestamp type stores a database-relative time that is computed by incrementing an 8-byte binary counter on each INSERT or UPDATE operation. According to MSDN: Each database has a counter that is incremented for each insert or update operation that is performed on a table that contains a rowversion column within the database. This counter is the database rowversion. This tracks a relative time within a database, not an actual time that can be associated with a clock Essentially, what this means is that when the SQL instance re-initializes it's basically starting out with a fresh database-relative timestamp, meaning that any newly generated timestamp values will be starting from 0. More accurately, the timestamp values will be starting from the point at which the replication started. Here's where this gets to be a problem: assume that when the replication started, the last processed timestamp was 601283 (which is a number I took from a random web database's Properties table in my local SQL instance). Time passes and the last processed timestamp of the SQL instance being used, SQL A, grows to 1301283. At that point, something happens and SQL A is replaced with the replication set, SQL B. The problem is that SQL B's timestamp value is still 601283 (the value from immediately before replication started), but because SQL B was a replication set its Properties table has the last processed time recorded as 1301283 (the value the timestamp on SQL A grew to, before SQL B took over). As a result, new events are created in SQL B with timestamp values 601288, 601313, 601337, ... and so on (note that these are just examples) meanwhile Sitecore is only requesting events with a timestamp value greater than 1301283. What this means is that the database now thinks that the new events have already been processed, because compared to the recorded last processed timestamp, 1301283, the new events' timestamp values, e.g. 601288, are in the past! This means that new events are effectively ignored by Sitecore. It should be noted that left unfixed the timestamp value should eventually catch up to the last processed value stored in the Properties table. The amount of time this takes depends on how long your replication has been running. For some instances, this issue might not be that big of a problem, e.g. if your replication has only been running for a few hours, a few days, or sometimes even longer, depending on how heavily the instance is being used and changes are being made. However, if your replication has been running long enough then it could take weeks, months or even years for the timestamp value to catch up. To sum it all up, this problem can be remedied by simply deleting the EventQueue's recorded last processed time from the Properties table, so as to reset the value that Sitecore assumes a "new" event's Stamp column value must be greater than. Corruption of the Last Processed Time While not super likely, it is also possible for the EventQueue's recorded last processed time to become corrupted. This can happen as a result of changes in SQL infrastructure, backups/restores, etc. If any of these scenarios may be relevant, this solution is very low effort and low risk. In general, it pays to execute the queries, specified above, to be safe and eliminate these issues as a possibility. Credit Much of the credit for the explanation of why this solution works is due to Per Manniche Bering and his post, Sitecore CD nodes not picking up events after replication re-initialization. I must also give him credit for finding and highlighting (which I matched via emboldening) the excerpt from MSDN that I quoted above, which I found to be of great help in fully understanding the issue (ergo, why I repeated it, here).
Sitecore 7.2 Not rebuilding Lucene Index We're using Sitecore 7.2 Update 4, and have 6 Lucene indexes across our sites in a single Sitecore instance. In the production environment, but not locally or on staging, the web index is not rebuilt when an item is published and we need to rebuild the index manually. Both staging and production use separate content authoring and delivery servers with the web index rebuild on publish being initiated on Staging but not in Production. Apparently there has been a recent backup of databases from Prod to Staging so there shouldnt be significant differences there. Indexing Strategy on CD: SwitchOnRebuildLuceneIndex <strategies hint="list:AddStrategy"> <strategy ref="contentSearch/indexUpdateStrategies/onPublishEndAsync"/> <strategy ref="contentSearch/indexUpdateStrategies/rebuildAfterFullPublish"/> <strategy ref="contentSearch/indexUpdateStrategies/remoteRebuild"/> </strategies> And on CM: <strategies hint="list:AddStrategy"> <strategy ref="contentSearch/indexUpdateStrategies/syncMaster" /> </strategies> Errors in Sitecore logs: none All the conifuration settings in ScalabilitySettings.config exist in the web.config. Although InstanceNames are blank, they are recorded in the EventQueue table successfully using the default format of MachineName-IISSiteName. EnableEventQueues is set to true in web.config. Im seeing ItemSavedRemote events in the EventQueue in the web db but IndexingStartedEvent is never recorded in the core db.. That seems to be the problem but not sure why the IndexingStartedEvent is not fired. We have had someone out from Sitecore and they have told us the configs look good. Any suggestions as what may be causing the issue? UPDATE 3/4/17 - Apparently this has started working again in Prod. When an article is published, the index is rebuilt and display on the website. To me, this is still an open issue as we dont know what caused this issue and it may break again - it has started working again once before and then stopped after a couple of months with no code/config changes. Suggestions as to what that might tell us?
At a high-level, your logic is sound, so my recommendation would be to do the following in order to troubleshoot your issue: Step 1: Verify xDB and Visitor Tracking In order to troubleshoot this issue, the first thing that you should do is make sure that you have xDB enabled, configured correctly and that your visitor tracking/visitor identification code is present. This post is a good checklist for this step. Step 2: Verify Visitor Identification Logic Before continuing with this troubleshooting step, make sure that you have a clear understanding of what it means to identify a visitor and what the difference is between a contact and a user. If you do, skip the below sections and ask yourself "Did I actually identify my users as contacts?" If you don't, read the below and then ask yourself the same question. Visitor A visitor is anyone (human) or anything (robot) that visits the site. It doesn't matter if the visitor is a human who has been to the site 1000 times and has registered their profile - it's still a visitor. Contact According to Sitecore's documentation, a contact is defined as the following: A contact represents an individual who interacts with or may potentially interact with your organization. The contact, or contact entity, contains all the information that you collect about an individual from their interactions across channels, devices and websites. Basically, a contact is a collection of a visitor's interaction history and any interaction data collected from said visitor. It is important to understand that while a contact "represents an individual" the visitor actually is the individual so the contact represents the visitor. A contact is analogous to a dossier and is essentially a group of everything you know about the visitor, based on the the way that they have interacted with the site. Sitecore tracks all contacts and merges them if/when a contact is identified as an existing contact. All visitors start out as "unidentified contacts" and remain that way until they provide enough information to be identified as an existing contact. User A user, in this case (i.e. this is a concept - not in reference to Sitecore Users specifically), is a visitor to the site who has or has not registered an account and is or is not logged into the site. An authenticated user has registered an account on the site and is currently logged in. An unauthenticated user may or may not have registered an account on the site but they are currently not logged in. User Profile A user profile, in this case (i.e. this is a concept - not in reference to Sitecore User Profiles, specifically), is to an authenticated user similar to what a contact is to a visitor. A contact is the collection of data that we have recorded about a visitor, while a user profile is a collection of data that we have recorded about an authenticated user, e.g. username, name, birthday, email address, etc. Visitor vs Contact vs User vs User Profile Visitors and our conceptual users are both entities that come to or interact with the website. An individual browsing a site is both a visitor - identified or unidentified - and a user - authenticated or unauthenticated. The key difference is that visitors are completely authentication-agnostic. Contacts and our conceptual user profiles are both records or data about an entity. Contacts contain all interaction data collected from a visitor while a user profile has all data that the user has saved or the site's logic has recorded for a user behind the scenes. There are two key differences between contacts and user profiles: Contacts leverage visitors whereas user profiles leverage authenticated users as the sources of their information. Sometimes these sources overlap, e.g. when an user registers and provides their full name and email this information is saved in their user profile but the interaction can also be coded to be stored in their contact Contacts record data for visitors whether they are identified or unidentified, regardless of whether or not the visitor is also an authenticated or unauthenticated user Understanding Contact Identification When we talk about identifying contacts with Sitecore, what we mean is that we need to specify - with code - what information can be used to uniquely identify a contact. This could be any string, e.g. phone number, email, username, etc. Why Should I Identify Contacts? Imagine that on your site you don't identify contacts. When Person A browses to the site, he/she becomes an unidentified visitor. This visitor interacts with the site, the interactions are tracked, the collected data is stored as a contact, and the experience is personalized. Then the visitor leaves. Assume now that Person A browses back to the site a week later. Since the site doesn't identify contacts, the site now knows nothing about the visitor and all of the information collected during the previous visit is effectively gone (it's still available in analytics, but it doesn't do anything to help us tailor or analyze the experience/interactions of the visitor on this repeat visit. Contact Tracking and Identification by Analogy If you are new to contact identification or aren't entirely certain that you understand what it is, how it works or why, then the analogy below should be sufficient to get you going. Otherwise, move onto the section "How to Identify Contacts in Sitecore". The process of identifying and tracking contacts is analogous to making an appointment at the doctor's office and giving them all of your information but giving them your name, phone number and birthday last. In this analogy, you are the visitor and even though the staff has not yet been given your identifying information - in this case, your name, phone number and birthday - they still record all of your information so they have it while you're there. This "record" would be the "contact". If you were to leave the doctor's office before giving them your name, phone number and birthday then they will not have had any way to identify you. Assuming you did not give them your identifying information and you return a week later, even if you give your identifying information to the staff first they will not be able to look up the information you gave on your last visit because you did not identify at that time. However, as soon as you give them your identifying information your record will be an "identified contact" and any subsequent visitors who give the exact same identifying information will be recognized and identified as you. In this analogy, you can think of the act of identifying contacts as analogous to specifying which pieces of information should be considered "identifying information" (in the analogy, this would have been the patient's name, phone number and birthday). How to Identify Contacts in Sitecore The first thing to know about contact identification is that Sitecore identifies every contact as unique (i.e. as a new contact) by default. Identifying a contact as a visitor who has previously interacted with the site and has an existing contact record - even in the case of a user who logs in using Sitecore membership - must be wired up by the developer as an additional, though fairly low-effort - step. The second thing to know about contact identification is that, as stated above, any string can be used to identify a contact, so it is important to pick a value that you know will be unique to each visitor and available on return visits (either via form submission, authentication, etc.). We will refer to this value as the identifier. To identify a contact, you would make this method call in your code: Sitecore.Analytics.Tracker.Current.Session.Identify(identifier) Most frequently, I find myself recommending that email addresses be used as identifiers, as email addresses can be provided to the site regardless of authentication state, e.g. contact form submissions, newsletter sign-ups, etc. In contrast, if "username" were to be used then only authenticated users would have their own contacts and unauthenticated users could either be identified as a single contact - thus skewing the data - or not at all. I prefer to identify as many unauthenticated users as possible to get create the best possible experience for as many visitors as I can, which is why I try to use a value that both authenticated and unauthenticated users would have. For additional resources related to how to identify contacts, see this blog post, and the official Sitecore documentation. Understanding How Sitecore Merges Identified Contacts When a contact is identified, Sitecore looks to see if the identifier has been used for a contact that has already been stored. In other words, Sitecore says to itself something like "Haven't I met this visitor before? Let me try to remember..." If Sitecore finds a stored contact with the same identifier then Sitecore merges any newly tracked contact data with the old data (preference given to the new data), and updates the existing contact when the session ends. Step 3: Reach Out to Sitecore Support If none of the above apply to you, my recommendation is that you reach out to Sitecore support. They should be able to help you further diagnose why your contact identification isn't working as expected.
Engagement value points condition not working in SXA personalization I am using personalization in Sitecore 8.2 SXA. I am using the engagement value point condition so that when the number of points reach certain number, the user is shown another content. But it is not working properly. UPDATE: Issue Details I have a WFFM form on a page. After submitting that form, the user is redirected to the page where I have applied personalization on a component. The personalization rules for the component are set up with the following logic: when a user submits the form, if the engagement value points are greater than 20, then he/she is shown another content The problem is that when I try to use the credentials of a user who has more than 20 points, it shows the default content. Does anyone know if there is something that I am missing, here?
To answer your first question, yes, it is absolutely possible that the server fulfilling the Processing role is occupied leading to processing taking a back-seat. Having said that, 10 days is quite a long time so we first have to rule out that something else isn't at play. I would also hazard to say that it is highly unlikely that a single aggregation is taking a whole 10 days to run, so I think we can backlog that possibility for the moment. Infrastructure and Recent Changes Before doing any major troubleshooting, be sure to cover the low-effort basic questions that could help identify/explain/resolve your issue: Have there been any recent changes to infrastructure? Adding additional CDs, a dedicated Reporting server (N/A to you, based on your comments), a dedicated Processing server (also N/A to you for the same reason), changing or replacing your CM (atypical cause, but possible if scalability settings aren't identical) could all result in a desynchronization of the Collections (MongoDB) and Reporting (SQL) databases Have you performed one or more of the actions listed below in the "Reasons for Rebuilding the Reporting Database" section that are cause to rebuild the reporting database? If any of the reasons do apply to you, it is possible that the delay is due to the Collections (MongoDB) and Reporting (SQL) databases being out of sync. Have you added any new processors for Tracking, Reporting or Processing or made any recent changes to the processing agents? Such changes could have bugs that may be resulting in the delayed aggregation. Has the performance of your CM been consistently slow, to the point where the CPU and/or RAM are maxing out on a regular basis? This could result in a general slow-down of your CM, which could cause numerous side-effects, including but not limited to a significantly slowdown in aggregation and scheduled agent execution. Have you seen any errors in your logs related to processing, aggregation, reporting, tracking, the scheduler, agents (general; non-specific unless it's the aggregation agent), or your MongoDB connection? Such errors could indicate a breakdown that could propagate and affect aggregation or prevent aggregation from running in its entirety. Have you reviewed your Collections (MongoDB) database to ensure that your instances are historically and currently getting the correct amount of throughput, aren't maxing out on resources (CPU/RAM), and aren't maxing out on connections? Such issues could result in issues retrieving data to be aggregated, thus causing the delay but explaining why the data does eventually appear. Reasons for Rebuilding the Reporting Database Per Sitecore's documentation, you should rebuild the reporting database if any of the following apply to you. If any of these do apply to you, it is possible that the delay is due to the Collections (MongoDB) and Reporting (SQL) databases being out of sync: You have used the conversion tool to populate the reporting database with analytics data from an earlier version of Sitecore. You have made changes to the collection database – a rebuild is necessary to reflect the changes in reports that use older data. For example, if you have changed the channel associated with one of your referring sites. You have reclassified reporting data – In Experience Analytics and other Sitecore reporting applications it is possible to reclassify data that has already been processed by the aggregation layer. For example, if you have reclassified a search key word or channel, aggregated report data is not automatically updated. This can cause the reporting database to become out of sync with the collection database. Your databases are out of sync – if the reporting database has been lost or has become out of sync with the collection database, for example, due to a disaster or if contacts have been merged. The accuracy of the reporting database can decrease over time as more contacts are merged and more interactions are imported. How often you need to rebuild the reporting database depends on your system architecture and the amount of merges and imports you need to process. Understanding Analytics Processing Before we dive into lower-level troubleshooting (e.g. config audits, hardware changes, new instance setup, etc.) let's make sure that we have all of our ducks in a row as far as understanding how processing works and what it does, at a high level (adapted from Sitecore's docs): Visitor interactions are saved to the collections database (MongoDB) on Session_End "Collected" interaction data is added to the processing pool in order to "queue" it up for aggregation (processing) A processing agent running on Sitecore's scheduler runs, checks the processing pool for new interactions, then passes the "queued" interactions to the aggregator for processing The aggregator runs the aggregation pipeline over the interactions, which converts (groups, condenses, etc.) the data into a form suitable for the SQL Reporting Database The converted data is then merged into the existing reporting data stored in the SQL Reporting Database Troubleshooting "Scheduled" Processing From the symptoms that you described in the OP, it sounds like processing works when it actually runs, but the problem is that it isn't being told to run often enough. The key piece in the processing flow (as described above) to consider then is how processing is actually kicked off. Recall that Sitecore relies on a scheduled agent to kick off processing, which can result in processing not running, if the agent's scheduled interval is too large. The Problem with Agents Remember that all agents run on Sitecore's scheduler and that the greatest pitfall of Sitecore's schedule is that it's interval-based and not date-time-based. In other words, when you configure an agent, you have to set an interval at which the agent should run (e.g. "run every 30 minutes"), as there is no support for setting a specific date-time when you want the agent to run (e.g. "run at 3:05 PM every Tuesday"). The fact that Sitecore's agents cannot be set to run at a specific time presents a durability risk for any feature/code/logic/etc. that is dependent on an agent to run. To help understand this risk, consider the following situation: One has an agent that should run once per every 24 hour period (i.e. 24-hour interval). Assuming that the application was started at 7:00 AM, one would expect that the agent will run shortly after 7:00 AM (or a little later, depending) the next day. However, at 2:00 AM the application pool recycled (could be a crash, could have been scheduled, ... doesn't matter). Assuming that one is aware that the app pool recycle occurred, one must now expect that the agent in question will run shortly after 2:00 AM (or a little later, depending) the following day. The situation above describes the start of how an infinite (or near-infinite) "delay" of an agent's execution can occur as a result of Sitecore's scheduler not supporting the scheduling of agents to run at a specific date-time. Were one to be able to schedule an agent for a specific date time, the agent in question would have run at 7:00 PM both the first and second day. However, with the interval scheduling, the agent did not run the first day, will not run the second day, and may not run the third day either, if there is another app pool recycle before the interval has elapsed. Troubleshooting the Agent First, have a look at your Sitecore and IIS logs and try to find if/when the app pool recycled over the previous two weeks. The app pool recycling could indicate a reason why the agent might not run, but it doesn't eliminate the agent not running as a possibility if a recycle never occurred. Next, open up your configs and have a look at your processing agents. Make sure that they are configured and that they are set to run at a relatively short interval (I believe the OOTB setting is 15 seconds). If it is not set to the OOTB setting or a relatively low setting then do the following: Set the interval to a lower setting and test. Note that setting the interval too high can result in the agent never running, while setting it too low can cause collisions between agent executions (just unnecessary overhead, as Sitecore shouldn't run the agent more than once at a time) or too many requests (not super likely with batch aggregation, but it could happen) to the collections DB (MongoDB) or the reporting DB (SQL). Check the MaxThreads setting and ensure that your processing agents are neither using too many or too few threads (this shouldn't be your issue, since it looks like the problem is that aggregation isn't being started often enough, not that it is running too slowly) Replace your agent's type with a custom inheriting type and have the custom type log a message whenever it runs. This way, you will know exactly when the agent runs without affecting the actual functionality. Remove any custom processors from the processing/aggregation pipelines and retest each of the above If your agent is running (you see a message in the logs) but you still don't see any data from the last 10 days (after waiting about 30 minutes or so) then move onto the "Other Troubleshooting Steps" section. If your agent is not running, then you now know what you need to debug, and you can either post another question here or in Sitecore Community Slack for additional support, as needed. Other Troubleshooting Steps If your agent is running and you still don't see any data from the last 10 days, then the next thing you should do is troubleshoot the actual processing of the data. Audit your CM's Sitecore configuration. Pull down a fresh copy of the Config Enable/Disable Excel spreadsheet from Sitecore's docs and ensure that your CM (based on the infrastructure you mentioned: 1 CM, 6 CD, no dedicated processing or reporting) has all of the necessary configs enabled for CM + Processing. This is because your CM is fulfilling the CM and Processing roles. To that end, you may want to also want to verify that the necessary Reporting configs are enabled, as your CM also fulfills the Reporting role. While it is possible that a bug with your reporting configuration could be causing this issue, it is less likely, unless recent changes have been made to your infrastructure or reporting Failing any new discoveries from step 1, proceed with troubleshooting the remainder of the processing flow, as described in "Troubleshooting the Processing Pipeline" section, below. Backup both your collections (MongoDB) and reporting (SQL) databases and then execute history processing (aka rebuild the reporting database). This should help bring your Collections DB and Reporting DB back into sync, if something caused them to lose sync. Reach out to Sitecore Support if none of the above worked Troubleshooting the Processing Pipeline Remove/disable any custom aggregation processors that you may have Add a custom processor to the top of your aggregation pipeline, and see if it gets called. As before you can do this by logging a message - this time also indicating whether or not the pipeline is aborted. If the processor you added is called and the pipeline is not aborted, then move the process to the end of the pipeline. If your processor still gets called and the pipeline isn't aborted then your aggregator may either have a problem with getting the data from collections (MongoDB) or something else could be at play. At this point, I would reach out to Sitecore support for further assistance. Vertical/Horizontal Scaling and Processing Performance Tuning If after troubleshooting the issue, you conclude that you need to improve the performance of your processing engine, then you can do so by tuning the Batch Aggregator, tuning the aggregation agent, vertically scaling your environment or any subset of the three. Tuning the Batch Aggregator When tuning the Batch Aggregator, you have three options: Tune the Batch Aggregation Agent (docs) Tune the Aggregator (docs) Tune both The docs do a pretty good job of describing how to tune each. Note that tuning the Batch Aggregator is all about controlling how much you are going to aggregate in a given thread, and how much data you plan to actually save to the Reporting Database (SQL) at a given time. Tuning the Aggregation Agent You can customize the performance of your aggregation agents by configuring the number of agents (threads) and the maximum pool size of your agents, following Sitecore's documentation which is pretty descriptive. Vertical Scaling The next thing you can try is vertically scaling your environment. Vertical Scaling is when you add more hardware resources (CPU/RAM) to your individual Sitecore instances in order to improve their performance. Vertical Scaling does incur additional hosting costs for the client, but these costs are typically fairly limited as compared to Horizontal Scaling (see then next section). In your case, if you were to vertically scale your environment to help resolve the issue, then you may consider increasing the CPU/RAM on your CM server, as well as beefing up your MongoDB (more CPU/RAM, load-balancing, etc.) and your SQL instance, as needed. Horizontal Scaling Lastly, you can always add more horizontal scaling to your environment. When working with a production site, unless the client has an extra Sitecore license that they aren't using, this is typically my last resort, as it brings a recurring licensing cost to the client. Horizontal Scaling is when you add additional Sitecore instances to perform dedicated jobs, in order to increase overall environmental performance or performance. When you split a Sitecore environment into a Content Management (CM) instance and a Content Delivery (CD) instance, you are vertically scaling the environment. In your case, you would be looking to set up either a dedicated Processing server. In doing so, you would disable Processing on your CM thus improving the performance of your CM instance. You would then add an additional instance to your environment that serves the Processing role and only the processing role, thus significantly improving the performance of processing on that instance and consequently the processing performance of the whole environment.
Analytics Dashboard has a 10 day delay and updates only gradually Our production environment has a pretty much standard analytics configuration. MongoDb gets filled up as expected and collected data is up to date. But the Analytics dashboard in Sitecore is not up to date. It shows data with a 10 day delay, so no interactions from 10 days ago till now but correct data before that. Also in the last 6 hours the visits bar of the last processed day grew around 25000 visits. So it seems that the processing service is kinda working correctly but is fully occupied and can't process any faster. Is that possible? Are there any configs we can tweak or is only more hardware doing the trick? Or maybe even outsourcing the reporting service to a dedicated server?
James, this sure does sound achievable. If I may, I'll write some pseudo code while I'm away from my development machine. Here is how I might approach it: Get a list of ORG items. For each of the ORG items, get the IDs from the multilist field and get each of those items. Consider using a hashtable where the key is the ID of the Country and the value is the item. For each of the ORG items, get the property you need. Consider using a hashtable where the key is the ID of the ORG and the value is the propery. Consider creating a new array of objects using [PSCustomObject]@{"Key"="Value"}. Here you can loop over the ORG items again to build your custom object. Pass the report objects to Show-ListView. Update with Example I wrote this for a case where we have insurance providers and associate them with states. $insuranceGroups = Get-ChildItem -Path "master:" -ID "{DF58A0D1-5CB7-4D4D-8F6C-D3A3B68218E7}" $stateLookup = @{} $reportItems = @() foreach($insuranceGroup in $insuranceGroups) { $insurancePayers = Get-ChildItem -Path "master:" -ID $insuranceGroup.ID foreach($insurancePayer in $insurancePayers) { $stateIds = [Sitecore.Data.ID]::ParseArray($insurancePayer.InsuredStates) foreach($stateId in $stateIds | ForEach-Object { $_.ToString() }) { $stateName = "" if(!$stateLookup.ContainsKey($stateId)) { $stateItem = Get-Item -Path "master:" -ID $stateId $stateLookup[$stateId] = $stateItem $stateName = $stateItem.StateName } else { $stateItem = $stateLookup[$stateId] $stateName = $stateItem.StateName } $reportItem = [PSCustomObject]@{ "PayerName"=$insurancePayer.Name "PayerTitle"=$insurancePayer.Title "StateName"=$stateName } $reportItems += $reportItem } } } $reportItems | Show-ListView
How to get list view of items plus their linked items in powershell-extensions? I have a list of items /{path}/ORG[1-n] which each use a multilist field "Countries" to link to multiple country items. This is a many to many relationship. ORG1 and ORG2 may both link to Country1. I want to generate a list view (for Excel export) of each ORG-Country relation, with some addition properties for each ORG. In SQL this would be a left join. E.G. ORG - Property1 - Country ORG1 - Property1.Value - Country1 ORG1 - Property1.Value - Country2 ORG2 - Property1.Value - Country1 ORG2 - Property1.Value - Country3 Is there a simple way to build this report up - if I use a For Each then I want to be adding a new entry to the report each time like $ReportList += $ReportLine I'm unsure of the syntax for this, or if there is a simpler way of doing it. I've previously used a property object to extend the report info from a selection of items: $Items = Get-Item....... $property @( @{Name="Property1";Expression={$PSItem.Property1}} @{Name="Property2";Expression={... query based on a field of $PSItem...}} ..... ) $Items | Select-Object $property | Show-ListView I can't see how to use this with the ORG items in the initial query needing to be reported once for each country they contain.
This problem was related to some jquery function, in the header html, a section has id=”header” and some jquery functions are based on this id in a custom jquery file “jquery.layout.js”.Our placeholder key and the id jquery using was same so updated the id for the section in both html and js to resolve the problem. I have write a blog for this problem and provided some suggestion for creating placeholder key based on the discussion with Sitecore Support - https://sitecorexpblog.wordpress.com/2017/06/12/resolve-xhtml-markup-is-incorrect-near-placeholder-header-error-only-for-header-key/ Thanks Everyone for your support.
XHTML markup is incorrect near placeholder "header" Error, only for "header" key We are facing a weird issue in experience editor, where we are getting following error - XHTML markup is incorrect near placeholder "header". For more information about this issue refer to Sitecore Knowledge base article https://kb.sitecore.net/articles/365101. I know this error message shows when there some XHTML validation problem. But In our case its not related to XHTML validation. The weird thing here is that if I change my placeholder key "header" (i.e. - "Header" or "header1") and update the presentation details, it resolve the problem. Don't konw what is problem with "header" placeholder key. here the code we are using on layout - @Html.Sitecore().Placeholder("header") We are using Sitecore version - 8.2 update 2
Your Indexing has stopped &amp; log entries are triggered from 'StopIndexing' method as shown. Some Info: Check your Sitecore context log file has entries like 'WARN Sitecore shutting down'.This might interrupt the indexing process. For More info please follow this link
What does the "WARN: Crawling Stopped" warning mean? Why do my logs fill up with warnings about Crawling Stopped? Is this indicating some sort of problem that I need to address? 5088 00:00:01 WARN [Index=sitecore_core_index] Crawling Stopped 5088 00:00:01 WARN [Index=sitecore_master_index] Crawling Stopped 5088 00:00:01 WARN [Index=sitecore_web_index] Crawling Stopped 5088 00:00:01 WARN [Index=sitecore_solr_analytics_index] Crawling Stopped 5088 00:00:01 WARN [Index=sitecore_core_index_solr] Crawling Stopped 5088 00:00:01 WARN [Index=sitecore_master_index_solr] Crawling Stopped 5088 00:00:01 WARN [Index=sitecore_web_index_solr] Crawling Stopped 5088 00:00:01 WARN [Index=sitecore_marketing_asset_index_master] Crawling Stopped 5088 00:00:01 WARN [Index=sitecore_marketing_asset_index_web] Crawling Stopped 5088 00:00:01 WARN [Index=sitecore_marketingdefinitions_master] Crawling Stopped 5088 00:00:01 WARN [Index=sitecore_marketingdefinitions_web] Crawling Stopped 5088 00:00:01 WARN [Index=ac_products_master_index] Crawling Stopped 5088 00:00:01 WARN [Index=ac_products_web_index] Crawling Stopped 5088 00:00:01 WARN [Index=sitecore_testing_index] Crawling Stopped 5088 00:00:01 WARN [Index=sitecore_suggested_test_index] Crawling Stopped 5088 00:00:01 WARN [Index=sitecore_fxm_master_index] Crawling Stopped 5088 00:00:01 WARN [Index=sitecore_fxm_web_index] Crawling Stopped 5088 00:00:01 WARN [Index=sitecore_fxm_domains_master] Crawling Stopped 5088 00:00:01 WARN [Index=sitecore_fxm_domains_web] Crawling Stopped 5088 00:00:01 WARN [Index=sitecore_list_index] Crawling Stopped 5088 00:00:01 WARN [Index=social_messages_master] Crawling Stopped 5088 00:00:01 WARN [Index=social_messages_web] Crawling Stopped 5088 00:00:01 WARN [Index=sitecore_core_index] Crawling Stopped 5088 00:00:01 WARN [Index=sitecore_master_index] Crawling Stopped 5088 00:00:01 WARN [Index=sitecore_web_index] Crawling Stopped 5088 00:00:01 WARN [Index=sitecore_solr_analytics_index] Crawling Stopped
In most cases where there are issues with publishing to content delivery servers, caches not clearing, or events not firing, it is generally due to Instance Name issues. The Instance Name In the ScalabilitySettings.config, when enabled for a distributed environemnt, there is a Sitecore Setting called InstanceName. <sitecore> <settings> <!-- INSTANCE NAME Unique name for Sitecore instance. Default value: (machine name and IIS site name) --> <setting name="InstanceName"> <patch:attribute name="value"></patch:attribute> </setting> </settings> </sitecore> The default value, uses the Machine Name and IIS Site Name. However in rare cases where servers have the same name, this can result in issues. In the Core database, the EventQueue table uses the instancename of the Sitecore server to determine whether or not it has acted upon events that have been registered. If two servers, inadvertantly have the same InstanceName then when the first server acts on any events in the table, it will set a bit saying that it has acted on it. When the second server checks the table, using it's InstanceName as a filter, if it sees the event has been dealt with, it does nothing. Typically, ensuring that the instance name is unique for each Sitecore server will prevent any issues with publishing or events not clearing.
Two CD instances, one is missing content, the second is working as expected When we deploy our site to our staging slot using the Sitecore Azure module we're running into odd behavior. The second web role instance, SitecoreWebRole_IN_1 is displaying all of the expected content, but the first web role, SitecoreWebRole_IN_0, is missing some content. We've tried: Clearing the sitecore cache Forcing an Azure Warmup Republishing the missing items in question Verified that the Azure.ServiceRuntime.config file is using: <agent type="Sitecore.Azure.Managers.Publishing.PublishTargetRemoteManager, Sitecore.Azure" method="Synchronize" interval="00:05:00" />. Re-imaging the instance Scaling to only one instance Pointing the instance to different databases with the same content and doing a full republish Completely deleting the slot and redeploying to a new staging slot The staging slot is sharing databases with the production slot. Publishing is happening from a PaaS Content Editor deployment. Deployment is from an IaaS VM using the Stiecore Azure Module. Sitecore is running v8.1 rev 151207. The Azure module is v8.1.5344.
The error that I see that makes sense to me that I see in your error messages is: Service Sitecore.ContentSearch.Analytics.Abstractions.ISettingsAnalytics was not registered in container This indicates to me that ISettingsAnalytics isn't registered in the DI container. I would check to make sure you have Sitecore.ContentSearch.Analytics.config enabled. This config, among other things, adds the initialization hook that registers ISettingsAnalytics to the container. <hooks> <hook type="Sitecore.ContentSearch.Analytics.Hooks.Initializer, Sitecore.ContentSearch.Analytics" /> </hooks> If this config file is enabled, check the ShowConfig.aspx page and do a search for Analytics.Hooks.Initializer and see if it's present.
Contact processing failed. Service Sitecore.ContentSearch.Analytics Whenever I click on submit for a WFFM form, the form does not submit and displays the We experienced a technical difficulty while processing your request. Your data may not have been correctly saved. error. Sitecore 8.1 Update 3 In the error logs I see the following errors as well: ERROR Contact processing failed. Service Sitecore.ContentSearch.Analytics... 18468 2017:03:01 17:27:38 ERROR Contact processing failed. Service Sitecore.ContentSearch.Analytics.Abstractions.ISettingsAnalytics was not registered in container Exception: System.InvalidOperationException Message: Service Sitecore.ContentSearch.Analytics.Abstractions.ISettingsAnalytics was not registered in container Source: Sitecore.ContentSearch at Sitecore.ContentSearch.Abstractions.ObjectLocator.GetInstance[TService]() at Sitecore.ContentSearch.Analytics.Extensions.ContactExtensions.ShouldBeIndexed(IContact contact) at Sitecore.ContentSearch.Analytics.Aggregators.ContactChangeContactAggregator.<ResolveIndexables>d__4.MoveNext() at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source) at Sitecore.ContentSearch.Analytics.Aggregators.ObservablePipelineProcessorHelper`3.OnProcess(TArgs args, String source) at (Object , Object[] ) at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) at Sitecore.Analytics.Aggregation.Pipelines.ContactProcessing.ContactProcessingPipeline.Run(ContactProcessingArgs args) at Sitecore.Analytics.Aggregation.Data.Contact.ContactProcessingAgent.Execute() ERROR Aggregation Error 6680 2017:03:01 17:27:38 ERROR Aggregation Error Exception: System.InvalidOperationException Message: Service Sitecore.ContentSearch.Analytics.Abstractions.ISettingsAnalytics was not registered in container Source: Sitecore.ContentSearch at Sitecore.ContentSearch.Abstractions.ObjectLocator.GetInstance[TService]() at Sitecore.ContentSearch.Analytics.Extensions.ContactExtensions.ShouldBeIndexed(IContact contact) at Sitecore.ContentSearch.Analytics.Aggregators.AnalyticsVisitAggregator.<ResolveIndexables>d__4.MoveNext() at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source) at Sitecore.ContentSearch.Analytics.Aggregators.ObservablePipelineProcessorHelper`3.OnProcess(TArgs args, String source) at Sitecore.Analytics.Aggregation.Pipeline.AggregationProcessor.Process(AggregationPipelineArgs args) ERROR Error during aggregation. 6680 2017:03:01 17:27:38 ERROR Error during aggregation. Exception: System.InvalidOperationException Message: Service Sitecore.ContentSearch.Analytics.Abstractions.ISettingsAnalytics was not registered in container Source: Sitecore.ContentSearch at Sitecore.ContentSearch.Abstractions.ObjectLocator.GetInstance[TService]() at Sitecore.ContentSearch.Analytics.Extensions.ContactExtensions.ShouldBeIndexed(IContact contact) at Sitecore.ContentSearch.Analytics.Aggregators.AnalyticsVisitAggregator.<ResolveIndexables>d__4.MoveNext() at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source) at Sitecore.ContentSearch.Analytics.Aggregators.ObservablePipelineProcessorHelper`3.OnProcess(TArgs args, String source) at Sitecore.Analytics.Aggregation.Pipeline.AggregationProcessor.Process(AggregationPipelineArgs args) at (Object , Object[] ) at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) at Sitecore.Analytics.Aggregation.Pipeline.AggregationPipeline.Run(AggregationPipelineArgs args) at Sitecore.Analytics.Aggregation.InteractionAggregator.Aggregate(Byte[] recordKey, IAggregationContext context) at Sitecore.Analytics.Aggregation.Aggregator.Execute() Screenshot of the Include Directory: UPDATE: Adding the following block of XML to the Sitecore.ContentSearch.Analytics.config got rid of the three above errors in the error log. <hooks> <hook type="Sitecore.ContentSearch.Analytics.Hooks.Initializer, Sitecore.ContentSearch.Analytics" /> </hooks> But, the We experienced a technical difficulty while processing your request. Your data may not have been correctly saved. error is still present. I am not seeing any relevant errors. But, there are warnings. I created a basic console application and verified that the server can send email via the SMTP server configured. WARN [WFFM] Failure sending mail. 8612 2017:03:02 15:48:35 WARN [WFFM] Failure sending mail. Exception: System.Net.Mail.SmtpException Message: Failure sending mail. Source: System at System.Net.Mail.SmtpClient.Send(MailMessage message) at (Object , Object[] ) at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) at Sitecore.Forms.Core.Dependencies.DefaultImplMailSender.SendMail(IEmailAttributes emailAttributes, ID formId, AdaptedResultList fields, Object[] data) at Sitecore.Forms.Core.Dependencies.DefaultImplActionExecutor.ExecuteSaving(ID formID, ControlResult[] fields, IActionDefinition[] actionDefinitions, Boolean simpleAdapt, ID sessionID) Nested Exception Exception: System.Net.WebException Message: Unable to connect to the remote server Source: System at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress&amp; address, Socket&amp; abortSocket, Socket&amp; abortSocket6) at System.Net.PooledStream.Activate(Object owningObject, Boolean async, GeneralAsyncDelegate asyncCallback) at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint) at System.Net.Mail.SmtpTransport.GetConnection(ServicePoint servicePoint) at System.Net.Mail.SmtpClient.GetConnection() at System.Net.Mail.SmtpClient.Send(MailMessage message) Nested Exception Exception: System.Net.Sockets.SocketException Message: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 192.168.175.228:25 Source: System at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket&amp; socket, IPAddress&amp; address, ConnectSocketState state, IAsyncResult asyncResult, Exception&amp; exception) WARN [WFFM] The 'Send Email Message 8612 2017:03:02 15:48:35 WARN [WFFM] The 'Send Email Message[id={D4502A11-9417-4479-9F2A-485F45D2E2D0}]' save action failed: We experienced a technical difficulty while processing your request. Your data may not have been correctly saved. WARN [WFFM] Web Forms for Marketers: an exception 8612 2017:03:02 15:48:35 WARN [WFFM] Web Forms for Marketers: an exception: We experienced a technical difficulty while processing your request. Your data may not have been correctly saved. has occured while trying to execute an action. UPDATE 2: The wrong host parameter was found in the Submit Parameters value for the Send Email Message item. After correcting this value the emails are sending fine.
I have got issues like that before and most of times there are two items with same name and Id. Please check through the content editor if you see a duplicate item sitecore\system\Settings. If this is not the case, did you recently update your TDS to a recent version? If so please check this (Duplicate item errors when syncing a TDS project) You should focus on solving the issue rather than setting the item to stop syncing to TDS. I hope this helps.
TDS: Duplicate Sitecore IDs error on system/Settings I'm trying to do a deploy in a new environment for the first time, and I'm getting the error "Duplicate Sitecore ID's found in files sitecore\system\Settings.item and sitecore\system\Settings.item." This is a standard Sitecore item, and it's in TDS because a child of it was modified, but the IDs are the same when I look at the comparison chart. I can do a "sync with Sitecore" operation just fine, but I'm not sure why a deploy would complain about this instead of just skipping it, since there's no changes.
Custom code is necessary to achieve this since you want to generate media urls in different ways based on the context site. Override the MediaProvider and provide config nodes to determine which sites use CDN urls. Add a sitecore config patch: <?xml version="1.0"?> <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <hooks> <hook type="Project.Web.Hooks.MediaProvider, Project.Web"> <OriginPrefix>https://projectcdn.blob.core.windows.net/CDN/</OriginPrefix> <Sites>Site1|Site2</Sites> </hook> </hooks> </sitecore> </configuration> Create a class that inherits from MediaProvider and implements the GetMedia methods to do what you want: public class MediaProvider : Sitecore.Resources.Media.MediaProvider, IHook { // get the values from the inner config nodes public string OriginPrefix { get; set; } public string Sites { get; set; } public List<string> AllowedSites { get { return string.IsNullOrEmpty(Sites) ? new List<string>() : Sites.Split('|').Where(x => !string.IsNullOrEmpty(x)).ToList(); } } public void Initialize() { MediaManager.Provider = this; } public override string GetMediaUrl(MediaItem item) { return GetMediaUrl(base.GetMediaUrl(item), item); } public override string GetMediaUrl(MediaItem item, MediaUrlOptions options) { return GetMediaUrl(base.GetMediaUrl(item, options), item); } public string GetMediaPath(MediaItem mediaItem, string extension = "") { var str = MainUtil.EncodeName(mediaItem.Name); return mediaItem.MediaPath.TrimStart('/').Replace(mediaItem.DisplayName, str + "." + extension).ToLower(); } public string GetMediaUrl(string mediaUrl, MediaItem item) { if ((Context.Database != null &amp;&amp; Context.Database.Name == "core") || string.IsNullOrEmpty(OriginPrefix)) { return mediaUrl; } if (mediaUrl.ToLower().Contains("-/media/")) { mediaUrl = OriginPrefix + mediaUrl.Substring(mediaUrl.LastIndexOf("-/media/", StringComparison.Ordinal) + 8, mediaUrl.Length - 8 - mediaUrl.LastIndexOf("-/media/", StringComparison.Ordinal)).ToLower(); } if (mediaUrl.ToLower().Contains("?")) { mediaUrl = mediaUrl.Split('?')[0]; } // cache busting mediaUrl = $"{mediaUrl}?rv={item.InnerItem.Statistics.Revision}"; return mediaUrl; } } In this case I'm defining the cdn origin prefix in config as well and using that to construct the media url. The AllowedSites property can be used to determine whether to use the base or custom implementations based on the context site (this is not included in the example).
MediaLinkServerUrl per site Is there a way to set Media.MediaLinkServerUrl value per sitecore site? basically I would like to use CDN for main website by specifying the cdn domain as MediaLinkServerUrl value but not for one of the other sites in multi-site setup. Is this possible without writing any custom media link resolver logic?
with in Sitecore.ExperienceEditor.Speak.Server.RequestArgs class the method name to execute defaults to Process. Check the last line in below method. public RequestArgs(string commandPath, NameValueCollection queryString, string data) { Assert.ArgumentNotNull(queryString, "queryString"); this.QueryString = queryString; this.Data = data; string[] array = StringUtil.RemovePrefix('/', StringUtil.RemovePostfix('/', commandPath)).Split(new char[] { '/' }); Assert.IsTrue(array.Any<string>(), "Missign request name"); this.RequestName = array[0]; this.MethodName = ((array.Length == 1) ? "Process" : array[1]); } Either you have to create your request as ExperienceEditor.GenerateFieldEditorUrl/ProcessRequest Or change the method below in GenerateFieldEditorUrl class to Process from ProcessRequest public override PipelineProcessorResponseValue ProcessRequest()
A serious error occurred please contact the administrator I am working on SPEAK UI in Sitecore. I have created the button, Which is named as Edit Meta under content/webedit/ribbons/webedit in core database. This button will be shown in Experience Editor section when I click Edit Meta button. I need to show the Data in a popup window related to that particular Meta section. I gave the command name, script file path, Access Key in button layout properties. When i click the button in Experience Editor it shows below error. A serious error occurred please contact the administrator I un-commented the code which is related to SPEAK ui in sitecoreMvcExperienceEditor.config also. I have added Sitecore.Support.122942.dll also. I checked the log file and it shows Could not instantiate speak request object. Please suggest how to resolve this issue? I followed below steps. I logged into core database using Sitecore Rocks. I have created the Item(Meta) using strip template under Content/Applications/Webedit/Ribbons/Webedit/ in core database and given the Header Name and Id . Added strip layout for Meta Item in presentation details. Created the Item Under Meta by using Chunk template, given HeaderName and Added Chunk layout in presentation details. Created another item(EditMeta) under Meta chunk using Largebutton template &amp; given the Header name also. Added the LargeButton rendering for MetaData in presentation details. I have edited the property details of Largebutton rendering. below I mentioned the property details of Largebutton rendering. My Js file.` define(["sitecore", "/-/speak/v1/ExperienceEditor/ExperienceEditor.js"], function (Sitecore, ExperienceEditor) { Sitecore.Commands.LaunchFieldEditor = { canExecute: function (context) { return true; }, execute: function (context) { context.currentContext.argument = context.button.viewModel.$el[0].accessKey; ExperienceEditor.PipelinesUtil.generateRequestProcessor("ExperienceEditor.GenerateFieldEditorUrl", function (response) { var DialogUrl = response.responseValue.value; var dialogFeatures = "dialogHeight: 680px;dialogWidth: 520px;"; ExperienceEditor.Dialogs.showModalDialog(DialogUrl, '', dialogFeatures, null); }).execute(context); } }; }); ` My class: public class GenerateFieldEditorUrl : PipelineProcessorRequest<ItemContext> { public string GenerateUrl() { var fieldList = CreateFieldDescriptors(RequestContext.Argument); var fieldeditorOption = new FieldEditorOptions(fieldList); //Save item when ok button is pressed fieldeditorOption.SaveItem = true; return fieldeditorOption.ToUrlString().ToString(); } private List<FieldDescriptor> CreateFieldDescriptors(string fields) { var fieldList = new List<FieldDescriptor>(); var fieldString = new ListString(fields); foreach (string field in new ListString(fieldString)) fieldList.Add(new FieldDescriptor(RequestContext.Item, field)); return fieldList; } public override PipelineProcessorResponseValue ProcessRequest() { return new PipelineProcessorResponseValue { Value = GenerateUrl() }; } } I added the reference in Sitecore.ExperienceEditor.SpeakRequest.config <configuration> <sitecore> <sitecore.experienceeditor.speak.requests> <request name="ExperienceEditor.GenerateFieldEditorUrl" type="Website.Modules.Components.ExperienceEditor.FieldEditor.GenerateFieldEditorUrl, Website.Modules" /> </sitecore.experienceeditor.speak.requests> </sitecore> Could you please suggest, how to fix this issue? thanks in advance
You can solve this issue, just not with the OOTB AD connector. I have built custom AD role/membership/profile providers recently that will address your specific scenario. The way we did it was to create a REST API that connected to the ADs using custom code and staged the roles/profile data in MongoDB for all the accounts we were interested in. This allows for very flexible processing of inclusions/exclusions as you might imagine. Also if indexed and organised properly the MongoDB implementation will be very fast even for millions of objects (unless you want them all at once - don't do that, ensure you have server-side paging). We had about 40k users. At the Sitecore end we build a set of providers called "AD Proxy" - these simply connect directly to the REST APIs to get membership, role and profile information. That's all well and good for the AD attributes but obviously doesn't work for authentication. For that step we had the REST API connect live into the AD backend. So all the membership and profile data was super-cached through MongoDB but password updates were instant as these were being fed back to the source in real time. We implemented some rate limiting with backoff (using Polly) on the login methods to prevent anyone overloading the AD. As it happens this setup was hosted in Azure on a VM and a VPN gave us the AD access we needed. At the time it wasn't possible to support that setup with an App Service but it is now, either through a Premium App Service tier which can be backed onto a Virtual Network (which in turn can be connected to a VPN) or via the App Service Environment - but that's quite a bit more expensive and probably overkill for just this one function. A small VM or two for uptime is probably still the most cost-effective model.
Performance Related Issue - Active Directory, Roles Provider, Multiple documents, and 110,000 groups across multiple OUs I am working on setting up AD Roles provider and I have run into a bit of an issue -- I am hoping it can be worked around with some fancy configuration however at this point I am not sure. Background: My client has 3 domains with a trust between them (no forest). Inside each domain they have a top level OU for containing groups and under than they have 3 or 4 OUs used to organize things -- one of which is a "disabled" OU. Within these OUs there is approximately 110,000 groups (about 30,000 if you exclude the "disabled" OU"). You might ask, do I need all of these groups? The answer is yes and no. I need to be able to support any group that is created by the organization as a possible role within the Sitecore sites and the AD team do NOT put the groups for Sitecore in a single location as it would break all of their entire processes (GPOs, wizards for creating/managing etc.). So that leads me to the following issues/questions. Issue I cannot seem to figure out how to sync multiple OUs for a single Domain (let alone 3 domains) I tried using the switcher provider and configuring multiple providers and connection strings for each OU, however when I added multiple entries in the sitecore.config for the roles provider pointing to the same domain I threw an exception that this was not supported I cannot seem to figure out how to EXCLUDE a single OU when syncing the parent OU I tried using the custom Filter expression on the provider however there doesn't seem to be any syntax that will exclude a sub OU (only sub CNs which will not work for me) and from looking online, in a Microsoft AD environment it may not even be possible. Loading ALL 110,000 groups results in a 5+ min load time every-time the app pool recycles and the user goes to select a role From what I can tell the "cache" for roles is not very robust and clears out rather quickly (regardless of settings) Notes This is for the roles provider, eventually I am going to need to setup the Membership provider and it is even worse :) As I have about 200,000 users that will be synchronized unless I can figure out how to narrow down the sync to multiple specific OUs Thoughts? Example AD Structure (these are ALL OUs except the root) Root Domain Groups Distribution Lists OU1 Group 1 Group 2 ... OU2 Group 1 Group 2 ... ... ... Security OU1 Group 1 Group 2 ... OU2 Group 1 Group 2 ... ... ... Disabled ... ... Accounts Service OU1 Account 1 Account 2 ... OU2 Account 1 Account 2 ... ... ... User OU1 Account 1 Account 2 ... OU2 Account 1 Account 2 ... ... ... Server OU1 Account 1 Account 2 ... OU2 Account 1 Account 2 ... ... ...
The problem with the CSConfig was that CS was failing although the message on the wizard was that it was complete. It did not show any error messages. Reinstalling with elevated privileges and leaving the default administrator user properly installed CS. After that I was able to run the Initialize-CSSite command. hope this helps anyone
The operation cannot be performed because this Commerce Server instance has not been configured Hi I am setting up a commerce site following this tutorial here: http://commercesdn.sitecore.net/SitecoreCommerce/DeploymentGuide/en-us/index.html#Concepts/c_SC_SetUpCommerceServerSite.html but when I run the Initialize-CSSite command in Windows PowerShell, I get the following error: The operation cannot be performed because this Commerce Server instance has not been configured. Please run CSConfig.exe to configure Commerce Server. If I run the CSConfig.exe I get: The term 'CSConfig.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. I am assuming I need to import a module for this? Does anyone know how to address this issue? Also I see the CommerceServer.Core.config file under App_Config for my local website folder.
There are a few options here (specifically for TDS). I haven't listed non-TDS options like doing MS Deploy packages or Visual Studio publish, since the question is specific about TDS remote deployment. UNC SHARE: You can setup a UNC share on your target server and then set the deploy folder to that network path (e.g. \MyServerName\Website). If you use that approach, make sure you lock the security down on that share. Sitecore Package Deployer: The Hedgehog Sitecore Package Deployer (https://www.teamdevelopmentforsitecore.com/Blog/sitecore-package-deployer) can be installed on your target instance and install packages for you. Generate packages with your items and files and then deploy to the secure 'Data' Folder that you specify during your configuration. The deployer will install for you. Team City: My preference is not to do deployments directly from the developer machine and to put things through Continuous Integration. Set up the UNC share, but lock it down so only the TeamCity server/user can access it. This is more secure than allowing all devs access to the server. Then let TeamCity do your deployments for you. .
TDS remote deployment With TDS, I can set a non-local URL as my target website, leave the deploy folder blank, and do a "sync with Sitecore" just fine to push items. But it says I need a folder specified if I want to use the "Deploy" option instead. Is there any way to do ad-hoc remote deployments through Visual Studio?
Error Explanation: As Error says the type is missing in this assembly as shown and also this has been replaced by an Interface IContactPersonalInfo Interface is implemented in 'Sitecore.Analystics.Mode.Generated.ContactPersonalInfo’ Cross Check: Please verify you have this in Sitecore configuration through /sitecore/admin/showconfig.aspx patched up thr ‘Sitecore.Analytics.Model.Config’ It states Interface&amp; its implementation. Please verify you have Sitecore.Analytics.Model.dll in your csproj with appropriate version. Follow these links if old dll is still being used Link1 Link2
Could not load file or assembly 'file://c:\windows\system32\inetsrv\Sitecore.Analytics.Model.Entities.ContactPersonalInfo' or one of its dependencies I'm using Sitecore 8.1 Original Release and am having problems getting my contact stuff to work properly. Here's my code: var repository = new ContactRepository(); contact = repository.CreateContact(System.Guid.NewGuid()); When I try to execute this code, I get this error: Could not load file or assembly 'file://c:\windows\system32\inetsrv\Sitecore.Analytics.Model.Entities.ContactPersonalInfo' or one of its dependencies. The system cannot find the file specified." This is the same configuration that I've been using for several months, however, I've never tried to create a contact before. I've always just let Sitecore create a contact for me. This error message doesn't make sense, because I'm running my Sitecore instance in a completely separate location (different drive and everything). I've tried copying the Sitecore.Analytics.Model.dll to the specified directory, but I didn't have any luck. Questions: What could be causing Sitecore to look in such an odd place for the DLL when I call the create function? How can I fix this?
The issue that you are seeing is because you are trying to instantiate a new ContactRepository(). The appropriate way to reference the repository is by creating the object through Sitecore's Configuration Factory. private ContactRepository _repository = Sitecore.Configuration.Factory.CreateObject("tracking/contactRepository", true) as ContactRepository; See also: Could not load file or assembly &#39;file://c:\windows\system32\inetsrv\Sitecore.Analytics.Model.Entities.ContactPersonalInfo&#39; or one of its dependencies
How do I get access to my Contact Card information I'm running Sitecore 8.1 Original Release, and I'm trying to run this code: var repository = new ContactRepository(); var contact = repository.LoadContactReadOnly(contactId); where contactId is passed in as a System.Guid Datatype. I have 3 IDs that I should be able to load and not return a null value. Here they are (in RoboMongo): Here's what I've tried: I reset IIS and not browsed to my dev site located on my local box. This should ensure that the contact isn't locked. I've changed Robomongo to return the UUID Encoding as "Legacy" as well as ".NET encoding", which changed the UUIDs, but did not affect the outcome. I've checked the Sitecore_Analytics_Index for a clue about what IDs would return any valid information, but those IDs don't seem to match anything that I've got anywhere else, and if I query with them, that doesn't seem to get me anywhere either. It seems that no matter what I try, I can't find a contact to load, even though I see it in Mongo. Any ideas on how I can load a contact? Thanks!
Unfortunately, somewhere along the way, Sitecore (at this time we're on 8.2 U2) lost its capability to have more than a single item provided as a data source. Unfortunately, Query does not seem to be working in this version of Sitecore for when it returns more than 1 item AND SXA 1.2 breaks content search in data source mechanism altogether. This will, however, have a workaround in SXA 1.3 where you will be able to use Lucene queries in the "query" item: Once created, you will be able to use the query in Page List as follows. In Rendering Parameters: Select the query returning multiple items:
How do you properly configure SXA Page List with custom query? Testing with SXA 1.2 on Sitecore 8.2 u1/u2. I'm trying to query a list of pages marked as featured. Here is what I have setup: Custom Page template inherits from Page. Checkbox field is added with IsFeatured field. Query defined to return featured pages. +location:{29E0ED6F-452B-45A0-B799-C51EBD14970A};template:{13de59b4-ad71-4542-9ce0-a0483422e768};custom:isfeatured|true The query item does not have a way to build the query, so I used the datasource Unfortunately, when I test the page no results are returned. Update Test with a new query that has a + for each setting but does not change the behavior. Update 2 Oddly, when I move the query to the Data Source field and clear the Source Type I get an error. Not seen this before.
Your error indicates issues with your analytics index. First of all (something to do whenever you have errors after an upgrade): make sure all your files are actually from the correct new version! Verify your bin folder and the Sitecore configs: they have to match with a clean version of the required Sitecore (in this case 8.0 - update5). If you verified that and the error is still present, check if your upgrade process was completed. The upgrade guide does mention some steps to take to finalize the upgrade, so make sure you did those: Updating Data To upgrade your solution from the initial version of Sitecore, 8.0 rev. 141212, you must update the social profiles data to ensure that it is compliant with Sitecore 8.0 Update-5. To update the social profiles data, open the following page: http:///sitecore/admin/UpdateSocialProfiles.aspx Redeploying Marketing Data To update the marketing data to ensure that it is compliant with Sitecore 8.0 Update-5, open the following page: http:///sitecore/admin/RedeployMarketingData.aspx (make sure that analytics is enabled) Rebuilding the Reporting Database As part of the upgrade process, you must also rebuild the Reporting database. That rebuild of the reporting database is the only way to fix issues with your analytics index (what seems to be the case here). More info on how to do this: https://doc.sitecore.net/sitecore_experience_platform/setting_up_and_maintaining/xdb/server_considerations/walkthrough_rebuilding_the_reporting_database
Could not map index document field to property StartDateTime I have updated my instance from 8.0 initial release to 8.0 update 5. In the Experience profile, there is this error. Could not map index document field to property "StartDateTime" on type Sitecore.ContentSearch.Analytics.Models.IndexedVisit : String was not recognized as a valid DateTime. I rebuilt the indexes from developer tab in content editor but that did not fix it.
The problem of your issue is ItemNameValidation settings. Please change the value of this setting to the default one : <setting name="ItemNameValidation" value="^[\w*\$][\w\s\-\$]*((\d{1,})){0,1}$" />
Empty string is not allowed error when adding or renaming item on Sitecore content tree Getting the error below in the CMS when trying to insert items into content tree or when re-naming existing items Exception: System.ArgumentOutOfRangeException Message: Empty string is not allowed. Parameter name: validation. Actual value was . Source: Sitecore.Kernel at Sitecore.Diagnostics.Error.AssertString(String argument, String name, Boolean allowEmpty) at Sitecore.Web.UI.Sheer.SheerResponse.Input(String text, String defaultValue, String validation, String validationText, Int32 maxLength) at Sitecore.Shell.Framework.Commands.AddMaster.Add(ClientPipelineArgs args) Any chance you can help figure out what is going on?
Take a look at the documentation: Unlike the Feature layer, there is no strict convention on dependencies between modules in the foundation layer. It is allowed to have dependencies between modules in foundation. http://helix.sitecore.net/principles/architecture-principles/layers.html?highlight=foundation#foundation-layer https://helix.sitecore.com/principles/architecture-principles/layers.html
Habitat / Helix - Is it OK to have dependencies between Foundation level modules Looking through the Habitat solution, I noticed that the Sitecore.Foundation.Theming module references the Sitecore.Foundation.SitecoreExtensions module. I thought modules were meant only to reference modules at a lower level?
I was either updated to the wrong spot in source control or must have missed a setup step. I uninstalled, updated to 490b4a58e6d3a83ea0c4d12cc1ad8ec7672826ce, reinstalled what I needed to and then it started working.
Sitecore Habitat Unicorn Sync Issue I'm getting an error during the gulp step to sync Unicorn while trying to set up Habitat. Here is the error in the unicorn console: ERROR: Object reference not set to an instance of an object. (System.NullReferenceException) at Unicorn.Users.Loader.UserLoader.DeserializeUser(SyncUserFile serializedUser) at Unicorn.Users.Loader.UserLoader.Load(IConfiguration configuration) at Unicorn.Users.Pipelines.UnicornSyncComplete.SyncUsers.Process(UnicornSyncCompletePipelineArgs args) at (Object , Object[] ) at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) at Unicorn.SerializationHelper.SyncTree(IConfiguration configuration, Action`1 rootLoadedCallback, IItemData[] roots) at Unicorn.ControlPanel.Pipelines.UnicornControlPanelRequest.SyncVerb.Process(IProgressStatus progress, ILogger additionalLogger) Here is the full output when running the Unicorn gulp task: [10:06:40] Starting '05-Sync-Unicorn'... C:\Projects\Habitat\scripts\unicorn.js:36 if (err !== null) throw err; ^ Error: Command failed: Invoke-WebRequest : Sync Unicorn Info: Foundation.Serialization is being synced. Info: Info: Foundation.Serialization sync complete: 24 items evaluated, 0 items modified (0 added, 0 updated, 0 recycled) in 136ms (~5.7ms/item). Info: Foundation.SitecoreExtensions is being synced. Info: Info: Foundation.SitecoreExtensions sync complete: 160 items evaluated, 0 items modified (0 added, 0 updated, 0 recycled) in 2787ms (~17.4ms/item). Info: Feature.FAQ is being synced. Info: Info: Feature.FAQ sync complete: 12 items evaluated, 0 items modified (0 added, 0 updated, 0 recycled) in 51ms (~4.3ms/item). Info: Info: Feature.FAQ roles are being synced. Info: Feature.FAQ role sync complete. Info: Feature.Identity is being synced. Info: Info: Feature.Identity sync complete: 19 items evaluated, 0 items modified (0 added, 0 updated, 0 recycled) in 2531ms (~133.2ms/item). Info: Info: Feature.Identity roles are being synced. Info: Feature.Identity role sync complete. Info: Feature.Metadata is being synced. Info: Info: Feature.Metadata sync complete: 18 items evaluated, 0 items modified (0 added, 0 updated, 0 recycled) in 51ms (~2.9ms/item). Info: Info: Feature.Metadata roles are being synced. Info: Feature.Metadata role sync complete. Info: Foundation.Assets is being synced. Info: Info: Foundation.Assets sync complete: 15 items evaluated, 0 items modified (0 added, 0 updated, 0 recycled) in 57ms (~3.9ms/item). Info: Info: Foundation.Assets roles are being synced. Info: Foundation.Assets role sync complete. Info: Foundation.Dictionary is being synced. Info: Process terminated with code 8. Info: Foundation.Dictionary sync complete: 6 items evaluated, 0 items modified (0 added, 0 updated, 0 recycled) in 2413ms (~402.2ms/item). Info: Foundation.FieldEditor is being synced. Info: Info: Foundation.FieldEditor sync complete: 1 item evaluated, 0 items modified (0 added, 0 updated, 0 recycled) in 5954ms (~5,954.6ms/item). Info: Foundation.Forms is being synced. Info: Info: Foundation.Forms sync complete: 2 items evaluated, 0 items modified (0 added, 0 updated, 0 recycled) in 16ms (~8.3ms/item). Info: Foundation.Indexing is being synced. Info: Info: Foundation.Indexing sync complete: 6 items evaluated, 0 items modified (0 added, 0 updated, 0 recycled) in 26ms (~4.5ms/item). Info: Info: Foundation.Indexing roles are being synced. Info: Foundation.Indexing role sync complete. Info: Foundation.LocalDatasource is being synced. Info: Info: Foundation.LocalDatasource sync complete: 4 items evaluated, 0 items modified (0 added, 0 updated, 0 recycled) in 2566ms (~641.6ms/item). Info: Foundation.Multisite is being synced. Info: Info: Foundation.Multisite sync complete: 14 items evaluated, 0 items modified (0 added, 0 updated, 0 recycled) in 2343ms (~167.4ms/item). Info: Info: Foundation.Multisite roles are being synced. Info: Foundation.Multisite role sync complete. Info: Foundation.Theming is being synced. Info: Info: Foundation.Theming sync complete: 22 items evaluated, 0 items modified (0 added, 0 updated, 0 recycled) in 2409ms (~109.5ms/item). Info: Feature.Accounts is being synced. Info: Info: Feature.Accounts sync complete: 38 items evaluated, 0 items modified (0 added, 0 updated, 0 recycled) in 8448ms (~222.3ms/item). Info: Info: Feature.Accounts roles are being synced. Info: Feature.Accounts role sync complete. Info: Feature.Demo is being synced. Info: Info: Feature.Demo sync complete: 25 items evaluated, 0 items modified (0 added, 0 updated, 0 recycled) in 80ms (~3.2ms/item). Info: Info: Feature.Demo roles are being synced. Info: Feature.Demo role sync complete. Info: Feature.Language is being synced. Info: Info: Feature.Language sync complete: 7 items evaluated, 0 items modified (0 added, 0 updated, 0 recycled) in 31ms (~4.5ms/item). Info: Info: Feature.Language roles are being synced. Info: Feature.Language role sync complete. Info: Feature.Maps is being synced. Info: Info: Feature.Maps sync complete: 38 items evaluated, 0 items modified (0 added, 0 updated, 0 recycled) in 8145ms (~214.3ms/item). Info: Info: Feature.Maps roles are being synced. Info: Feature.Maps role sync complete. Info: Feature.Media is being synced. Info: Info: Feature.Media sync complete: 54 items evaluated, 0 items modified (0 added, 0 updated, 0 recycled) in 7487ms (~138.7ms/item). Info: Info: Feature.Media roles are being synced. Info: Feature.Media role sync complete. Info: Feature.Multisite is being synced. Info: Info: Feature.Multisite sync complete: 8 items evaluated, 0 items modified (0 added, 0 updated, 0 recycled) in 37ms (~4.7ms/item). Info: Info: Feature.Multisite roles are being synced. Info: Feature.Multisite role sync complete. Info: Feature.Navigation is being synced. Info: Info: Feature.Navigation sync complete: 24 items evaluated, 0 items modified (0 added, 0 updated, 0 recycled) in 70ms (~3.0ms/item). Info: Info: Feature.Navigation roles are being synced. Info: Feature.Navigation role sync complete. Info: Feature.News is being synced. Info: Info: Feature.News sync complete: 20 items evaluated, 0 items modified (0 added, 0 updated, 0 recycled) in 58ms (~2.9ms/item). Info: Info: Feature.News roles are being synced. Info: Feature.News role sync complete. Info: Feature.PageContent is being synced. Info: Info: Feature.PageContent sync complete: 20 items evaluated, 0 items modified (0 added, 0 updated, 0 recycled) in 86ms (~4.3ms/item). Info: Info: Feature.PageContent roles are being synced. Info: Feature.PageContent role sync complete. Info: Feature.Search is being synced. Info: Info: Feature.Search sync complete: 17 items evaluated, 0 items modified (0 added, 0 updated, 0 recycled) in 2492ms (~146.6ms/item). Info: Info: Feature.Search roles are being synced. Info: Feature.Search role sync complete. Info: Feature.Social is being synced. Info: Info: Feature.Social sync complete: 22 items evaluated, 0 items modified (0 added, 0 updated, 0 recycled) in 2346ms (~106.7ms/item). Info: Info: Feature.Social roles are being synced. Info: Feature.Social role sync complete. Info: Feature.Teasers is being synced. Info: Info: Feature.Teasers sync complete: 57 items evaluated, 0 items modified (0 added, 0 updated, 0 recycled) in 2558ms (~44.9ms/item). Info: Info: Feature.Teasers roles are being synced. Info: Feature.Teasers role sync complete. Info: Feature.Person is being synced. Info: Info: Feature.Person sync complete: 40 items evaluated, 0 items modified (0 added, 0 updated, 0 recycled) in 190ms (~4.8ms/item). Info: Info: Feature.Person roles are being synced. Info: Feature.Person role sync complete. Info: Project.Common.Website is being synced. Info: Info: Project.Common.Website sync complete: 173 items evaluated, 0 items modified (0 added, 0 updated, 0 recycled) in 8518ms (~49.2ms/item). Info: Project.Habitat.Website is being synced. Info: Info: Project.Habitat.Website sync complete: 555 items evaluated, 0 items modified (0 added, 0 updated, 0 recycled) in 4979ms (~9.0ms/item). Info: Info: Project.Habitat.Website roles are being synced. Info: Project.Habitat.Website role sync complete. Info: Info: Project.Habitat.Website users are being synced. Error: ERROR: Object reference not set to an instance of an object. (System.NullReferenceException)at Unicorn.Users.Loader.UserLoader.DeserializeUser(SyncUserFile serializedUser) at Unicorn.Users.Loader.UserLoader.Load(IConfiguration configuration) at Unicorn.Users.Pipelines.UnicornSyncComplete.SyncUsers.Process(UnicornSyncCompletePipelineArgs args) at (Object , Object[] ) at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) at Unicorn.SerializationHelper.SyncTree(IConfiguration configuration, Action`1 rootLoadedCallback, IItemData[] roots) at Unicorn.ControlPanel.Pipelines.UnicornControlPanelRequest.SyncVerb.Process(IProgressStatus progress, ILogger additionalLogger) Info: Info: Completed. At C:\Projects\Habitat\scripts\Unicorn\Unicorn.psm1:43 char:12 + ... $result = Invoke-WebRequest -Uri $url -Headers @{ "X-MC-MAC" = $sig ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc eption + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand at ChildProcess.exithandler (child_process.js:648:15) at ChildProcess.emit (events.js:98:17) at maybeClose (child_process.js:756:16) at Socket.<anonymous> (child_process.js:969:11) at Socket.emit (events.js:95:17) at Pipe.close (net.js:465:12) I have installed Sitecore 8.2 Initial release with the appropriate version of wffm and am updated to the 8.2 release branch (I'm not sure if this is what I should have checked out. Sha: 4c3f8c1672a5d0da67966a34d87b1d6ee1081b3b). It looks like some user might not exist in my instance or there may be an issue with what is on the filesystem (I think Unicorn can store users). If anyone knows what the issue is some help would be appreciated.
To fix this I had to import manually the catalog within the catalog manager in my case located at C:\Program Files (x86)\Commerce Server 11\Business User Applications\CatalogManager.exe from there I had to select the catalog xml file on the folder \MySitecoreWebsiteFolder\SitecoreCommerce\Data\Catalog From there I was able to see the adventure works catalog imported on the catalog manager
Issues while installing commerce - Entity Adventure Works Catalog|AW535-11| was not found I have been following this guideline here and when I get to the step of running the http://localhost:5000/commerceops/InitializeEnvironment(environment='AdventureWorksShops') piece I noticed the following error message on the response: "@odata.context":"http://localhost:5000/CommerceOps/$metadata#Commands/$entity","@odata.type":"#Sitecore.Commerce.Core.Commands.InitializeEnvironmentCommand","Id":"dd847fa373ca4958aa3a60f2873dc111","ResponseCode":"Error","Messages":[ { "MessageDate":"2017-03-03T22:53:51.1963137Z","Code":"Error","Text":"Entity Adventure Works Catalog|AW535-11| was not found.","CommerceTermKey":"EntityNotFound" } I did run the command http://localhost:5000/commerceops/Bootstrap() before that without any issues. Anyone know what I'm missing? I mean I need the Adventure works catalog to show in Sitecore. I"m not sure whether this is the step that imports considering the error message I"m assuming it's somewhat related. If this is not the step and this message is just a consequence of a failed import my question would be in this case: which step imports it and what could cause this failing?
I am afraid this question is quite extensive. Sitecore uses ASP.NET membership, role and profile providers. As a starting place, please check this Security API Cookbook. This will give you a really good overview of concepts and also sample code related to Sitecore User Management, authentication, authorization and user profile management. I am sure things will be more clear to you after reading this. Welcome to Sitecore Stack!
Authentication and Authorization in Sitecore I just started my journey as Sitecore developer.I want to create a user registration page and login page.I am totally confused where should i store the user details and how to authenticate him.
Yes, you can create your custom View Engine to resolve relative paths based on the assembly name. So, following this guide: https://weblogs.asp.net/imranbaloch/view-engine-with-dynamic-view-location You can add a path like that: "~/Views/%feature/{0}.cshtml" And override the following methods: protected override IView CreatePartialView(ControllerContext controllerContext, string partialPath) { var featureName = controllerContext.Controller.GetType().Assembly.GetName().Name; return base.CreatePartialView(controllerContext, partialPath.Replace("%feature", featureName)); } protected override IView CreateView(ControllerContext controllerContext, string viewPath, string masterPath) protected override bool FileExists(ControllerContext controllerContext, string virtualPath) This will resolve to ~/Views/Sitecore.Foundation.Test/Test.cshtml You can play around with index/substring of . to get it to just feature name.
Custom View Engine for Razor View Helix-type default paths Has anyone been able to make a habitat-compatible razor view engine? Basically I'd like something that can dynamically search "~/Views/{1}/{0}.cshtml", "~/Views/Shared/{0}.cshtml" "~/Views/{<Relative folder name>}/{0}.cshtml" For example if my project is Sitecore.Foundation.Test and I have: ~/Views/Test/Test.cshtml ~/Views/Test/_Test.cshtml And then Test.cshtml calls RenderPartial("_Test") The default razor engine doesn't work for this scenario when the "Test.cshtml" is added as a view rendering, and the page has a controller rendering with a different controller name.
To do page redirection, simply do return Redirect(url); For a permanent redirect (e.g. for search engines), use return RedirectPermanent(url); Both of these return a RedirectResult which inherit from ActionResult. To redirect to a Sitecore Item, do it the same way you always have. var url = LinkManager.GetItemUrl(yourItem); return Redirect(url);
How to redirect to another page or sitecore item in MVC I'm new to MVC and trying to achieve page redirection. User will click on "Sign-out" and should be redirected to the "sign-in" page. Here is my code. public ActionResult SignIn() { if (Sitecore.Context.IsLoggedIn) { LogoutUser(); return RedirectToRoute(MvcSettings.SitecoreRouteName, new { pathInfo = "/en/sign-in" }); } } This method is invoked, but the page is redirected to "en/?f" and the message on page is This domain is not configured for this service. Please add it to your account. Should something be configured for routes or in web.config. Using Sitecore 8.0 update 5
Let's look at what Feature/Foundation layers are defined as (I'll ignore Project for now as the question focuses on Feature/Foundation): Feature The concrete features of the solution, grouped by the business domain of the solution, not the technology. Features should never depend on other features. Read more Foundation This is the foundation of your solution. Governed by the Stable Dependencies Principle. Note this quote from the docs: Typically, modules in the Foundation layer are either business-logic specific extensions on the technology frameworks used in the implementation, or shared functionality between feature modules that is abstracted out into separate frameworks. Typically, modules in the Foundation layer are conceptually abstract and do not contain presentation in the form of renderings or views - as these are to be considered concrete. Read more Now - how do we apply this to your question. So a Foundation layer project, really should take some business logic or technology and provide the abstraction for one or more features to be able to use. A foundation project should not be a generic place to put "things" and it should still not cover multiple business or tecnology units in a single project. When you talk about a Foundations.Abstraction project, this has the potential to become a dumping ground for everything - similar to how you never want a class called Utilities etc... - it is too generic and has no definition. Maintainability becomes problematic. Really your whole Foundation layer is your abstraction so that the Features are not tightly coupled to the technology/frameworks that are underlying. YAGNI Another very important principle to keep in mind is: YAGNI - if you know that the functionality you are writing needs to be used by multiple features - for example an Indexing project that abstracts the Sitecore Search API - then, yes that is a Foundation project. But if you don't know or are not sure - then add it to your feature. There is no need to add more code to the "Stable" foundation layer than is absolutely needed. If that bit is needed by another feature later on, refactor it then, when it is needed. tl;dr The short version of that is: * Don't add a generic project to the Foundation layer to hold all abstractions, your foundation layer is your abstraction * Add to the Foundation layer when your business features require it, not before. * The Foundation layer still is grouped into logical business or technology units. Foundation.Abstractions - don't do it :)
Should Foundation.Abstractions be a single module or a grouping of granular modules? I've been thinking a lot about the organization of Foundation.Abstractions modules (organizing base-types for IoC that Feature - and potentially Foundation - modules use), and I am a bit torn on whether Foundation.Abstractions should really be a single module, a grouping of separate, more granular modules, or else if it should just be core abstractions with other abstractions living in their own, separate Foundation modules. Putting IIndexableFoo in the same module as IBazWeatherServiceManager (made up interfaces for illustration purposes, only) doesn't feel right to me, since I should be able to remove one the "Indexing" or the "Weather" feature without affecting anything else. I feel like what I should be doing is instead adding sub-modules to Foundation.Abstractions (i.e. using Foundation.Abstractions as a module group and adding a new module to that group). In this case, I might have something like Foundation.Abstractions.Indexing and Foundation.Abstractions.Weather. In contrast, I know that the Foundation.Abstractions module shouldn't really be aware of what purpose it will server or by which features it will be used. As such, even though it is perfectly acceptable in Helix to group multiple modules together as a single module, I feel like breaking Foundation.Abstractions up the way I described in the example might actually violate the concept that Helix was aiming for. To elaborate, what I mean is that if I were to split up my Foundation.Abstractions module by purpose, I would inherently be making said Foundation layer module aware of the purpose. The other option that I have is to create separate Foundation layer modules for the different abstractions, and reserve Foundation.Abstractions for core abstractions. In the case of the example I described above, this would likely entail having modules like the following: Foundation.Indexing.Abstractions, Foundation.Weather.Abstractions, and Foundation.Abstractions (or Foundation.Core.Abstractions if Foundation.Core exists and is a module group). Can anyone help me straighten out the guidelines on when to group abstractions and which would be the better practice when following Helix? UPDATE: In the example, above, "Weather" was actually a poor choice. The "Indexing" example illustrates the correct point, as it is for a feature that is/modifies part of the platform. I don't want to change the post yet, in case people are currently writing answers, but instead of "Weather" you can think of something like "IEventHandler" or something else that is/modifies part of the platform.
If what you are looking to do is create a new item with a specific ID from a specific branch template then what you are looking for is the following: var newItemName = "Name of Root Item to Create" // this may be overridden by your branch template depending on how you set it up var branchId = ... // ID of your branch template var parentItem = ... // parent item under which the branch should be created as a child var newItemId = ... // ID of the item to create ItemManager.AddFromTemplate(newItemName, branchId, parentItem, newItemId); The above call to the static Sitecore.Data.Managers.ItemManager.AddFromTemplate(string, ID, Item, ID) method will allow you to create an item with a specific ID and branch. Note that the non-static methods Sitecore.Data.Items.Item.Add(string, BranchItem) and Sitecore.Data.Items.Item.Add(string, BranchId) both call the static method, above.
Create an item with a specific ID and Branch I found an article showing how to create an item using a branch. https://briancaos.wordpress.com/2009/12/01/creating-items-from-branches-in-sitecore/ I found another article showing how to create an image and being able to specify the new item's ID. http://mixedsitecore.blogspot.com/2014/08/creating-new-item-with-specific-id.html I can't find how to create a new item with a specific ID and a branch. Can I assign a branch after creating the item? Can I change an item's ID after it's created?
I managed to find out how these fields were getting their values defaulted. There was custom code written in our solution that hooked into the OnItemCreated event. The code was checking for this specific template and setting the item fields based on some custom logic. It was something similar to this.
Why are new content items created in the content editor populated with data not in the __Standard Values of the template in Sitecore 7.2? In Sitecore 7.2 I am having an issue in the Content Editor where when I add a new item based off of a template that has no __Standard Values the fields are being populated with data from an unknown source. This is a very simple image of what is happening but as you can see the Quantity field has a value of "1" upon creation of the item but there is no Quantity default value set on the __Standard Values template.
The issue was related to the execution of the InitializeCSSite powershell command which failed to import the profile. To address this issue I had to import the profile.xml schema manually following the instructions on this link. The profile schema can be found at the website's root under the path: Website\SitecoreCommerce\Data\Profiles\Profiles.xml In case you are wondering this xml file is part of the Storefront package installation so you should have it.
Commerce server issue: Can't authenticate on the website After installing commerce server I tried to authenticate on my local site and got the following message: The requested profile could not be retrieved because the key name provided does not exist or is not an indexed property. The profile type is 'UserObject'. The key name provided is 'GeneralInfo.ExternalID'. I have run the deployment of the ProfileDatabase.dacpac with a successfully deployed message as per the guideline I ran into this blog post and tried it but it did not work. The interesting thing is that the profiles database did have the u_external_id property on the table UserObject. However, if I open the commerce server manager and browse to the data sources and profile definitions, the external id property was not there as the post suggests. I added it but it didn't work. Anyone know what I'm missing?
Problem is with: if (Sitecore.Context.Item == null) in your code. After ItemResolver is executed, that will be never null for Sitecore items. That's why you only see this hit for VisitorIdentification. If you want your code to be executed when Sitecore "page" is loaded, change your code to if (Sitecore.Context.Item != null) { ... }
Implementing redirect url feature in the ItemResolver pipeline I'm working on a redirect url feature and have added a pipeline processor after the ItemResolver. However the value of HttpContext.Current.Request.Url.LocalPath equals "/layouts/system/VisitorIdentificationCSS.aspx" rather than the value typed in the address bar. If I patch before the ItemResolver it works. If I disable @Html.Sitecore().VisitorIdentification() from my view the pipeline is never hit for as long as it's after ItemResolver. Any idea what this relates to? I'm not sure if it relates to the license not including xDB public override void Process(HttpRequestArgs args) { if (args.Context.Request.Url.OriginalString.ToLower().Contains(‌​"/sitecore")) return; if (Sitecore.Context.Item == null) var path = HttpContext.Current.Request.Url.LocalPath; }
It's not an error. It's a warning message. It means that item has a workflow applied and it's not in the final state yet. Check Workflow state field of your item: In the Review tab of your ribbon you should see something like Approve button. Click it to move it to the final step of your workflow.
Getting error message in Sitecore item I am getting below error while publishing Sitecore item. If you publish now, the selected version will not be visible on the Web site because it is not in the final workflow step. No other version will be published. Just wanted to know, why i am getting this?
Yes its actually very simple. You need to set the following settings: Xdb.Enabled set to false Xdb.Tracking.Enabled set to true That will disable Xdb, but still allow the personalization rules to run on renderings. Note that this applies to 8.1 and above only. In 8.0 you would have to keep Xdb.Enabled set to true and remove the MongoDb connection strings. It will generate a lot of errors in the logs and is not a supported way of running it. But it does work. Since Sitecore 9.x, you must also disable EXM otherwise you will see Tracker errors in the log. To disable EXM: Open the web.config file and in the <appSettings> section, in the <add key="exmEnabled:define" value="yes"/> setting, change the value to "no". Disabling xDB like this means, you do not need an xDB license. References: Sitecore in CMS Only Mode Enable/disable the xDB and the tracker in Sitecore 9.0+
Is it possible to use any personalisation rules without xDB Is it possible to make use of any of the component personalisation rules without xDB being enabled? e.g. to swap/hide a component depending on the current date? I'm not interested in tracking the outcome or any other factors, just alternating the presentation on certain conditions.
Firefox and IE or Edge are known to be most stable for Sitecore administration, that is, the Sitecore back office. I have saw this at the following link: Practical Sitecore 8 Configuration and Strategy: A User Guide for Sitecore Moreover, some users experienced Modal box issues on Chrome. A statement from Sitecore knowledge base: Sitecore versions prior to Sitecore CMS 7.1 might be not working properly in Chrome 37 and later due to the deprecated support for modal dialog boxes in these versions of Chrome. Source: Sitecore knowledge base But it was supposed to be fixed in latest Sitecore versions. It might be related to a JavaScript issue since I have seen in some Sitecore JS files, it caters for different browser (Firefox, IE, Chrome). UPDATE Though, it might also due to your display resolution. The JavaScript function will take into account the window which is then used to calculate the dialog width and height.
Small dialog in chrome I'm using Sitecore for a few months and in most of the cases that Sitecore shows me a dialog, the dialog is really small and I have to change the height through the developer tools. This is an image to show how I see the dialogs. In Microsoft Edge, the dialog is shown with the right size and in a coworker computer, the dialog on Chrome is shown with the right size too. My specification: Windows 10 installed on Bootcamp partition of a Macbook Pro Retina display Chrome version 56.0.2924.87 (64-bit) Display Settings: Macbook screen: 2880x1800 (at 200%), Second Monitor: 1366x768 (at 100%). Must say that in both monitors the problem is the same. In Chrome incognito also happens. I hope you can help me with this.
So for Sitecore - a global error handler in the global.asax will not work properly. The better way to do it is to override the code that calls each rendering and handle the errors there. ExecuteRenderer With a simple override of ExecuteRenderer we can easily catch all exceptions: public class ExecuteRenderer : Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer { public override void Process(RenderRenderingArgs args) { try { base.Process(args); } catch (Exception ex) { args.Cacheable = false; // TODO: Log the error here and deal with how you want to display it to the user Log.Error(ex.Message, ex, this); } } } Notice that we are setting args.Cacheable = false - that means that this error handler will work nicely with cached renderings too. To enable it, simply patch the processor in, replacing the existing one: <?xml version="1.0"?> <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <pipelines> <mvc.renderRendering> <processor type="Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer, Sitecore.Mvc"> <patch:attribute name="type">Sitecore.Exception.Handler.Pipelines.Response.RenderRendering.RenderRendering.ExecuteRenderer, Sitecore.Exception.Handler</patch:attribute> </processor> </mvc.renderRendering> </pipelines> </sitecore> </configuration> Now you have a global error handler, that will trap errors per rendering. This allows the rest of the site to continue to load nicely and just hides the offending rendering. For more detail and some more ideas, see my original blog post here Sitecore Rendering Exception Handling
Handle all Custom Errors in Sitecore MVC I've edited a patched a pipeline using the following bit of code. <sitecore> <pipelines> <mvc.exception> <processor type="Sitecore.Mvc.Pipelines.MvcEvents.Exception.ShowAspNetErrorMessage, Sitecore.Mvc"> <patch:attribute name="type">ProjectName.PublicSite.Web.App_Pipelines.ExceptionHandler.ExceptionHandler, ProjectName.PublicSite.Web</patch:attribute> </processor> </mvc.exception> In addition, I've created the following class to handle things that fall in the mvc.exception pipeline. namespace ProjectName.PublicSite.Web.App_Pipelines.ExceptionHandler { using Sitecore.Mvc.Pipelines.MvcEvents.Exception; using Sitecore.Diagnostics; using System.Configuration; using System.Web.Configuration; public class ExceptionHandler : ExceptionProcessor { public override void Process(ExceptionArgs args) { var context = args.ExceptionContext; var httpContext = context.HttpContext; var exception = context.Exception; if (context.ExceptionHandled || httpContext == null || exception == null || !httpContext.IsCustomErrorEnabled) { return; } else { Log.Error(exception.Message, exception); httpContext.Server.ClearError(); string redirect = "/error"; httpContext.Response.Redirect(redirect, false); } } } } The problem that I'm having is that this only handles certain exceptions that can occur, as detailed here and here. I'd like to handle other exceptions that can arise. I've tried adding the following code to the Global.asax.cs file. protected void Application_Error (object sender, EventArgs e) { Sitecore.Diagnostics.Log.Error("This is an error.", sender); } However, I'm not able to get it to hit when I throw an exception in the code. My overall goal is to be able to log any exceptions that may occur in the Sitecore logs.
I ended up attacking this from the solr side. In the solrconfig.xml I added an invariant to rows and after a rebuild the site is working as expected. It looks like this: <requestHandler name="/select" class="solr.SearchHandler"> <!-- default values for query parameters can be specified, these will be overridden by parameters in the request --> <lst name="defaults"> <str name="echoParams">explicit</str> </lst> <lst name="invariants"> <int name="rows">500000</int> </lst> </requestHandler> Thanks for sharing what config on the sitecore side sets the max int value-I was curious on how to do this on the client side of the request so I wouldn't have to hard code an invariant in solr.
SOLR Cloud error "The remote server returned an error: (500)" I'm trying to setup SOLR Cloud to work with my Sitecore 8.2 (original release) instance. I'm doing this because our analytics index has gotten to the point where our massive SOLR box (90 Gb RAM, 16 Processors) can't handle the load. The SOLR Documentation recommends using the SOLR Cloud configuration so that we can split the index up among different boxes. Here's the error that we are getting from the Sitecore log: 8416 08:54:21 ERROR <?xml version="1.0" encoding="UTF-8"?> <response> <lst name="responseHeader"><bool name="zkConnected">true</bool><int name="status">500</int><int name="QTime">2</int><lst name="params"><str name="q">(_template:(e07c277f59684cc097bc8b3195159f56) AND associated_articles_sm:(90e745382dcd439bb507f7af92a2ce56))</str><str name="fq">_indexname:(sitecore_web_index)</str><str name="rows">2147483647</str><str name="version">2.2</str></lst></lst><lst name="error"><str name="trace">java.lang.NegativeArraySizeException at org.apache.lucene.util.PriorityQueue.&amp;lt;init&amp;gt;(PriorityQueue.java:63) And here's another part of the error: Source: SolrNet at SolrNet.Impl.SolrConnection.Get(String relativeUrl, IEnumerable`1 parameters) at SolrNet.Impl.SolrQueryExecuter`1.Execute(ISolrQuery q, QueryOptions options) at Sitecore.ContentSearch.SolrProvider.LinqToSolrIndex`1.Execute(SolrCompositeQuery compositeQuery, Type resultType) Nested Exception Exception: System.Net.WebException Message: The remote server returned an error: (500) Internal Server Error. Source: System at System.Net.HttpWebRequest.GetResponse() The odd thing is that when we try to access the SOLR server from that same machine, we don't have any issue doing that at all. We have the ZooKeeper configured properly, behind an IIS Site that acts as a load balancer for the ZooKeeper/SOLRCloud instances. Most of the site seems to work properly, but there are a couple of indexes that don't appear to be working correctly, and this error seems to be why. I've also looked at this link but it's not helped to solve my problem. We are running the latest version of 6.x for SOLR. I don't know if that contributes to anything else or not. I'm not sure what my next steps need to be to help figure out what is wrong with my SOLR configuration. This does seem to be a SOLR Cloud configuration issue, as I'm running everything fine in my test environment which is running just a standard version of SOLR. How do I begin figuring out what is going on with this? Thanks! Update To answer the questions asked, I was able to send this query with no problems: http://MySolrIP:8983/solr/sitecore_web_index/select?indent=on&amp;wt=json I was also able to make this query without any errors as well: http://MySOlrIP:8983/solr/sitecore_web_index/select?indent=on&amp;q=_template:(e07c277f59684cc097bc8b3195159f56)&amp;associated_articles_sm:(90e745382dcd439bb507f7af92a2ce56)&amp;rows=50&amp;wt=json I'm thinking that it might be related to this error that we're seeing in the Sitecore logs: 2017-03-08 03:06:15.487 ERROR (qtp1983747920-9187) [c:mediaframework_ooyala_index s:shard2 r:core_node1 x:mediaframework_ooyala_index_shard2_replica1] o.a.s.h.RequestHandlerBase java.lang.NegativeArraySizeException at org.apache.lucene.util.PriorityQueue.<init>(PriorityQueue.java:63) at org.apache.lucene.util.PriorityQueue.<init>(PriorityQueue.java:44) at org.apache.solr.handler.component.ShardFieldSortedHitQueue.<init>(ShardFieldSortedHitQueue.java:45) at org.apache.solr.handler.component.QueryComponent.mergeIds(QueryComponent.java:979) at org.apache.solr.handler.component.QueryComponent.handleRegularResponses(QueryComponent.java:763) at org.apache.solr.handler.component.QueryComponent.handleResponses(QueryComponent.java:742) at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:428) at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:166) at org.apache.solr.core.SolrCore.execute(SolrCore.java:2306) at org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:658) at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:464) at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:345) at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:296) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1691) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213) at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134) at org.eclipse.jetty.server.Server.handle(Server.java:534) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95) at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93) at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303) at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148) at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671) at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589) at java.lang.Thread.run(Thread.java:745) Possibly unrelated, but maybe not, when we started running the query in the GUI we are now seeing this warning in the logs: 2017-03-08 17:05:42.511 WARN (qtp1983747920-15) [c:sitecore_web_index s:shard1 r:core_node3 x:sitecore_web_index_shard1_replica1] o.e.j.h.HttpParser bad HTTP parsed: 400 HTTP/0.9 not supported for HttpChannelOverHttp@77faac88{r=0,c=false,a=IDLE,uri=null} Thank you for your help!
Ok, this is a bit tricky - as there are a lot of different actors in play here - and I don't know exactly where you are patching in, and expecting what result. However, let's list them. StripLanguage Processor sits in the <preprocessRequest> pipeline. Will internally rewrite your URL if it finds a language string embedded. So if your query string contains /en, it will be rewritten to /?sc_lang=en. If it does not find a language string, this processor does nothing. The processor can be entirely disabled by the setting AlwaysStripLanguage on your LinkManager. If you are overriding language resolution logic, I recommend doing this - or removing the processor entirely. SiteResolver The resolver you have patched into, if I'm reading you right. No secondary language handling has happened at this time. If you do any redirect at this point in time, no language selection or change you make will never take permanent effect. That is to say, this depends a little bit on how you set it - please share the code to clarify. LanguageResolver Sits after SiteResolver. Will look for sc_lang=value in the querystring and set Context.Language if found. Context.Language will in turn set both Context.Items[&quot;sc_language&quot;] and drop a language cookie - if a Site` has been identified. Context.Language Assuming none of the above have done anything, the default behaviour of Context.Language is to first look at Context.Items[&quot;sc_language&quot;] and use it if found. If not found, it will look for a site language cookie (default sitename#lang). If one is found, use that language. In summary So? Can it be done? Yes. Your scenario can be achieved, but I'm not sure you're a) patching in the right places, and b) fully adhering to how language resolving is supposed to work. Based on what I know from your question I would suggest you patch in just before the ItemResolver. Check language settings at this point, and redirect specifically to the site you want. Alternatively Patch in where you do now, on SiteResolver level. Be aware that, at this point, Context.Language will operate on defaults per the previous page request unless StripLanguage has detected a language and rewritten the url. If it has (which it would have, for /en, Context.Items[&quot;sc_language&quot;] will have a value, same as Context.Language. And I do apologise if this seems confusing; it really is slightly... cryptic, the way this is handled. I can probably give you a better and more direct answer, if I knew exactly how you patched in and the code you are injecting to the pipelines.
Http Request.RawUrl has DefaultLanguage "en" Sitecore Background: We have 4 multi-lingual sites. Objective: When the language is embedded in the url, it should take the user to that specific site, and not the site stored in the cookie, and it should update the cookie accordingly. When there is no language specified in the url, it should take the user to the site specified in the cookie or look up the GeoIp. Issue: When we do not mention the language in the url, it defaults to 'en' always, even for a new user. This happens because HttpContext.Current.Request.RawUrl always has a value"/en" when no language embedded in the url. We are resolving this at the SiteResolver processor in the HttpRequestBegin pipeline. After debugging some more, it also seemed to be an issue at the NormalizeRawUrl processor of the preprocessRequest pipeline. Not sure how to capture the exact URL entered in the browser using HttpContext.Current.Request Is this Objective achievable? Has someone gone through similar issues and how did you tackle this problem? Example: www.xyz.com/en-ca/abc ---> This will take us to Canada website. HttpRequest.current.Request.RawUrl value is: "/en-ca/abc" www.xyz.com ---> This should ideally take us to Canadian website because 1) No language specified in the url. 2) The cookies were set in the previous url. HttpRequest.current.Request.RawUrl value is: "/en" where as we expect it to be "/" or "". Thanks in advance. Ashita Here is the code snippet that we use: //First: we try and take the site from the Querystring: KEY_SITE: "site" KEY_SITE_NAME: "sc_site" var queryString = HttpContext.Current.Request.QueryString; siteSpecified = string.Empty; if (!string.IsNullOrEmpty(queryString[QuerystringUtil.KEY_SITE])) { siteSpecified = queryString[QuerystringUtil.KEY_SITE]; } else if(!string.IsNullOrEmpty(queryString[QuerystringUtil.KEY_SITE_NAME])) { siteSpecified = queryString[QuerystringUtil.KEY_SITE_NAME]; } else { var siteLng = new Dictionary<string, string> { {"en", "site-us"}, {"en-ca", "site-ca"}, {"en-gb", "site-uk"}, {"en-au", "site-au"} }; //Second: This is piece where we read from the RawUrl which defaults to EN when no language specified foreach (var sl in siteLng.Where(sl => HttpContext.Current.Request.RawUrl.ToLower().Contains("/" + sl.Key))) { siteSpecified = sl.Value; } SiteContext context; if(!string.IsNullOrWhiteSpace(siteSpecified)) { context = Factory.GetSite(siteSpecified); } Language lang; if(context != null &amp;&amp; context.IsCustomSite() &amp;&amp; context.Language != null) { lang = Language.Parse(context.Language); } KeyValuePair<SiteContext, Language> kvp = new KeyValuePair<SiteContext, Language>(); if(lang != null) { kvp = new KeyValuePair<SiteContext, Language>(context, lang); } if(kvp.Key != null &amp;&amp; kvp.Value != null) { SettingSite(kvp); return; } //Third: We try to retrieve from the cookie kvp = GetSiteFromCookie(); if(kvp.Key != null &amp;&amp; kvp.Value != null) { SettingSite(kvp); return; } //Fourth: We try to get it from GeoIP kvp = GetSiteFromGeoIP(); if(kvp.Key != null &amp;&amp; kvp.Value != null) { SettingSite(kvp); return; } //SettingSite Function looks like below: private void SettingSite(KeyValuePair<SiteContext, Language> siteAndLanguage) { if (siteAndLanguage.Key == null || siteAndLanguage.Value == null) { return; } if (VerifyContext(siteAndLanguage.Value, siteAndLanguage.Key) &amp;&amp; VerifyCookie(siteAndLanguage.Value, siteAndLanguage.Key)) { return; } if (!siteAndLanguage.Key.IsCustomSite()) { return; } Language language; if (HttpContext.Current.Request.Url.Segments.Any()) { language = Sitecore.Context.Data.FilePathLanguage; } if (language != null &amp;&amp; language.Name != siteAndLanguage.Value.Name) { string newUrl = ReplaceLanguageInUrl(siteAndLanguage.Value); HttpContext.Current.Response.Redirect(newUrl, true); } else { CookieUtil.SetSiteLanguageCookie(site.Name, language.Name); Sitecore.Context.SetLanguage(language, true); Sitecore.Context.SetActiveSite(site.Name); } }
You can use Sitecore XGenerator for generating analytics data. More information you can find on Sitecore Github Repository Experience Generator Generate "realistically looking" traffic for the Sitecore Experience Database (xDB) with configurable patterns, including: Trends over time Identified contacts with multiple visits Bounce rate Geo location Landing pages Channels Referrers Internal and external search Outcomes Campaigns Experience Profile Generator Generate visits for Sitecore contacts (xProfile) with configurable settings: Contact information Visit pages Recency Outcomes Geo location Goals Channel
Generating test data for Sitecore Analytics I need to test Sitecore Analytics. Someone have any idea or tip how can I configure and generate fake data in Sitecore Analytics? Because only one person acessing the pages or campaigns, I cannot see any result in the reports.
In SPE there is a special password field. You can find this example here: /sitecore/system/Modules/PowerShell/Script Library/Getting Started/User Interaction/Read-Variable - Sample After you get credentials from the user then you can validate whether credentials are valid using ValidateUser method from Sitecore.Security.Authentication.AuthenticationHelper (Remember about domain name) $obj = New-Object -TypeName Sitecore.Security.Authentication.AuthenticationHelper $valid = $obj.ValidateUser("sitecore\admin","b")
Sitecore Powershell: Is it possible to prompt user for their password? I'm creating a Context Menu script to allow deletion of languages on my content tree. When the user elects to run this script, I want to prompt them for their password as a confirmation mechanism, similar to the "elevate" mechanic. Is this possible, and how would it be achieved? These users are not administrators, just general content authors. Here's the gist of my script: $location = get-location $languages = Get-ChildItem "master:\sitecore\system\Languages" $currentLanguage = [Sitecore.Context]::Language.Name $langOptions = @{}; foreach ($lang in $languages) { $langOptions[$lang.Name] = $lang.Name } $result = Read-Variable -Parameters ` @{ Name = "language"; Value=$currentLanguage; Title="Language to Remove"; Options=$langOptions; }, @{ Name = "includeSubitems"; Value=$false; Title="Include Subitems"; Columns = 4;} ` -Description "Select the language to remove" ` -Title "Remove Language" -Width 650 -Height 360 -OkButtonName "Proceed" -CancelButtonName "Cancel" -ShowHints if($result -ne "ok") { Exit } $items = @() $items += Get-Item $location # add optional subitems if ($includeSubitems) { $items += Get-ChildItem $location -Recurse } $proceed = Show-Confirm -Title "Are you sure?" # Prompt user here for their password to verify execution if ($proceed -ne 'yes') { Write-Host "Canceling" Exit } $items | Remove-ItemLanguage -Language $language
In this context, domains does not refer to security domains, rather controlled area. Pipeline groups could be used for namespacing your pipelines, for example when creating custom pipelines to ensure they do not conflict with other custom pipelines, however this can already be achieved otherwise (and more elegantly) when naming your pipeline, as pointed out my Mark Cassidy. A more useful usecase, as you suggest, is that it opens up for creating tenant specific, site specific or even more granular pipelines. When running a pipeline, you can now specify a pipelineDomain (from Sitecore.Abstractions.dll): namespace Sitecore.Abstractions { public interface ICorePipeline { void Run(string pipelineName, PipelineArgs args); void Run(string pipelineName, PipelineArgs args, bool failIfNotExists); void Run(string pipelineName, PipelineArgs args, string pipelineDomain); void Run(string pipelineName, PipelineArgs args, string pipelineDomain, bool failIfNotExists); } } By namespacing your pipelines, for example with tenant or site, combined with the failIfNotExists flag, you could create some quite powerful and flexible pipeline-based modules.
What should I be using pipeline groups for? Sitecore 8 gave us all sorts of handy new tools, including the ability to group pipelines, like so: <pipelines> ... <group groupName="mygroup" name="mygroup"> <pipelines> ... </pipelines> </group> ... </pipelines> What I am trying to determine is whether or not the ability to group pipelines is just (super useful) syntactical sugar, meant to make organizing and maintaining custom pipelines (e.g. for modules), or if there is a specific time when grouping pipelines adds the ability to do something that one wouldn't otherwise be able to do. One of the things that has been throwing me is the fact that the Sitecore API refers to the name of the pipeline group as the pipelineDomain. When I think of "domains", I think of domains in Sitecore, I think of security domains. Looking at the Sitecore code-base, I see that in DefaultCorePipelineManager Sitecore actually resolves the pipeline by combining the pipelineName and pipelineDomain like so: string str = pipelineGroup + "\\" + pipelineName CorePipeline pipeline = (CorePipeline) this.pipelines[(object) str]; To me, this actually looks like it is used somewhat like a security domain. I understand the namespacing construct doesn't directly provide much beyond some additional flexibility in naming, but it occurs to me that this could be used for things like creating tenant or site-specific pipelines, and beyond. My question is: when is it best to use a pipeline group, and should I be using it for things like tenant or site-specific pipelines?
Sitecore jobs is the best option in such case, but you can use them in different ways. Best approach for using them may vary by business requirements, like frequency of user logins and the time frame in which you want to update profiles. Below are some approaches - Once the user is logged in, create a job to update that user's profile data. In case there are multiple users are getting logged in, their jobs will get queued. Note: Sitecore allows maximum 20 Worker Threads to be created at a time. So, when there are 20+ jobs, it may get stuck or degrade performance. In such case, you can set more number of a worker threads by adding below setting to config, but you never know how many users can get logged in at a time. <setting name="MaxWorkerThreads" value="100"/> As an alternate, You can also create jobs in separate threads by setting ExecuteInManagedThreadPool property of JobOptions to false. This will give freedom from the predefined limit of worker threads. Another better alternative is (depends on how much time you need to update profile data) - When user logs in, add its details to a static C# Queue. Run a scheduler every few minutes to update their profile data. This will create only one job for multiple users.
Running asynchronous tasks to update user profile I am looking for the best way to synchronize profile data from an external system. We authenticate users using an external authentication service. We use the Sitecore virtual user mechanism to log into Sitecore. Once a user is logged in we need to call a back-office service to get the user profile information. We intend to sync this information with the Sitecore Contact (in XDb). I want the synchronization of profile data to run as an asynchronous process because the backend service is slow and takes some time to respond. Also potentially we can have a lot of people log in at the same time. We do not need the profile data immediately (but as soon as possible). The obvious way to fire an asynchronous task would be to use a Sitecore Job. This would mean that I would fire off a job to synchronize profile data every time a user logs in. I am afraid that this will have a negative impact on performance when lots of users log in and it is not clear to me how these Jobs are prioritized. I think I am looking for some sort of queuing system (more or less like the Sitecore publishing queue) to handle these tasks. The event queue does also not seem to meet my requirements since this is actually more a messaging than a queuing mechanism. What would be the best solution to handle this requirement? Preferably keeping as close to Sitecore as possible.
You can use Sitecore Wildcard item. For that, create an item with name of * inside /Home/Statistics item (/sitecore/content/Home/statistics/*). Remember, the * item (wildcard item) should not have any sibling. And, assign required presentation details to the item to show relevant statistics. Now, when you request the page e.g. http://example.com/statistics/january, you will get the page context, and based on the parameter (january/fabruary, etc.) you can use your renderings to change content accordingly. Read more on - http://blog.martinmiles.net/post/wildcard-items-pages-with-mvc-passing-the-correct-datasources-based-on-requested-item-url
How to pass dynamic parameters to a Sitecore page via the URI? On our website we have a page which is accessible via a path like: www.example.com/statistics We would like this page to show different content based on the URI, e.g. www.example.com/statistics/january www.example.com/statistics/february How can I implement this? If the parameters were static I could set-up Redirects, but in this case they are fully dynamic. I also need to keep the URI after the user loads the page, so it cannot change back to /statistics during loading.
I think i found the answer myself. I'm not really sure why it works, but apparently it does work: criteria = x => ((DateTime)x[(ObjectIndexerKey)FieldName]) >= StartDate; I think the difference with the original code is: The original code is parsing the value of the field as DateTime, and then doing the comparison, while the solution, marks the field as a DataTime object, to later do the comparison. Similar, but not the same. I'm happy to accept somebody else's answer if it includes a better explanation ;-)
How to search by a date with ContentSearch and IObjectIndexers I have a generic search method which should be able to search based on any field. I have something like this: criteria = x => x[FieldName] == fieldValue; This works well for strings but, how can I use it for a value of type DateTime greater than? We have tried something like this but doesn't work. criteria = x => DateTime.Parse(x[FieldName]) >= EndDate); Any idea?
If you use Sitecore PowerShell Extensions you can make this process faster by wrapping it in an EventDisabler SPE has a Remove-ItemVersion cmdlet that lets you select the language(s) versions and also the max number of recent versions to keep. This means you don't need to archive and restore the needed versions. This code assumes v4+ of SPE: New-UsingBlock(New-Object Sitecore.Data.Events.EventDisabler) { Remove-ItemVersion -Path master:\content\home -Language "en", "en-GB" -MaxRecentVersions 5 } You could script this to remove versions on specific items. There is also a -Recurse flag on the cmdlet that will remove versions on the specified item and all child items too. If you wanted to be able to select an item in the content tree and provide a right click menu option to remove the versions, you could create a module to do this. Here is an example of how to do that.
Many hours to delete 670 old versions of an item - Sitecore 7.2 So, it turns out the home page of our site has 670 versions so Im looking at removing or archiving most of them. In the Sitecore content editor, if I select Remove all versions (plan is to archive needed versions and restore them), the process is long. Running overnight, it deleted around 200 versions as seen in the [History] db table. Strangely I can see 4 RemovedVersion rows for each version removed in this table with a minute or twos gap between the admin and Anonymous rows so it runs very slow: ItemVersion ItemPath UserName TaskStack RemovedVersion en 209 /sitecore/content/Corporate/Home sitecore\Anonymous [none] RemovedVersion en 209 /sitecore/content/Corporate/Home sitecore\Anonymous [none] RemovedVersion en 209 /sitecore/content/Corporate/Home sitecore\admin Sheer RemovedVersion en 209 /sitecore/content/Corporate/Home sitecore\admin Sheer
Lol i finally found a way. If you didnt want to make custom field and you are sure that your datepicker default value will be empty on all your WFFM form. The easiest way is to changed it in datepickerfield.cshtml by editing: @Html.TextBox("Value", currentDate.ToString(Model.DateFormat), new { @readonly = "", @class = "field-datepicker" }) to: @Html.TextBox("Value", null, new { @readonly = "", @class = "field-datepicker" })
how to remove default value in date picker WFFM WFFM has a date picker with default value in it, i want to make form that didn't display any values when load for the first time. Im thinking about making the val('') in custom script: $scw(document).ready(function(){ $scw("#Vg-0a47Mo0irbuy6Osdada_Sections_0__Fields_6__Value").val(''); }); But if i clicked submit and there is still other field error, it erase the value of date picker. Any solution?
Scroll to the bottom for the updated answer This format (with T in the middle and ending with Z) is called by Sitecore ShortIsoDateTime. I don't know if that is official name of it or not. You can get it using Sitecore.DateUtil.GetShortIsoDateTime(dateTime) method. There are more formats which are used by Sitecore. Sitecore.DateUtil class is a really good place to learn more about them. And there is a guide on Sitecore Docs: Date/time best practices EDIT: Z character is added only if if (datetime.Kind == DateTimeKind.Utc) str += "Z"; EDIT 2: Just run a test: DateTime dateTime = DateTime.Now; string string1 = Sitecore.DateUtil.GetShortIsoDateTime(dateTime); // string1 is 20170310155908 dateTime = Sitecore.Common.DateTimeExtensions.SpecifyKind(dateTime, DateTimeKind.Utc); string string2 = Sitecore.DateUtil.GetShortIsoDateTime(dateTime); // string2 is 20170310155908Z EDIT 3: You are right. I was wrong since the beginning. The correct answer is: This format is called by Sitecore IsoDate: DateTime dateTime = DateTime.Now; string dateTimeString1 = Sitecore.DateUtil.ToIsoDate(dateTime); // dateTimeString1 == "20170310T162500" dateTime = Sitecore.Common.DateTimeExtensions.SpecifyKind(dateTime, DateTimeKind.Utc); string dateTimeString2 = Sitecore.DateUtil.ToIsoDate(dateTime); // dateTimeString2 == "20170310T162500Z"
What is the datetime format used by Sitecore's Date / DateTime field types and how can I generate this from a regular DateTime object When I turned on "Raw values" in Sitecore to examine a Date (or DateTime) field, I see a string in the form 20170310T130700Z Looking at the regular .Net DateTime type, I don't see a standard format option which reproduces this format. See here https://msdn.microsoft.com/en-us/library/zdtaw1bw(v=vs.110).aspx What is an easy way to generate this format from a regular DateTime object and what is the name of this format used by Sitecore?
Let me start by saying that I believe that this is a bug in Sitecore, and the results of our peer debugging session have strengthened that belief. Solution/Workaround You should be able to work around this issue by adding an asterisk (*) to the hostName of the <site> definition node for your site, and leaving the targetHostName blank, as you currently have it. For example, you could do: <site hostName="*brandname.local" ... targetHostName="" /> What this is going to do is force the LinkProvider.GetServerUrlElement(...) method to return a relative URL, as it will not have enough information to parse the actual server URL. The method is smart enough to recognize the asterisk in the hostName and knows that it cannot strip it from or use the property's value. Analyzing the Workaround and the Bug Note that this workround was found after an hour of mental variable substitution, which I did - at first - attempt to include here, but the post became far too long. I will leave it to you to do the variable substitution on your own, and will instead discuss specific parts of the substitution that are particularly critical to the solution and understanding the bugs. For starters, let's have a look at the below snippet, noting that I have added "markers" in comments to help identify different pieces of logic in our discussion: // Marker 1 if (!this.AlwaysIncludeServerUrl &amp;&amp; siteInfo.Name.Equals(str1, StringComparison.OrdinalIgnoreCase) &amp;&amp; hostName.Equals(str4, StringComparison.OrdinalIgnoreCase) || (string.IsNullOrEmpty(str4) || str4.IndexOf('*') >= 0)) return str2; string scheme = this.GetScheme(); StringComparison comparisonType = StringComparison.OrdinalIgnoreCase; // Marker 2 if (str4.Equals(hostName, comparisonType) &amp;&amp; defaultValue == port &amp;&amp; str5.Equals(scheme, comparisonType)) return str2; // Marker 3 string str6 = str5 + "://" + str4; // Marker 4 if (defaultValue > 0 &amp;&amp; defaultValue != 80) str6 = str6 + ":" + (object) defaultValue; return str6; Reverse Engineering The OP gives us a pretty good amount of information with which to debug this issue, including giving us the exit points for each scenario. Scenario 2 Scenario 2 works correctly, and returns inside the conditional at Marker 2: // Marker 2 if (str4.Equals(hostName, comparisonType) &amp;&amp; defaultValue == port &amp;&amp; str5.Equals(scheme, comparisonType)) return str2; The returned value is stored in the variable str2 which means, since we are looking for a relative URL - which Scenario 2 has - and a relative URL should have an empty string for a server URL, that str2 is equal to string.Empty. We can validate this by looking up in the method and seeing that the following line is used to set str2: string str2 = this.AlwaysIncludeServerUrl ? WebUtil.GetServerUrl() : string.Empty Since we know that AlwaysIncludeServerUrl is false and the value of str2 is never modified so long as AlwaysIncludeServerUrl is false, we know that with or without the workaround str2 holds the value we want to return. Given the above and what we know from the OP, we can conclude that all of the following are true before getting to Marker 2: // returned value str2 == string.Empty // required based on AND logic str4 == hostName defaultValue == port str5 == scheme Scenario 1 Let's now have a look over at Scenario 1, which returns after Marker 4. The first thing we will do is have a look at Marker 3, where the variable with th return value is initialized, and the conditional at Marker 4. // Marker 3 string str6 = str5 + "://" + str4; // Marker 4 if (defaultValue > 0 &amp;&amp; defaultValue != 80) str6 = str6 + ":" + (object) defaultValue; return str6; Looking at the returned value in the OP, ://brandname.local, and the fact that we know that str6 holds the returned value, we can conclude that all of the following are true before Marker 3: // nothing before the "://" in the returned value str5 == string.Empty // value after the "://" in the URL str4 == "brandname.local" // there is no port number appended to the returned value defaultValue <= 0 || defaultValue == 80 Looking at the Rest of the Method: Just looking at what we have analyzed from the exit points of Scenario 1 and Scenario 2, we do not yet have enough information to find the workaround. Have a look at the conditional at Marker 1: // Marker 1 if (!this.AlwaysIncludeServerUrl &amp;&amp; siteInfo.Name.Equals(str1, StringComparison.OrdinalIgnoreCase) &amp;&amp; hostName.Equals(str4, StringComparison.OrdinalIgnoreCase) || (string.IsNullOrEmpty(str4) || str4.IndexOf('*') >= 0)) return str2; Note that for both scenarios, this condition evaluated to false. Thus, we know that the following is false: !this.AlwaysIncludeServerUrl &amp;&amp; siteInfo.Name.Equals(str1, StringComparison.OrdinalIgnoreCase) &amp;&amp; hostName.Equals(str4, StringComparison.OrdinalIgnoreCase) || (string.IsNullOrEmpty(str4) || str4.IndexOf('*') >= 0) Substituting in what we know from the OP and what we have learned so far, we get: !(false) &amp;&amp; siteInfo.Name.Equals(str1, StringComparison.OrdinalIgnoreCase) &amp;&amp; hostName.Equals(str4, StringComparison.OrdinalIgnoreCase) || (string.IsNullOrEmpty(str4) || str4.IndexOf('*') >= 0) If we look at the logic that actually sets str4, we can see that it is set to the return of the GetTargetHostName(...) method, unless that value is null or empty, in which case it falls back to the hostName variable, which is the result of the GetHostName() method, which encapsulates the WebUtil.GetHostName() method. Have a look at the GetTargetHostName(...) method: protected virtual string GetTargetHostName(SiteInfo siteInfo) { Assert.ArgumentNotNull((object) siteInfo, "siteInfo"); if (!siteInfo.TargetHostName.IsNullOrEmpty()) return siteInfo.TargetHostName; string hostName = siteInfo.HostName; if (hostName.IndexOfAny(new char[2]{ '*', '|' }) < 0) return hostName; return string.Empty; } Here, we can see that if siteInfo.TargetHostName value is an empty string, which we know to be the case from the OP, then the hostName is returned so long as it doesn't contain an asterisk or a pipe (|). Otherwise, an empty string is returned. Accounting for EXM Email Execution: The Bug and the Workaround Before reading this section, note that when I first deduced the workaround, I did so by making and then proving/disproving assumptions, in order to "unit test" the method by hand. After doing so and presenting the solution to the OP, we worked together to debug and confirm the hypothesis and identify which assumption case was correct. When EXM sends out emails it does so without a request context. As such. HttpContext.Current.Request is not set, so the return value of the GetHostName() method will be an empty string. This is where the logic bug starts to become apparent: the siteInfo.TargetHostName falls back to the siteInfo.HostName so long as it doesn't contain an asterisk, and the result falls back to the HttpContext.Current.Request.Url.Host, which we know to be empty in our execution, since we are executing via EXM. Look back at the Marker 1 condition that we substituted in the previous section, we can reduce the condition to the following: siteInfo.Name.Equals(str1, StringComparison.OrdinalIgnoreCase) &amp;&amp; hostName.Equals(str4, StringComparison.OrdinalIgnoreCase) || (string.IsNullOrEmpty(str4) || str4.IndexOf('*') >= 0) Substituting in for simpler variables, we can equate this to: A &amp;&amp; B || (C || D) which reduces, like so: A &amp;&amp; B || C || D and if we set foo = A &amp;&amp; B and substitute back in for C and D we get: foo &amp;&amp; string.IsNullOrEmpty(str4) || str4.IndexOf('*') >= 0 The Workaround: So long as one of the last two expressions is true, it doesn't matter what foo is. Looking back at the GetTargetHostName(...) method, str4 should never be set to the siteInfo.HostName if siteInfo.HostName contains an asterisk, and so - since an asterisk is invalid in a URL's hostname and thus cannot come from the Request.Url.Host (whether or not there is a request context) - unless an asterisk is mistakenly put into the siteInfo.TargetHostName expression D can never be true. This leaves us with expression C. We can ensure that str4 is null or empty, by simply adding an asterisk or a pipe to the siteInfo.HostName, since there is no request context. The Bug: The problem here is that the LinkProvider.GetServerUrlElement(...) method does not correctly account for the possibility that the HttpContext could be unavailable. Since this is the case when EXM runs, the LinkProvider.GetServerUrlElement(...) method does not work correctly during EXM email dispatch. Caveats of the Workaround The bit caveat with this workaround is that it requires that you do not set the siteInfo.TargetHostName and that you add an asterisk to the hostName. This means that Sitecore will not be able to generate absolute URLs for any links, unless the code that is generating them has access to the HttpContext. Furthermore, if the site is a multi-site and the code generating the links is supposed to generate them for a different <site> from the current request then the links will be generated for the wrong site. For example, if you are generating a link to the page http://foo.com/some/page and you are making the request from the URL http://bar.com then the resulting link would be http://bar.com/some/page instead of the expected value http://foo.com/some/page. As such if any of the following are true then this workaround may not work for you: Your site is a multi-site and you sometimes generate links for one site on another (as in the example) Your site generates sitemaps using the siteInfo.TargetHostName Your site generates absolute links using siteInfo.TargetHostName Note that you can still work around these caveats using custom processors, like the HandleInternalLink processor, or other logic in your code. However, there is no catch-all solution that will handle these caveats or the solution without extending and overriding the native LinkProvider (see the "Alternative Solution"). Unless you decide that you are going to extend and override the native LinkProvider, I do not recommend adding such code as it will basically be a band-aid on a hemorrhage, and Sitecore Support should be able to provide you with the URL. Next Steps: Sitecore Support Regardless of whether or not this workaround works for you, it should be only temporary. Reach out to Sitecore Support with the issue details and have them provide you with a patch for the LinkProvider, which you can use as a more permanent solution. Alternative Solution in Concept Alternatively, you can create your own LinkProvider to override the Sitecore one, allowing you to fix the bug in the code, directly, without having to deal with the caveats that I described. This is a good bit more involved than it was in previous versions, and I have not tried it myself. Sitecore now registers the LinkProvider using the DI container included with Sitecore. In order to replace it with your own implementation, you will need to add a new <initialize> processor after the native LinkProvider is registered with the container, remove the native LinkProvider registration in your processor and then register your own. This would be the better solution, but it is still a bit black-box to me, as I have been having trouble finding the processor in which the native LinkProvider is registered. Given that, I have listed it only as an alternative solution. Even if you do choose to implement this solution, I still recommend that you reach out to Sitecore Support for a patch to serve as a more permanent solution.
LinkManager returning inconsistent Server Url So, I have a rather complex issue to detail out here. the TL;DR is that Link Manager is returning inconsistent results in the GetServerUrl() method when given what appears to be the same parameters. To set this up, I am using Sitecore 8.2 Update 2 with EXM 3.4 Update 1. I have, for all practical purposes, a vanilla install and setup of both Sitecore and EXM, with the exception of an additional site entry, which is the site that we are working with, and a content Home node. Symptom of Issue Dispatching an Email (Scenario 1) When I dispatch a very simple email from EXM, that contains one link, which is to the Home page of the site that is configured as the EXM Site, the link that is created looks like this: http://brandname.local/sitecore/RedirectUrlPage.aspx?ec_contact_id=1814C7BC2B434DC096F74115AB45104A&amp;ec_message_id=2E6A28769FBB45F2AF36F956FA3B8021&amp;ec_url=%2f%3a%2f%2fbrandname.local%2f The parameter ec_url is the parameter that I am paying attention to. When EXM resolves the Click action, it redirects the user to http://brandname.local/://brandname.local/. That link generates a protection error because you can't have colons in the url past the protocol portion. Site Scheme I am aware that the reason why ://brandname.local/ is created is because the site definition doesn't have the scheme attribute set to http. While that makes this a valid link for the purposes of the redirect, the proper link should be relative, not absolute (if I understand correctly). Expected Result Looking at the Email Message in EXM (Scenario 2) When I look at the email message in EXM (Third Tab[Message] when looking at a dispatch), all of the same pipelines run that generate these links, except that now the link is generated correctly. I also found out that when looking at the email from here, PreviewMode is false, so it creates the same url as if dispatching. By correctly, I mean, because SiteResolving returns the brandname site, and EXM is configured to use the brandname site, the links generated look like this: http://brandname.local/sitecore/RedirectUrlPage.aspx?ec_contact_id=1814C7BC2B434DC096F74115AB45104A&amp;ec_message_id=2E6A28769FBB45F2AF36F956FA3B8021&amp;ec_url=%2f When that is clicked on, it resolves/redirects to http://brandname.local/ which is the expected behavior. Enter LinkManager EXM uses LinkManager to resolve these links. In the HandleInternalLink processor for the <modifyHyperlink> pipeline, you find the following code: DynamicLink result; if (args.Url.IndexOf("~/link.aspx?", StringComparison.InvariantCulture) >= 0 &amp;&amp; DynamicLink.TryParse(args.Url, out result)) { var defaultUrlOptions = LinkManager.GetDefaultUrlOptions(); defaultUrlOptions.SiteResolving = true; defaultUrlOptions.Site = SiteContext.GetSite(args.WebsiteConfigurationName); args.Url = LinkManager.GetItemUrl(new ItemUtilExt().GetItem(result.ItemId), defaultUrlOptions); } Now, becasuse my link in the Rich Text box is a dynamic link that points to a Home item, this processor uses LinkManager.GetItemUrl() to fetch the Url. WebsiteConfigurationName Note that args.WebsiteConfigurationName equals the site name that is configured on the EXM Manager Root. In both Scenario 1 and 2 (because the same Manager Root is being used), this is set to brandname. This maps back to Sitecore's site definition. SiteResolving I am also aware that SiteResolving works best when there is a targetHostName defined on the site definition. LinkManager GetServerUrlElement() Way down the line of LinkManager.GetItemUrl(), LinkManager executes the GetServerUrlElement() method, that does the heavy lifting of creating the server element portion of this. protected virtual string GetServerUrlElement(SiteInfo siteInfo) { SiteContext site = Context.Site; string str1 = site != null ? site.Name : string.Empty; string hostName = this.GetHostName(); string str2 = this.AlwaysIncludeServerUrl ? WebUtil.GetServerUrl() : string.Empty; if (siteInfo == null) return str2; string str3; if (string.IsNullOrEmpty(siteInfo.HostName) || string.IsNullOrEmpty(hostName) || !siteInfo.Matches(hostName)) str3 = StringUtil.GetString(new string[2] { this.GetTargetHostName(siteInfo), hostName }); else str3 = hostName; string str4 = str3; string str5 = StringUtil.GetString(new string[2]{ siteInfo.Scheme, this.GetScheme() }); int defaultValue = MainUtil.GetInt(siteInfo.Port, WebUtil.GetPort()); int port = WebUtil.GetPort(); int num = MainUtil.GetInt(siteInfo.ExternalPort, defaultValue); if (num != defaultValue) { if (this.AlwaysIncludeServerUrl) str2 = num == 80 ? string.Format("{0}://{1}", (object) str5, (object) this.GetHostName()) : string.Format("{0}://{1}:{2}", (object) str5, (object) this.GetHostName(), (object) num); defaultValue = num; } if (!this.AlwaysIncludeServerUrl &amp;&amp; siteInfo.Name.Equals(str1, StringComparison.OrdinalIgnoreCase) &amp;&amp; hostName.Equals(str4, StringComparison.OrdinalIgnoreCase) || (string.IsNullOrEmpty(str4) || str4.IndexOf('*') >= 0)) return str2; string scheme = this.GetScheme(); StringComparison comparisonType = StringComparison.OrdinalIgnoreCase; if (str4.Equals(hostName, comparisonType) &amp;&amp; defaultValue == port &amp;&amp; str5.Equals(scheme, comparisonType)) return str2; string str6 = str5 + "://" + str4; if (defaultValue > 0 &amp;&amp; defaultValue != 80) str6 = str6 + ":" + (object) defaultValue; return str6; } Debugging (using dotPeek Symbol Server) reveals the following portions of the above code are the exits points for each scenario. Scenario 1 Returns "://brandname.local" At string str6 = str5 + "://" + str4; if (defaultValue > 0 &amp;&amp; defaultValue != 80) str6 = str6 + ":" + (object) defaultValue; return str6; Scenario 2 Returns ""(String.Empty) At if (str4.Equals(hostName, comparisonType) &amp;&amp; defaultValue == port &amp;&amp; str5.Equals(scheme, comparisonType)) return str2; Configuration Site Config <site name="brandname" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/BrandName" startItem="/Home" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="1000MB" renderingParametersCacheSize="200MB" xslCacheSize="100MB" filteredItemsCacheSize="200MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" hostName="brandname.local" notFoundPage="/sitecore/content/BrandName/Home/404" itemRedirectPath="/sitecore/content/BrandName/Redirects/ItemBased" legacyRedirectPath="/sitecore/content/BrandName/Redirects/Legacy" patch:source="BrandName.SiteDefintion.config"/> Site, Site Info, defaultUrlOptions The following is the raw output of my debugging session, looking at the three pieces that are used in HandleInternalLink processor: defaultUrlOptions.Site defaultUrlOptions defaultUrlOptions.Site.SiteInfo I have indicated the pieces that are different according to BeyondCompare. Scenario 1 - When the link doesn't generate right defaultUrlOptions.Site "brandname" AllowDebug: true BrowserTitle: "BrandName - Sitecore" CacheHtml: true <--- Different CacheMedia: true <--- Different Caches: {Sitecore.Sites.SiteCaches} ContentDatabase: null "": "" ContentStartItem: "" ContentStartPath: "/sitecore/content/BrandName" Database: {web} <--- Different DefaultDevice: "" Device: "" DictionaryDomain: "" DisableBrowserCaching: true DisableClientData: false DisableFiltering: false DisableWebEditEditing: false DisableWebEditSelecting: false DisableXmlControls: false DisplayDate: {3/10/2017 2:40:34 AM} <--- Different DisplayMode: Normal <--- Different Domain: extranet <--- Different DrawDots: false <--- Different EnableDebugger: true EnableLinkedItems: true EnablePreview: true EnableWebEdit: true EnableWorkflow: false <--- Different FilterItems: false <--- Different HostName: "brandname.local" Language: "en" LoginPage: "" MasterDatabase: null MediaCachePath: "/App_Data/MediaCache/brandname" Name: "brandname" Notifications: {Sitecore.Events.NotificationContext} Page: {Sitecore.Layouts.PageContext} PhysicalFolder: "/" Properties: {System.Collections.Specialized.NameValueCollection} Request: {Sitecore.Sites.SiteRequest} RequireLogin: false Resources: {Sitecore.Resources.ResourceContext} Response: {Sitecore.Sites.SiteResponse} RootPath: "/sitecore/content/BrandName" SiteInfo: "brandname" ("web"#"") StartItem: "/Home" StartPath: "/sitecore/content/BrandName/Home" TargetHostName: "brandname.local" VirtualFolder: "/" XmlControlPage: "/layouts/xmlcontrol.aspx" defaultUrlOptions {Sitecore.Links.UrlOptions} AddAspxExtension: false AlwaysIncludeServerUrl: false EncodeNames: true "en": "en" LanguageEmbedding: Never LanguageLocation: FilePath LowercaseUrls: true ShortenUrls: true Site: "brandname" SiteResolving: true UseDisplayName: false defaultUrlOptions.Site.SiteInfo "brandname" ("web"#"") AllowDebug: true BrowserTitle: "BrandName - Sitecore" CacheHtml: true CacheMedia: true ContentLanguage: "" ContentStartItem: "" Database: "web" DefaultDevice: "" Device: "" DictionaryDomain: "" DisableBrowserCaching: true DisableClientData: false DisableXmlControls: false Domain: "extranet" EnableDebugger: true EnableFieldLanguageFallback: false EnableItemLanguageFallback: false EnableLinkedItems: false EnablePreview: true EnableWebEdit: true EnableWorkflow: false EnforceVersionPresence: false ExternalPort: 0 FilterItems: false FilteredItemsCache: {Sitecore.Caching.FilteredItemsCache} HostName: "brandname.local" HtmlCache: {Sitecore.Caching.HtmlCache} HtmlCacheClearLatency: "" IsActive: true Language: "" LoginPage: "" MasterDatabase: "" MediaCachePath: "" Name: "brandname" PhysicalFolder: "/" Port: 0 Properties: {System.Collections.Specialized.NameValueCollection} RegistryCache: {Sitecore.Caching.RegistryCache} RenderingParametersCache: null RequireLogin: false RootPath: "/sitecore/content/BrandName" Scheme: "" StartItem: "/Home" TargetHostName: "" ViewStateCache: {Sitecore.Caching.ViewStateCache} VirtualFolder: "/" XmlControlPage: "" XslCache: {Sitecore.Caching.XslCache} Scenario 2 - When the link generates correctly defaultUrlOptions.Site "brandname" AllowDebug: true BrowserTitle: "BrandName - Sitecore" CacheHtml: false <--- Different CacheMedia: false <--- Different Caches: {Sitecore.Sites.SiteCaches} ContentDatabase: null "": "" ContentStartItem: "" ContentStartPath: "/sitecore/content/BrandName" Database: {master} <--- Different DefaultDevice: "" Device: "" DictionaryDomain: "" DisableBrowserCaching: true DisableClientData: false DisableFiltering: false DisableWebEditEditing: false DisableWebEditSelecting: false DisableXmlControls: false DisplayDate: {3/10/2017 2:44:46 AM} <--- Different DisplayMode: Edit <--- Different Domain: sitecore <--- Different DrawDots: true <--- Different EnableDebugger: true EnableLinkedItems: true EnablePreview: true EnableWebEdit: true EnableWorkflow: true <--- Different FilterItems: true <--- Different HostName: "brandname.local" Language: "en" LoginPage: "" MasterDatabase: null MediaCachePath: "/App_Data/MediaCache/brandname" Name: "brandname" Notifications: {Sitecore.Events.NotificationContext} Page: {Sitecore.Layouts.PageContext} PhysicalFolder: "/" Properties: {System.Collections.Specialized.NameValueCollection} Request: {Sitecore.Sites.SiteRequest} RequireLogin: false Resources: {Sitecore.Resources.ResourceContext} Response: {Sitecore.Sites.SiteResponse} RootPath: "/sitecore/content/BrandName" SiteInfo: "brandname" ("web"#"") StartItem: "/Home" StartPath: "/sitecore/content/BrandName/Home" TargetHostName: "brandname.local" VirtualFolder: "/" XmlControlPage: "/layouts/xmlcontrol.aspx" defaultUrlOptions {Sitecore.Links.UrlOptions} AddAspxExtension: false AlwaysIncludeServerUrl: false EncodeNames: true "en": "en" LanguageEmbedding: Never LanguageLocation: FilePath LowercaseUrls: true ShortenUrls: true Site: "brandname" SiteResolving: true UseDisplayName: false defaultUrlOptions.Site.SiteInfo "brandname" ("web"#"") AllowDebug: true BrowserTitle: "BrandName - Sitecore" CacheHtml: true CacheMedia: true ContentLanguage: "" ContentStartItem: "" Database: "web" DefaultDevice: "" Device: "" DictionaryDomain: "" DisableBrowserCaching: true DisableClientData: false DisableXmlControls: false Domain: "extranet" EnableDebugger: true EnableFieldLanguageFallback: false EnableItemLanguageFallback: false EnableLinkedItems: false EnablePreview: true EnableWebEdit: true EnableWorkflow: false EnforceVersionPresence: false ExternalPort: 0 FilterItems: false FilteredItemsCache: {Sitecore.Caching.FilteredItemsCache} HostName: "brandname.local" HtmlCache: {Sitecore.Caching.HtmlCache} HtmlCacheClearLatency: "" IsActive: true Language: "" LoginPage: "" MasterDatabase: "" MediaCachePath: "" Name: "brandname" PhysicalFolder: "/" Port: 0 Properties: {System.Collections.Specialized.NameValueCollection} RegistryCache: {Sitecore.Caching.RegistryCache} RenderingParametersCache: null RequireLogin: false RootPath: "/sitecore/content/BrandName" Scheme: "" StartItem: "/Home" TargetHostName: "" ViewStateCache: {Sitecore.Caching.ViewStateCache} VirtualFolder: "/" XmlControlPage: "" XslCache: {Sitecore.Caching.XslCache} Question (Finally) What in the world am I missing that would cause LinkManager to operate so differently between these two scenarios? My understanding is that EXM, if the site configured on the Manager Root and the Site resolved by the item are the same site, ec_url should be a relative URL. But for some reason, in one scenario, I am getting an absolute URL.
The underlying service for GlassMapper is Sitecore. Just wrap it with a SecurityDisabler like normal. You can find an example in the tutorials for GM. http://glass.lu/Mapper/Sc/Tutorials/Tutorial11 void CommentSubmit_Click(object sender, EventArgs e) { var contextService = new SitecoreContext(); var masterService = new SitecoreService("master"); var page = contextService.GetCurrentItem<CommentPage>(); //we could also use the model property instead of the line above: // var page = this.Model; var comment = new Comment(); //This value will be used for the name of the item comment.Name = DateTime.Now.ToString("yy-MM-ddThh-mm-ss"); comment.Content = CommentContent.Text; comment.FullName = CommentName.Text; comment.Email = CommentEmail.Text; using (new SecurityDisabler()) { masterService.Create(page, comment); } CommentThankYou.Visible = true; comment.Content = string.Empty; comment.FullName = string.Empty; comment.Email = string.Empty; }
Using the Security Disabler With Glass Mapper I have a list of Photo items that I'm trying to get from my Glass Mapper model using the following declaration: SitecoreField("Photos")] public virtual IEnumerable<Photo> Photos { get; set; } This set of photos is always empty when I'm not logged into Sitecore because the photos have Sitecore security on them. When I am logged into Sitecore (for example, in edit or preview mode while signed into the admin account), I can grab the photos just fine. Normally, to disable such security I would use the security disabler: using (new Sitecore.SecurityModel.SecurityDisabler()){...} I'm unsure of how to combine the security disabler with Glass Mapper to grab sitecore items that have security enabled. Any ideas on how I can disable this security from my Glass Mapper model? Thanks for the help!
http://jockstothecore.com/defaulting-shared-layout-editing-sitecore-8-1/ A simple setting is not available, but in the blog post above you can find code for a custom processor for the loggedin pipeline that will do the trick. You can still choose on which environments you add the pipeline processor (live only dev). The code itself will set the Registry value for the EditAllVersions key, to set it to shared for the current user. The value is indeed kept per user (you will also notice that by the fact that Sitecore will remember your choice in the xp editor). public class DefaultToAllVersions : LoggedInProcessor { public override void Process(LoggedInArgs args) { if (SkipProcessor(args)) return; Registry.SetString(Constants.RegistryKeys.EditAllVersions, Constants.Registry.CheckboxTickedRegistryValue); } public virtual bool SkipProcessor(LoggedInArgs args) { var user = User.FromName(args.Username, true); var existing = Registry.GetString(Constants.RegistryKeys.EditAllVersions); return user == null &amp;&amp; string.IsNullOrEmpty(existing); } } and patch you loggedin pipeline: <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <processors> <loggedin> <processor mode="on" patch:after="*[last()]" type="X.DefaultToAllVersions, X" /> </loggedin> </processors> </sitecore> </configuration>
Force shared layout in experience editor I know there's a button in experience editor to decide whether to use the shared layout or the final layout when adding renderings (and the default is final layout). Is there a setting that forces this to one option or the other to start? I'm thinking mainly during development, a lot of the time I want my team to use the shared layout. If there's a setting I can change using a patch only on my local or development servers, that'd be optimal.
The reason why it is not working is that it requires Read access. In order to provide the read access, go to the core database and set the security on the item. For example, I want to access the media item /sitecore/media library/Experience Profile/Defaults/Channel. So, from the Core database, I navigate to the image or container and apply a read access to the extranet/anonymous or to the specific user. UPDATE From the screenshot you provided, you have set the access to the default\Anonymous user. You need to set it on the extranet\Anonymous. Go to the User Manager and select the extranet\Anonymous Once selected, click on the Security Editor and set the Read access. An example is shown below:
How to view or render images in Core DB I have Sitecore User profile pictures saved in Core DB. In preview mode of a page, the image renders as http://mysite.org/sitecore/shell/~/media/Profile-Pictures/Demo/author03.ashx?sc_content=core and is visible. But the same page when published, renders the image as http://mysite.org/~/media/Profile-Pictures/Demo/author03.ashx?sc_content=core and the image is not visible. I also updated the permission to the folder in core DB.
Sitecore uses either ASP.NET Web Forms or ASP.NET MVC to generate the final HTML pages. This means developers can use any programming language of the .NET Framework. C# is one of the most popular with VB.NET but any other .NET Framework language like F# can be used. That being said, most if not all Sitecore developers use C#.
What server side language does Sitecore use? This might seem like a trivial question, but I'm researching solutions and couldn't seem to find which language this framework used. I know the frontend has to be HTML/CSS/Javascript, but what does it use on the backend? What server side language(s) does Sitecore use?
That's an interesting error message, as it seems to be mixing up two things: The variable it refers to is SC_SQL_SERVER_USER - which is used by the MSI installation to store the database username used for connecting while installing the Sitecore databases. The rest of the error "Could not access network location", and the 1606 error number suggests a problem with a path, rather than a username. (Which is backed up by blog posts like this, referring to other MSI installs) I can't be entirely confident without seeing more of the script and data you're using to run your install, but my gut feeling is that the problem is related to the SQL user name parameter getting mixed up with some other parameter in the MSI command line. With line-breaks for clarity, the MSI install command in the DSC should look like this. Note each parameter is surrounded with double quotes to make sure they're kept separate even if they include spaces: msiexec.exe /qn /i "$tmp\SupportFiles\exe\Sitecore.msi" "TRANSFORMS=:$instanceID;:ComponentGUIDTransform5.mst" "MSINEWINSTANCE=1" "LOGVERBOSE=1" "SC_LANG=en-US" "SC_FULL=1" "SC_INSTANCENAME=$site" "SC_LICENSE_PATH=$license" <-- This is a path "SC_SQL_SERVER_USER=$sqlUser" <-- But this isn't "SC_SQL_SERVER=$sqlServer" "SC_SQL_SERVER_PASSWORD=$sqlPassword" "SC_DBPREFIX=$sitePrefix" "SC_PREFIX_PHYSICAL_FILES=1" "SC_SQL_SERVER_CONFIG_USER=$sqlUser" "SC_SQL_SERVER_CONFIG_PASSWORD=$sqlPassword" "SC_DBTYPE=MSSQL" "INSTALLLOCATION=$wwwRoot\$site" "SC_DATA_FOLDER=$wwwRoot\$site\Data" "SC_DB_FOLDER=$wwwRoot\$site\Databases" "SC_MDF_FOLDER=$wwwRoot\$site\Databases\MDF" "SC_LDF_FOLDER=$wwwRoot\$site\Databases\LDF" "SC_NET_VERSION=4" "SITECORE_MVC=0" "SC_INTEGRATED_PIPELINE_MODE=1" "SC_IISSITE_NAME=$site" "SC_IISAPPPOOL_NAME=$siteAppPool" "SC_IISSITE_HEADER=$site" "SC_IISSITE_PORT=80" "SC_IISSITE_ID=" "/l*+v" "$tmp\Install.log" Is it possible that you've lost a double-quote in your script and DSC is trying to use the entire phrase SC_SQL_SERVER_USER=sitecore_install as the value of another install parameter? (My most likely guess would be for the license path, since it's the one immediately before - but it might be something else) Have a check of your script, and see if you can spot a typo there... Edited to add: If you need to vary which license file is used for a particular install then you have two main choices: First is that the license is already being read from the configuration file. So you can choose which configuration file to use for a particular installation, and create different .psd1 files depending on what is required. The second is that the script for installing Sitecore can compute the value for the license. The script currently works out the license file by retrieving the value from config and combining it with the path that the assets got copied to: $tmp = $using:Node.TempFolder $licenseFile = $using:Node.Sitecore.License $license = "$tmp\$licenseFile" There are loads of things you could do here. Two options I can think of: You could compute a prefix: $tmp = $using:Node.TempFolder $licenseFile = $using:Node.Sitecore.License $prefix = "defaultValue" if( someTest ) { $prefix = "anotherValue" } $license = "$tmp\$prefix-$licenseFile" or you could have more than one option from the config file and choose which to use: If the .psd1 data included: @{     AllNodes = @(         @{               Sitecore = @{                 LicenseOne = "License-FileOne.xml"                 LicenseTwo = "License-FileTwo.xml"             }          }     ); } Then the logic in the script could be: $tmp = $using:Node.TempFolder $licenseFile = $using:Node.Sitecore.LicenseOne if( someTest ) { $prefix = $using:Node.Sitecore.LicenseTwo } $license = "$tmp\$licenseFile" Note that I've avoided changing the code which calls msiexec.exe here - I find it easier to leave that alone and change the data PowerShell passes to it...
Getting "Could not access network location SC_SQL_SERVER_USER" while installing Sitecore using Powershell DSC I am trying to install Sitecore using PowerShell DSC following below link https://jermdavis.wordpress.com/2015/11/09/development-environments-with-powershell-dsc-part-5/ I am getting "Could not access network location SC_SQL_SERVER_USER" error in log file. I have given all the necessary permission to database but couldn't get it done. Could you please help me in finding the error? Please find below installation log: MSI (s) (E8:EC) [14:22:00:713]: PROPERTY CHANGE: Adding OutOfDiskSpace property. Its value is '0'. MSI (s) (E8:EC) [14:22:00:713]: PROPERTY CHANGE: Adding OutOfNoRbDiskSpace property. Its value is '0'. MSI (s) (E8:EC) [14:22:00:713]: PROPERTY CHANGE: Adding PrimaryVolumeSpaceAvailable property. Its value is '0'. MSI (s) (E8:EC) [14:22:00:713]: PROPERTY CHANGE: Adding PrimaryVolumeSpaceRequired property. Its value is '0'. MSI (s) (E8:EC) [14:22:00:713]: PROPERTY CHANGE: Adding PrimaryVolumeSpaceRemaining property. Its value is '0'. MSI (s) (E8:EC) [14:22:00:713]: Note: 1: 2205 2: 3: Patch MSI (s) (E8:EC) [14:22:00:728]: PROPERTY CHANGE: Adding TARGETDIR property. Its value is 'C:\'. MSI (s) (E8:EC) [14:22:00:728]: Note: 1: 1314 2: SC_SQL_SERVER_USER=sitecore_install MSI (s) (E8:EC) [14:22:00:728]: Note: 1: 1606 2: SC_SQL_SERVER_USER=sitecore_install Action start 14:22:00: CostFinalize. MSI (s) (E8:EC) [14:22:00:728]: Product: Sitecore 8.0 rev. 150223 - SitecoreVamsi -- Error 1606. Could not access network location SC_SQL_SERVER_USER=sitecore_install. MSI (s) (E8:EC) [14:22:00:728]: Note: 1: 1606 2: SC_SQL_SERVER_USER=sitecore_install Error 1606. Could not access network location SC_SQL_SERVER_USER=sitecore_install. MSI (s) (E8:EC) [14:22:00:728]: Product: Sitecore 8.0 rev. 150223 - SitecoreVamsi -- Error 1606. Could not access network location SC_SQL_SERVER_USER=sitecore_install. Error 1606. Could not access network location SC_SQL_SERVER_USER=sitecore_install. Action ended 14:22:00: CostFinalize. Return value 3. Action ended 14:22:00: INSTALL. Return value 3. Property(S): VirtualMemory = 16275 Property(S): UpgradeCode = {B30C3E71-5F46-5340-B9A0-31B0752C6637} Property(S): IISMAJORVERSION = 8 Property(S): IISMINORVERSION = #5 Property(S): GLOBALTEMPFOLDER = C:\Windows\TEMP Property(S): GLOBALIZATIONFOLDER = C:\Windows\Globalization\ Property(S): CRYPTOFOLDER = C:\ProgramData\Microsoft\Crypto\ Property(S): SC_SQLLOGON_ACCOUNT_RAW = AFMS\sqlservice_sc Property(S): ASPNETREGISTERED = C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll Property(S): IIS7APPDEVFEATURESON = #1
You can use the tracker api to retrieve the latest Page Event: Tracker.Current.Session.Interaction.Pages.SelectMany(x=>x.PageEvents) .OrderByDescending(x=>x.Timestamp).FirstOrDefault() This is not tested code, let me know whether it works for you. Update: If you want to get only goals, they can be filtered by adding this LINQ condition: .Where(x => x.IsGoal)
Get the last goal triggered by the current visitor Is there a way in c# to get the name of the last goal triggered by the current visitor? A simple conceptual example: Bob visitors the homepage and clicks on a button (triggering a goal called "my button click" Bob then fills out a contact form (triggering a goal called "contact form submitted") Is there a good way in my back-end code (given I know Bob is current looking at the site) to get the fact that Bob's last triggered goal was "contact form submitted"? I figure if that's not possible, I might be able to store a custom field against the visitor when the goal is triggered - but that seems unnecessary as the information should already be in the Mongo DB? Solution is on Sitecore 7.5.
I think your solution to create a new collection in mongodb is a very viable solution. Then you can just query the collection to get the top 5 pages. I would not recommend to put it in xDB as a custom facet because it would be "difficult" to get top 5 pages, as you would have to query every single contact to find the pages. Even Sitecore does not do it like this, they aggregate the data from mongodb to MSSQL and then index it for speedy access from their analytics Experience Analytics. If you want to have other related data, then you should create the data in MSSQL instead, so you can harness the power of relational data (foreign-keys and so forth).
Retrieve favorite pages based on the user profile At the moment, when a user saves a page as favorite, I'm adding this info to the user profile. However now I want to retrieve the top 5 most saved pages. I thought of just adding a field to the page that I could increment but every time I'd publish the page, this value would be overridden - Even if I wanted to save this value in both master and web, CD doesn't have access to master so they would be out of sync. I also thought about extending xDB to include this info but not really sure how I can do this? Just create a facet on the contact? I could check all the users' favorite pages but I imagine that it might be a better way of doing this? EDIT Still looking for suggestions but for now I've just created a new collection in xDB just to store this data.
@gator is right, your class is nested. So to instantiate it, your config would need to look like this: <add name="sitecore" type="MySite.Foundation.Common.Utilities.SitecoreExtensions+MySiteLinkProvider, MySite.Foundation.Common" addAspxExtension="false" alwaysIncludeServerUrl="false" encodeNames="true" languageEmbedding="always" languageLocation="filePath" lowercaseUrls="false" shortenUrls="true" useDisplayName="false" /> Notice the +
Error Could not resolve type name I'm using Sitecore 8.0 Update 5 and following this document to change the language name in URL. The current URL is like http://mysite/fr-ca/products and I want it to be http://mysite/fr/products Code: namespace MySite.Foundation.Common.Utilities { public class SitecoreExtensions { public class MySiteLinkProvider : LinkProvider { public override string GetItemUrl(Item item, UrlOptions options) { options.LanguageEmbedding = LanguageEmbedding.Always; options.LanguageLocation = LanguageLocation.FilePath; var languageId = LanguageManager.GetLanguageItemId(item.Language, item.Database); var languageItem = item.Database.GetItem(languageId); var regionName = languageItem["Region Name"] ?? ""; var returnUrl = base.GetItemUrl(item, options).ReplaceFirst(item.Language.Name, regionName); return returnUrl; } } public class MySiteHttpRequestProcessor : HttpRequestProcessor { public override void Process(HttpRequestArgs args) { Assert.ArgumentNotNull(args, "args"); // If Sitecore has already mapped the item, just return. if (Context.Item != null || Context.Database == null || args.Url.ItemPath.Length == 0) return; foreach (var language in LanguageManager.GetLanguages(Context.Database)) { var languageId = LanguageManager.GetLanguageItemId(language, Context.Database); var languageItem = Context.Database.GetItem(languageId); var regionName = languageItem["Region Name"] ?? ""; if (args.Url.ItemPath.StartsWith("/" + regionName)) { Context.SetLanguage(language, true); Context.Item = ItemManager.GetItem(args.Url.ItemPath.ReplaceFirst("/" + regionName, ""), language, Version.Latest, Context.Database); break; } } } } } } web.config <linkManager defaultProvider="sitecore"> <providers> <clear /> <!--<add name="sitecore" type="Sitecore.Links.LinkProvider, Sitecore.Kernel" addAspxExtension="false" alwaysIncludeServerUrl="false" encodeNames="true" languageEmbedding="always" languageLocation="filePath" lowercaseUrls="false" shortenUrls="true" useDisplayName="false" />--> <add name="sitecore" type="MySite.Foundation.Common.Utilities.SitecoreExtensions.MySiteLinkProvider, MySite.Foundation.Common" addAspxExtension="false" alwaysIncludeServerUrl="false" encodeNames="true" languageEmbedding="always" languageLocation="filePath" lowercaseUrls="false" shortenUrls="true" useDisplayName="false" /> </providers> </linkManager> MySite.config in the include folder: <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <settings> <pipelines> <httpRequestBegin> <processor type="MySite.Foundation.Common.Utilities.SitecoreExtensions.MySiteHttpRequestProcessor, MySite.Foundation.Common" patch:after="processor[@type='Sitecore.Pipelines.HttpRequest.ItemResolver, Sitecore.Kernel']" /> </httpRequestBegin> </pipelines> </sitecore> </configuration> After publishing the project and browsing the page, it gives the error: Could not resolve type name: MySite.Foundation.Common.Utilities.SitecoreExtensions.MySiteLinkProvider, MySite.Foundation.Common (method: Sitecore.Configuration.Factory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert)). UPDATE: I commented the providers in web.config, and now the error in Sitecore client url is Could not resolve type name: MySite.Foundation.Common.Utilities.SitecoreExtensions.MySiteHttpRequestProcessor, MySite.Foundation.Common (method: Sitecore.Configuration.Factory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert)). Is this the correct way to patch Handlers, providers or is there some other setting to be done prior to this.
Check your Sitecore Item Field Value Accessor Items (the Sitecore Provider items that you created to point at the Sitecore fields that the data should map to) to make sure that you have not set the "Language" field. This field should only be set for multi-language mappings, otherwise the errors in the OP will be logged. Note that I have filed a Sitecore Support ticket to report this issue as a bug. I will update this post if/when I get a response and/or reference number back. UPDATE: I filed a ticket with Sitecore Support and requested that they add some help text in the field's "Title" to help consumers avoid this issue. They got back to me and explained that the solution that I posted here was correct and that while this is the expected behavior adding the help text is a good idea and has been registered as a wish. They provided the reference number 154583 for the wish.
Getting errors in Apply Mapping Pipeline Step when running pipeline batch I am getting the following errors when running a pipeline batch using the Sitecore Provider for Data Exchange Framework v1.3 and using Data Exchange Framework v1.3 rev 170206: 3/10/2017 9:46:28 PM ERROR Pipeline step processing will abort because mapping set failed. (pipeline step: Apply Mapping, mappings that succeeded: 0, mappings that failed: 2) 3/10/2017 9:46:28 PM ERROR Pipeline step processing will abort because mapping set failed. (pipeline step: Apply Mapping, mappings that succeeded: 0, mappings that failed: 2) 3/10/2017 9:46:28 PM INFO 2 elements were iterated. (pipeline: Retrieve Resource Groups from Azure, pipeline step: Iterate Results from Azure and Run Pipeline) In the logs, I have more of the same followed by some messages telling me Sitecore item properties were skipped (they are pretty generic and not really worth the SSE real-estate). Note that my items are being created and with the correct names (as read from the external service), but their field values are blank. The pipeline batch that I'm running is configured to map single-language data. Does anyone know what could be causing this issue and how to resolve it?
Starting from Sitecore 9. Experience Editor introduced additional extension points, so now it is enough to extend pipelines with your own JS/CSS files following this example below: <pipelines> <ribbonStylesheets> <processor type=&quot;Sitecore.ExperienceEditor.Pipelines.RibbonStyleSheets.AddStaticList, Sitecore.ExperienceEditor&quot;> <path>/sitecore/myAssets/css/myRibbon1.css</path> <path>/sitecore/myAssets/css/myRibbon2.css</path> </processor> </ribbonStylesheets> <pageEditingStyleSheets> <processor type=&quot;Sitecore.ExperienceEditor.Pipelines.PageEditingStyleSheets.Processors.AddStaticList, Sitecore.ExperienceEditor&quot;> <path>/sitecore/myAssets/css/myEditing.css</path> <path>/sitecore/myAssets/css/myEditing2.css</path> </processor> </pageEditingStyleSheets> <pageEditingScripts> <processor type=&quot;Sitecore.ExperienceEditor.Pipelines.PageEditingScripts.AddDeclaredScripts, Sitecore.ExperienceEditor&quot;> <path>/sitecore/myAssets/js/myEditingScript1.js</path> <path>/sitecore/myAssets/js/myEditingScript2.js</path> </processor> </pageEditingScripts> </pipelines>
Caching Experience Editor JS and CSS As part of the performance improvements I've been working on for Experience Editor in Sitecore 8.1 I wanted to cache the Ribbon files. I followed the guidance here to put them into the browser cache using the manifest attribute (AppCache): http://sitecorejourney.nileshthakkar.in/2015/09/speed-up-your-sitecore-experience.html. This involved adding the following to the tag: <html manifest="/sitecore/shell/client/Sitecore/ExperienceEditor/Html5AppCache.ashx"> However we saw some issues with this approach with 'Serious Error' being shown sometimes in Experience Editor. On further investigation it turns out that AppCache is now deprecated http://caniuse.com/#search=manifest and service workers are now recommended instead. However they don't have full browser support yet, Chrome and Firefox only so far with Edge bringing support soon: http://caniuse.com/#search=service%20worker Has anyone implemented Service Workers for the Experience Editor Ribbon files? If so did you see much benefit from this and any browser issues? The AppCache implementation improved the page load of Experience Editor by an additional 1-1.5 seconds so I'm keen to see if I can implement a solution.
I am not aware of such tool or easy path to make this happen. Honestly this looks like a project of it's own. The experience I had with it similar to your scenario, it turned out we had to rewrite the project following Helix as opposed of trying to use the existing solution. If there is an easy way to do that I am not aware of.
Sitecore data migration strategy I need to migrate the data from old non structured sitecore system into new helix based information architecture. So this is not exactly "as is as"migration of content tree. We need to create new helix based information architecture and map the old content according and will import into the new system.. In the existing system there are lots of unused and non structured content. So the whole idea of this migration is to import the existing data into new structured based information architecture. Any suggestions, past experience for the same work, challenges, advice,is any tool available in the marketplace?
I'll outline what we do as it's working quite well for us: Create a Style Guide which is a simple page in Sitecore that lists all components available to content editors. Use Gulp with Yarn (avoids issues with versions you get with NPM) SASS (BEM Style), JavaScript and then HTML in our components (MVC views). Gulp handles pre-processing of the SASS and minifies the CSS and JS before deployment, plus a bunch of other things such as creating sprites from individual images. The Style guide allows developers and content editors to see how components look and if changes are needed they can be made in the SASS files or MVC views and then seen on this page quickly. We don't build a front-end only version of the Site and then move this into Sitecore. In my experience this is asking for trouble as back-end and front-end developers need to work together to implement Sitecore compatible solutions to building the Site. Although we use MVC and you have a lot of control over the HTML and CSS/Js there are always some considerations/changes needed when working within a CMS. All the front-end code sits within the Solution in Visual Studio, organised on a per-site basis. We have created a build script that builds the site and front-end developers can run it without them needing to open up Visual Studio. We also separate the deployment of the CSS/JS/Image files out into it's own Octopus package so we can deploy it separately to the code to our environments. Hopefully this gives you some ideas on a different approach.
What's an efficient Frontend development process / workflow for Sitecore? Does anyone have a Frontend development/prototyping process/workflow that has proven to be effective and efficient? I have multiple sites running on Sitecore. We are also MVC based. As a Frontend developer, we use a Frontend toolkit that is used to Prototype the HTML, CSS, and JavaScript. This is built using Grunt Server and Node.js. This was built for us by a vendor. I'm having two issues with this toolkit. Every time we brand the project, the FE Tool Kit needs to be reinstalled. It can’t be just copied over because the file paths are too long. The install is problematic because the NPM does not consistently get and install the same module versions. So there is often, hours of troubleshooting Grunt server and build errors. The development workflow is difficult in regards to how we work with the BackEnd developers. Currently, the flow is like this: Front End makes the HTML, CSS, Javascript. Hand off to BackEnd. BackEnd adds in all Sitecore functionality in the project (outside the FE Tool Kit). This is a problem because if the BackEnd developers make an HTML change to a file, it is not reflected back in the FE Tool Kit. Likewise, if a Front End Developer needs to make a simple change, it must be done in the FE Tool Kit then communicated to the BackEnd developer who must then integrate it with the current .cshtml files. It’s a clunky process! Does anyone have a Frontend development/prototyping process/workflow that has proven to be effective and efficient?
This is Sitecore's default language mapping. It recognizes hu as Hungarian and se as Swedish. Happens in the StripLanguage processor in the <preprocessRequest> pipeline. If you never need language embedding in the URL, you can disable it. Alternatively, define languageEmbedding to be never as options on your LinkManager. Edited to add. There's also a setting that forces the hand of this processor, regardless of your LinkManager setting. Set it to false, to disable the preprocessor. <!-- LANGUAGES ALWAYS STRIP LANGUAGE This setting specifies if the StripLanguage processor in the <preprocessRequest> pipeline will parse and remove languages from the URL, even when the languageEmbedding attribute of the linkProvider is set to "never". You should only change this setting to "false" if the default behavior causes problems in your solution. Default value: true --> <setting name="Languages.AlwaysStripLanguage" value="true" />
Weird URL mapping for /hu and /se We recently analyzed the Google crawling errors on our production system. We noticed a weird 500 Code for URLs http://localSitecore/hu and http://localSitecore/se. So we tried to figure out where it came from, and eventually found out that it is already mapped in vanilla Sitecore. We tested 8.1 Update 2, 8.2 Initial Release and 8.2 Update 2. They all have that mapping. How can we get rid of the mapping? Where is it coming from? The error that is thrown is, The model item passed into the dictionary is of type 'Sitecore.Mvc.Presentation.RenderingModel', but this dictionary requires a model item of type 'Example.GlassMapper.sitecore.templates.Example.Pages.IContentPageModel'.
You need a new subscription for EXM 3.4, the old one is not good. You can find on EXM 3.4 documentation : Please be aware than when upgrading to EXM 3.4, a new subscription to the Sitecore Email Cloud is required. This especially applies to existing subscribers of the Sitecore App Center product; Email Delivery. Email Delivery subscriptions will no longer be active in EXM 3.4 and you are no longer able to self-serve your subscription through the Sitecore App Center UI. To ensure continuous service and for more information on how to migrate, how to subscribe and subscription pricing, please contact your local Sitecore representative immediately. https://dev.sitecore.net/Downloads/Email_Experience_Manager/Email_Experience_Manager_34/Email_Experience_Manager_34_Initial_Release.aspx
How to configure the "message transfer agent" for EXM 3.4 I have Sitecore 8.2 site and i have configured EXM 3.4 as per EXM installation guide. In guide, there is step to configure the Email Delivery service in app center. But in App center, there is "Email Delivery service 1.0 - 3.3" so is it valid for EXM 3.4. Please also let me, know how to configure Email Delivery service?
You can add your own handler to item:created event and get the field value from parent. First register your handler: <event name="created"> <handler type="YourNameSpace.YourHandler, YourAssembly" method="OnItemCreated" /> </event> And the code: namespace YourNamespace { public class YourHandler { private static ID _childTemplateId = ID.Parse("YOUR_TEMPLATE_ID"); private static ID _parentTemplateId = ID.Parse("YOUR_PARENT_TEMPLATE_ID"); private const string FieldName = "YOUR_FIELD_NAME"; public void OnItemCreated(object sender, EventArgs args) { try { using (new SecurityDisabler()) { ItemCreatedEventArgs arg = Event.ExtractParameter(args, 0) as ItemCreatedEventArgs; if (arg == null || arg.Item == null || arg.Item.Parent == null) return; var item = arg.Item; var parent = arg.Item.Parent; if (item.TemplateID != _childTemplateId) return; if (parent.TemplateID != _parentTemplateId) return; if (item.Database.Name != "master") return; item.Editing.BeginEdit(); item[FieldName] = parent[FieldName]; item.Editing.EndEdit(); } } catch (Exception exc) { Log.Error("Exception while copying field value from parent", exc); } } } }
Copy field from parent item on creation I know that I can reference a parent item with Glass Mapper, but I need to copy a specific field on my child because I need to facet on it. What is the best way to copy a field from my parent item on creation?
The Short Answer The short answer is that you can't convert a RuleList<T> back to XML, in Sitecore, using the Sitecore API. However, there is a class, the Sitecore.Rules.RuleDefinition class, that you can use to manipulate Rule XML. If what you really want to do is convert a RuleList<T> back to XML then you could reverse engineer the Sitecore.Rules.DefaultRuleFactory class' methods, starting with GetRule<T>(Database, XElement). You would then have to reverse engineer each of the other methods in the class that are called from the GetRule<T> method's call stack (which is pretty much all of them). IMHO, reverse engineering the DefaultRuleFactory class' methods would be frowned upon and inadvisable, not to mention the fact that you would be taking on a lot of excess risk and responsibility. Using the RuleDefinition Class to Manipulate Rules and Rule XML What I believe you are looking for is the Sitecore.Rules.RuleDefinition class. It's not exactly what you are looking for, but it is the closest thing to it that you will find. Using the RuleDefinition Class Sitecore uses the RuleDefinition class to manage the XML manipulation of the XML for Rules. Based on the OP and your comments, what you would like to do in code is take any rules that have been created on a Rule field, add in a new rule and save it to the field. What you would do is something like the following: var ruleDef = new RuleDefinition(item["MyRulesField"]); // manipulate the RuleDefinition using one of its methods, e.g: ruleDef.AddRule(...) ruleDef.AddAction(...) ruleDef.AddCondition(...) ruleDef.Move(...) ruleDef.MoveRule(...) ruleDef.RemoveAction(...) ruleDef.RemoveCondition(...) ruleDef.RemoveRule(...) ...and dozens more... var xml = ruleDef.ToString(); There are many other methods than those I listed and most of the methods on that class (including the ones I listed) have several overloads for you to use. Implications from the API The Sitecore API doesn't actually provide a way to take a RuleList<T> and convert it back into XML. Given the existence and use of the RuleDefinition class, the implication is that developers should not be retrieving and parsing a RuleList<T> and then converting that back into XML. Even the Sitecore Client doesn't work this way. Instead, developers should start with the XML - the raw rule field value - and then use the API to add/remove/manipulate rules, conditions and actions from that XML value. Once complete, the resulting XML value should be retrieved by calling RuleDefinition.ToString() method, which returns a string XML value that can be saved back to the field. Summing up Without knowing the specifics of what and how you are trying to manipulate your rule, I simply cannot point you to a more specific method. However, I think that this should point you in the right direction and give you a pretty good head start. Even if you have to rewrite some of your current implementation to accommodate this, IMHO this is the only feasible option as far as manipulating Rule XML goes. Good luck!
Converting RuleList back to XML I have a piece of code to add a new Rule to an Item field but i can't work out how to convert this back to XML, Can anyone point me in the right direction? :) The RuleFactory doesn't appear to offer anything but there must be something .. ? var rulesField = item.Fields[ExtendedShippingProviderLookupValueFields.DisplayRulesFieldId]; RuleList<ShippingRuleContext> rules = RuleFactory.GetRules<ShippingRuleContext>(rulesField); var newRule = new Rule<ShippingRuleContext>(); newRule.Actions.Add(new HideShippingOption<ShippingRuleContext>()); var condition = new ShippingCountryCondition<ShippingRuleContext>(); condition.CountryCode = "NZ"; newRule.Condition = condition; rules.Add(newRule); item[ExtendedShippingProviderLookupValueFields.DisplayRulesFieldId] = rules.ToString(); I've tried a simple serialization but that does not work either. item[ExtendedShippingProviderLookupValueFields.DisplayRulesFieldId] = GetXML(rules); private string GetXML(RuleList<ShippingRuleContext> rules) { XmlSerializer serializer = new XmlSerializer(typeof(RuleList<ShippingRuleContext>)); var stream = new MemoryStream(); var streamWriter = new StreamWriter(stream, System.Text.Encoding.UTF8); serializer.Serialize(streamWriter, rules); return Encoding.ASCII.GetString(stream.ToArray()); } Sitecore's interface generates XML in this format <ruleset> <rule uid="{01FC00E0-1F84-44D3-80BF-3D003137CEC3}"> <conditions> <condition id="{F9878A36-9395-443B-9D7D-ACF721639757}" uid="B2B44316D8C248238399184DF1E2207F" CountryCode="NZ" /> </conditions> <actions> <action id="{F65EE2F1-3BB7-45D0-8B07-0CDEFDD097E6}" uid="779A10F1CC4C4B79B4EE5C261C4BF83B" /> </actions> </rule> </ruleset> The serialization of the objects generates this <RuleListOfShippingRuleContext xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Name>/sitecore/content/Healthspan/Business Catalog/Shipping Providers/EURO COURIER</Name> </RuleListOfShippingRuleContext> so as you can see nothing like it! I was hoping there would be a helper class like some of the other XML based field types but i've been unable to find one. For completeness this is my final code solution following Zachary's Direction var ruleDef = new RulesDefinition(item[ExtendedShippingProviderLookupValueFields.DisplayRulesFieldId]); Guid ruleGuid = Guid.NewGuid(); var rule = ruleDef.AddRule(ruleGuid); var condition = ruleDef.AddCondition(ruleGuid,ID.Parse("{F9878A36-9395-443B-9D7D-ACF721639757}")); XAttribute attribute = new XAttribute("CountryCode","NZ"); condition.Add(attribute); var action = ruleDef.AddAction(ruleGuid, ID.Parse("{F65EE2F1-3BB7-45D0-8B07-0CDEFDD097E6}")); item[ExtendedShippingProviderLookupValueFields.DisplayRulesFieldId] = ruleDef.ToString();
This is a non-issue. During porting, I renamed the Sheer UI XML control It seems that the xml element beneath the root <control> element must match the Control field of the layout item. <?xml version="1.0" encoding="utf-8" ?> <control xmlns:def="Definition" xmlns="http://schemas.sitecore.net/Visual-Studio-Intellisense"> <SiteCopier> <!-- this element must match the "Control" field of the item under /sitecore/layout/Layouts/Tools/ --> <FormPage> <CodeBeside Type="Blah.blah, Blah" />
Sheer UI in Sitecore 8.2 I am porting a Sheer UI dialog from a Sitecore 8 solution into a Sitecore 8.2 one (which also has SXA installed). Has anything changed in Sitecore 8.2 regarding Sheer UI? (I know I should be using SPEAK UI, but I want to get this working in Sheer UI before I start any conversion). My solution has the following: /sitecore/layout/Layouts/Tools/My Dialog Layout This is the layout which references the Sheer UI xml control. The Control field is set to the file name of the Xml control (minus the file extension) and the Path is blank. /sitecore/content/Applications/My Dialog This is the application (dialog) itself. This item references "My Dialog Layout" in the presentation details. /sitecore/content/Documents and settings/All users/Start menu/Programs/My Dialog This is the start menu shortcut. The Application field is set to link to /sitecore/content/Applications/My Dialog. This does not appear in the start menu for some reason. I have also tried moving this under /sitecore/content/Documents and settings/All users/Start menu/Right/Development Tools which also does not work. /sitecore/client/Applications/Launchpad/PageSettings/Buttons/Tools/My Dialog This uses the LaunchPad-Button template and has the Link field set to /sitecore/shell/Applications/My Dialog.aspx?sc_bw=1. This button does appear in the Launch Pad page, but shows a blank page when rendered. No errors.
There is nothing OOTB built into Sitecore for this. To clear the Facebook cache you have 2 options: Manual Cache Clear You can manually clear the cache by going to the Facebook Debug Tool and enter the URL you want it to scrape. This forces Facebook to clear the cache and get the site data again. Clear Via API You can use the graph API from Facebook. The API endpoint to clear it is: POST /?id={object-instance-id or object-url}&amp;scrape=true The response from this endpoint will be a JSON object that contains all the information about the object that was scraped (the same data returned when the Object ID is read from the Graph API). You could create a ribbon bar button to call this API for the currently selected item in the content editor.
Facebook latest page content in the share dialog Is there something out of the box to clear cache for Facebook share? I have to clear the browser cache for the share dialog to take the latest updated content. Is there something in Sitecore that does this for me to make the facebook share easier?
You need to change 2 things to get the gulp script to use v15.0 tools for MSBuild. First, in the gulp.js file, you need to change everywhere you see this toolsVersion: 14.0 to toolsVersion: 15.0. There are multiple places in the file to change it. Also, you need to make sure that the gulp-msbuild package is updated to the latest version to support build tools 15.0. In the package.json file located in the root of the repo, change the line: "gulp-msbuild": "0.2.13", to "gulp-msbuild": "0.4.4", and then run npm install from the command line to update the package. Now it should be using the msbuild tools 15.0.
Working on Habitat with VS 2017 Set up the habitat solution all nice and smooth. However when trying to run the gulp task to get unicorn to sync I get a bunch of errors like this in the gulp output: error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. I have vs 2017 running in stead of 15 and I installed MS build 2015 but still getting the same error. My question is there reference to MS build that needs to be amended to point to the right version? or is there something else missing?
In the documentation for Configuring a Sitecore Processing server it's mentioned that, You can configure a processing server in much the same way as you configure a content delivery or content management server. Basically, you need to review settings which identify the Instance uniquely which helps in EventQueue and similar stuff when setting up a cluster of Sitecore servers pointing to same SQL database. One such setting which I know already is <setting name="InstanceName" value="" />. The default value of this setting is empty so Sitecore will take Computer Name when the value is empty. Also, few not to miss recommendations from above link - when setting up a cluster of Processing servers. Setup Application initialization or the appropriate module (IIS 7.5), so you can successfully start Sitecore after you recycle the application pool. If you do not do this, Sitecore will not be launched and its application pool may shut down due to inactivity. Synchronize all servers to a single reliable time source for example Network Time Protocol (NTP) Update: For correct settings for processing or aggregation instances or for Sitecore.Analytics.Processing.Aggregation.ProcessingPools.config, you can download the correct excel files, which goes with your Sitecore version, from here - Configure a processing server. If it helps, to make your task easy there are some PowerShell scripts to configure server role (like cd, cm, processing, aggregation, reporting, etc) i.e. enabling/disabling .config files posted on this SSO question here. However configuring settings within a .config file is a manual effort in my knowledge.
Rebuilding Reporting DB with multiple processing servers We need to rebuild our reporting database with over a year of data and don't want it to take a week to finish so we want to optimize this process. We currently have a standalone processing server for aggregation but want to set up multiple ones and increase the max aggregation threads from 1 to 4 on each server. In the documentation for rebuilding the database here - Walkthrough: Rebuilding the reporting database it says on step 5. If you are configuring a dedicated server...{do stuff}... But it doesn't say how to configure it if you have multiple servers for processing/aggregation. What are the right settings for the App_Config/Include/Sitecore.Analytics.Processing.Aggregation.ProcessingPools.config?
Let me start off by saying that I'm not happy with either of the options that I came up with, but I'm not sure how else you'd do it, so I thought I would at least get them recorded. The first thing that I had thought of for this was to patch in your settings after the ConfigReader finishes patching in everything else, like so: public class ConfigReader : Sitecore.Configuration.ConfigReader { protected override void LoadAutoIncludeFiles(XmlNode element) { // patch in files like normal, first base.LoadAutoIncludeFiles(element); // patch in your settings, here } } The problem is that your <appSettings> aren't stored in Sitecore config patch files, presenting a bit of a challenge with regards to patching. This leaves us with two options: Write the XML for the settings programmatically and patch it in using your extended ConfigReader (above) and an extended ConfigPatcher For each of your <appSettings>, create a new SettingsSwitcher instance, effectively overriding the setting in the config Neither of these options are super pretty, but let's have a closer look at their pros and cons: Option 1: Writing the XML for and Patching Each appSetting Since you already have an overridden ConfigReader (above), start by extending the ConfigPatcher class, and add a PatchNode(XmlNode) method to it with the job of patching in a single XmlNode passed in as an argument. Next, add an override for the ConfigReader.GetConfigPatcher(XmlNode) method to your extended ConfigReader class, and have it return a new instance of your extended ConfigPatcher class instead of the native Sitecore ConfigReader class. Finaly, add a call to your new YourPatcher.PatchNode(XmlNode) method to the end of your overridden LoadAutoIncludeFiles(XmlNode) method, above. Pros Since you are creating the XML and using it to patch the setting, it is treated like any other XML patch and will be displayed in the ShowConfig Little to no risk of side-effects There is no chance of the override value being "lost" without the AppPool recycling Cons You will need to retrieve the appSettings as a NameValueCollection and build the XML manually, with the appropriate <patch:attribute /> and/or <setting set:...> settings, the parent <sitecore> node and the containing <configuration> node with the correct XML namespaces set on it. This isn't a lot of work, but it does make the implementation a bit dirtier than it already is. Less maintainable, as you are extending ConfigReader and ConfigPatcher and overriding several methods between the two of them. If/when you go to do a Sitecore upgrade, you will need to ensure that any changes to these classes and their methods (especially those that you are overriding) have been accounted for Option 2: Using the SettingsSwitcher to override your settings' values This option is a little bit more elegant, though it isn't without its faults. For this option, you will need to do the following: foreach(var key in System.Configuration.ConfigurationManager.AppSettings.AllKeys) { new SettingsSwitcher(key, System.Configuration.ConfigurationManager.AppSettings[key]); } The reason why this works is because by instantiating the SettingsSwitcher with a setting (name and value) you are adding that setting's name and value to the stack. Every time Sitecore.Configuration.Settings.GetSettings<T>(...) is called, it first tries to get the setting value from the SettingsSwitcher and if the value is set there then that is the value that is used. Effectively, you will have overridden the setting in the config files. Note: in an actual implementation, I would namespace the appSettings that should be brought into Sitecore, so that you could have straight .NET ones, as needed. Of course, this is an implementation decision, so I didn't include this in my solution. Pros More elegant solution - no manual generation of XML patch files No extending/overriding native Sitecore classes and methods, so no trouble with upgrades, so long as the reliance on the SettingsSwitcher doesn't change Far less code and less effort Cons Overridden settings are not reflected in the ShowConfig If anything happens to the stack then your overridden settings could be lost Summary Honestly, I'm not super happy with either of these options, but I don't yet see another way to accomplish what you are looking for. My recommendation would be to go with option 1, since it is less likely for something to go wrong and you can see the overridden settings in the ShowConfig. When you go to upgrade, if necessary you can change to the implementation in option 2. I like option 2 more, from a code-cleanliness and effort standpoint, but at the end of the day I think it is less reliable then option 1, and I don't like the idea of overridden values not showing up in the ShowConfig.
Optionally Overriding Sitecore Settings with AppSettings (from Azure) Background So long story short. We all know and use (right?) the established Sitecore Best Practice for not modifying vanilla configuration files. We use config patches (or config overrides, as some call them) to add new settings and patch existing ones. Just so there is no misunderstanding here; this is the type of setting I'm talking about: <setting name=&quot;AllowDuplicateItemNamesOnSameLevel&quot; value=&quot;true&quot; /> These all sit under the <sitecore><settings> element and is therefore under the control of the Sitecore Configuration Factory and can thus be patched by config include files that Sitecore loads up dynamically when the factory initialises. The problem Sitecore.Configuration.Settings is sealed and GetSetting() is a public static. So there, our challenge is laid out before us. What I would like to achieve is a way, so these defined settings (patched or vanilla) would get &quot;overruled&quot; if a similarly named setting had been defined by a regular <appSettings> value. And I would like this to be injected in, somehow - shielded from the rest of the application. The significance of <appSettings> The reason for this, I should add, is Azure. And for running Sitecore on Azure PaaS. As you may or may not be aware, any WebApp running on Azure can have instance/slot specific configuration settings defined in the Azure Portal. It looks like this. These settings will override any <appSettings> defined in your web.config, and the connection strings will do the same. But it only works for this; not for the Sitecore flavoured settings. Now I'm not saying all settings should be pushed to the portal. But some, definitely make sense. Any server-to-server connection settings, service bus connection strings, mail servers and so on. My progress so far So to try and implement this; I've done what I must. I've opened up dotPeek and taken a look around ;-) The real work is done in a private static GetWebSettings() method. In short, it maintains an internal Hashtable for all settings, and will loop through all settings/setting XML elements for settings and values. Given that it's a private static, the only way to override it would be some form of method replacement via reflection. While possible, it's not the prettiest of approaches and I'd rather avoid it. So the question is; where would be the best (err.. least likely to break/cleanest/least invasive) place to inject code that would allow these settings to be overridden by Azure? I haven't written that code yet, but something to the effect of this: var setting = GetSettingFromSitecore(settingName); if (Azure.Settings[settingName]) setting = Azure.Settings[settingName]; Any ideas?