output
stringlengths
34
25.7k
instruction
stringlengths
81
31k
input
stringclasses
1 value
Unfortunately, this is not currently possible. The explanation is that since MSBuild doesn’t include the T4 processing engine inside its build components, TDS isn’t able to make a call to it during the execution of a build. This is the main reason why code needs to be generated and checked-in before builds happen.
TDS Code Generation - What options do I have to run this away from the IDE? We are able to run the code generation through the Visual Studio IDE (Right click -> Regenerate for all items) Are there other options available, such as Project Build targets or an external program that can be run? The reason for this is that we have (or will have) many projects within a Helix / Habitat style architecture, and would like to run all the code generation at certain times.
I believe it should be possible, by configuring your CM box to act as the "dedicated server" for your setup. With reference to this guide - section 3.1.3. E-Mail Campaign Manager for Sitecore CMS 6.5 - Administrator’s and Developer’s Guide As far as I can tell; all you would need to do on your CD server, is remove the <scheduled> section from your Sitecore.EmailCampaign.config file. Then on your CM server, tell it that it is the master by adding the address of the CM to the <DedicatedServers> section of the same config file. As best I know; this would make your CM box the point of origin for all ECM messages.
Is there a way to configure ECM to send a message from a specific server? We have a site in production that uses ECM 2.1 (before EXM). The production environment consists of a CM server and 2 CDs. There is some code running on the CD servers that creates and sends messages using AyncSendingManager. Much the same as this post from briancaos: https://briancaos.wordpress.com/2016/03/19/sitecore-exm-send-an-email-from-code/ Could there potentially be any way to make sure that the message sends from a job on the CM box rather than the CD server or is this impossible?
The Sitecore XML configuration has some fairly handy things in it, and ref is one of them. I spent a bit of time playing around with it some time ago; I think that I can provide an answer, but it's quite a long one so buckle in. With 'how it works'... For fine detail, you can investigate the Factory.CreateObject(XmlNode, string[], bool, IFactoryHelper) and the Factory.CreateFromReference(XmlNode, string[], bool) methods, but in a nutshell Sitecore will attempt to construct the object in a few different ways. One of which is using a given ref or path attribute. Sitecore does not, at any point, actually fiddle with the underlying XML (e.g. by merging or copying it). As you'll likely be aware, Sitecore assigns the properties of the object based on the child nodes present in the XML that identifies the type name. There are some exceptions to this case, but by and large this holds so long as the hint attribute is not used. To provide an example, the following XML (when requested through Factory) will create an object of type MyType and then proceed to set the value of the MyProperty property on that object to "foo": <someNode type="MyType, MyAssembly"> <myProperty>foo</myProperty> </someNode> The population process described above occurs on two separate occasions: first with properties matching the child nodes present in the "referred" XML, and second with the properties matching child nodes present in the "original" XML. This is what allows for configuration such as with the Content Search indexes where index configuration can override a "default". The interesting caveat here, is that because the XML is never merged, the "original" property values take precedence over the "referred" property values when used normally (i.e. set property X to value Y). This is why you often have to duplicate swathes of the default index configuration if you just want to add a value. A further caveat to the above is: if you're using hint attributes to call methods then my understanding is that the method will be called for the "referred" XML and then the "original" XML. I haven't looked too deeply into this - but it makes sense given that it would be tricky to somehow "undo" the unknown effect of a method call. This is your best bet if you want to "merge" your values, and is probably why it only "sometimes" works if you just add in your changes rather than the full set of default values. In terms of where it can be used, you can only use ref for XML that governs the instantiation of an object. Typically this means when you're creating an object for an object's property, or if you're making some top-level XML that you yourself intend to use the Factory class to instantiate. To clarify the above: you - unfortunately - cannot use it if you're simply constructing an XML-only configuration node and want to reduce repetition, or to copy in commonly used values for properties (e.g. cache sizes for databases). You must be creating an object. I spent quite a bit of time attempting to do this and scratching my head when it didn't work, before digging a bit deeper. A rather trivial point is that the ref will only be followed once per object. You cannot use a ref attribute to point to an element which is in turn another ref. Although you can obviously use ref on properties inside of those objects. Hopefully that wasn't a whole lot of TL;DR and it answers your questions enough; if there's something I've missed or any mistakes please let me know.
How does the `ref` attribute work in Sitecore configuration files? Sitecore's .config files will sometimes use the ref attribute for inheriting the current node from an existing configuration node. Here's an example from Sitecore.ContentSearch.Solr.Index.Analytics.config: <configuration ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration"> <fieldMap ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration/fieldMap"> <fieldNames hint="raw:AddFieldByFieldName"> ... How does this feature work, exactly? It's clear that you can use XPath to refer to another node, but what does this do under the hood? Will the whole content of the referenced node, along with all attribute values, be (logically) copied into the referrer? Are there any caveats about extending referenced configuration? Like in the example above, <fieldMap> both refers to an existing node and adds its own children. Will they be merged with the original node's children?
The Analytics DB is used as a reporting database for xDB. MongoDB is the collection database and periodically this is aggregated and stored in the Analytics db (also called the reporting db). If you have xDB and Tracking disabled, then you will not need the Analytics DB. IF you are using xDB and want to be able to view all the reports etc... then you will need it. Sitecore will work OK either way without it. But you may get errors in your log file if xDB is enabled. The aggregation services will fail, and you will not be able to view the reports properly.
What is the purpose of the Analytics DB in Sitecore 8.x? I'm migrating my Sitecore DBs from a local installation to Azure PaaS SQL instances using SSMS. I've successfully migrated Core, Master, Web and, with a small edit, Session. I'm having problems with the Analytics database. Even after it fails, Sitecore seems to still work fine with the database, but I'm sure there are unseen consequences. What is the Analytics db used for? Do I need it if I'm using MongoDB for xDB?
While building the RSS workbox, Sitecore uses direct SQL call to the database to get all the items in particular workflow state. Then for every item it tries to get workflow state and then it tries to get workflow from that state. It looks like in your database you have corrupted workflow state information - maybe some workflow states are not migrated properly or some workflows? I would start with removing broken links and see where it goes.
Workbox RSS throws exception after upgrading to 8.1 Update 3 After upgrading my site from 7.5 to 8.1 Update 3 and when trying to open Sitecore workbox and clicking on the RSS feeds icon on any workflow; the following error appears: 4568 2016:10:21 07:06:59 ERROR Application error. Exception: System.InvalidOperationException Message: workflow Source: Sitecore.Kernel at Sitecore.Shell.Feeds.FeedFormatter.WorkflowEventTitleAndCaption(Item item, WorkflowEvent workflowEvent) at Sitecore.Shell.Feeds.FeedTypes.Workflow.BuildSyndicationItem(Item item, WorkflowEvent workflowEvent) at Sitecore.Shell.Feeds.FeedTypes.Workflow.GetSyndicationItems() at Sitecore.Shell.Feeds.FeedTypes.ClientFeed.Render() at Sitecore.Shell.Feeds.FeedRequestHandler.DoProcessRequest(HttpContext context) at Sitecore.Shell.Feeds.FeedRequestHandler.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) Any ideas of what is the cause of this error?
The WFFM module was significantly re-written in version 8.1+ and allows configuration driven dependency injection out of the box. For example, if you take a look at the /sitecore/system/Modules/Web Forms for Marketers/Settings/Actions/Save Actions/Update Contact Details Save Action then you will see the following item definition: Factory Object Name: /sitecore/wffm/actions/updateContactDetails Assembly: [Empty] Class: [Empty] MVC Type: [Empty] Note that the Factory Object Name field is new and in previous versions the other 3 fields would be filled in with the assembly details of the Save Action. Instead, in the latest versions in Sitecore.WFFM.Dependencies.config you will find the following definition: <wffm> <actions> ... <updateContactDetails type="Sitecore.WFFM.Actions.SaveActions.UpdateContactDetails, Sitecore.WFFM.Actions"> <param name="analyticsTracker" ref="/sitecore/wffm/analytics/analyticsTracker" /> <param name="authentificationManager" ref="/sitecore/wffm/authentificationManager" /> <param name="logger" ref="/sitecore/wffm/logger" /> <param name="facetFactory" ref="/sitecore/wffm/analytics/facetFactory" /> <param name="contactManager" ref="/sitecore/wffm/analytics/contactManager" /> </updateContactDetails> ... </actions> <logger type="Sitecore.Forms.Core.Dependencies.DefaultImplLogger, Sitecore.Forms.Core"/> <authentificationManager type="Sitecore.Forms.Core.Dependencies.DefaultImplAuthentificationManager, Sitecore.Forms.Core"/> <analytics> <analyticsTracker type="Sitecore.WFFM.Analytics.Dependencies.DefaultImplAnalyticsTracker, Sitecore.WFFM.Analytics"/> <facetFactory type="Sitecore.WFFM.Analytics.Dependencies.DefaultImplFacetFactory, Sitecore.WFFM.Analytics"/> <contactManager type="Sitecore.WFFM.Analytics.Dependencies.ContactManagerWrapper, Sitecore.WFFM.Analytics"> <param name="contactManager" ref="/sitecore/tracking/contactManager" /> </contactManager> ... </analytics> </wffm> The Save Action accepts these settings as Constructor parameters, the params defined in config must match those in your code. These will all be wired up automatically by the module. public class UpdateContactDetails : WffmSaveAction { private readonly IAnalyticsTracker analyticsTracker; private readonly IAuthentificationManager authentificationManager; private readonly ILogger logger; private readonly IFacetFactory facetFactory; private readonly IContactManager contactManager; public string Mapping { get; set; } public UpdateContactDetails(IAnalyticsTracker analyticsTracker, IAuthentificationManager authentificationManager, ILogger logger, IFacetFactory facetFactory, IContactManager contactManager) { Assert.IsNotNull((object) analyticsTracker, "analyticsTracker"); ... this.analyticsTracker = analyticsTracker; this.authentificationManager = authentificationManager; this.logger = logger; this.facetFactory = facetFactory; this.contactManager = contactManager; } public override void Execute(ID formId, AdaptedResultList adaptedFields, ActionCallContext actionCallContext = null, params object[] data) { this.UpdateContact(adaptedFields); } ... }
Injecting dependencies into a custom WFFM save action We have a client that is on 8.1u1 and is using WFFM. They want to integrate the data collected on the form into Dynamics CRM, however the OOTB save actions for creating entities in the CRM aren't flexible enough. They have some complex business rules on when to create Contacts, when to create Leads, connecting them to Organizations, etc... To date, we have accomplished this with a custom form, but now they want the ability to use that same logic, but create more forms on the fly. We already have the business logic nicely abstracted and injected into the controller, so I figured I could just wrap that in a Save Action. So, my question is how can I "inject" the implementation of our business rules into my WFFM save action and reuse that?
That processor; the Sitecore.Resources.Media.SaveColorProfileProcessor seems bugged to me. I know that's not entirely constructive, but I'll exemplify why I believe this to be. Your query string contains resizing information. This processor is then tasked with grabbing the color profile for use in resizing later on. In doing this, it opens up a Stream. Which takes you here: And ultimately here. Now here's the thing. From what I can tell; if your media item isn't in the MediaCache at this point; this method will run the <getMediaStream> pipeline again to get the stream. And I'm guessing this blows up, as you probably cannot open the Stream twice or some such.
ERROR Could not run the 'getMediaStream' pipeline for 'x' when loading images I have an issue where our custom pipeline which crops images is not running correctly for some images. It was working fine and still seems to work correctly for the existing images but for new images it no longer works correctly. These are the parameters we are sending to fire our pipeline: /-/media/test-image.jpg?mw=660&amp;mh=530&amp;as=1&amp;centercrop=1 It is not cropping new images anymore and if I look at the error in the logs this seems to be falling back to the out of the box image pipeline: 14028 16:47:19 ERROR Could not run the 'getMediaStream' pipeline for '/sitecore/media library/test-image'. Original media data will be used. Exception: System.ArgumentException Message: Parameter is not valid. Source: System.Drawing at System.Drawing.Bitmap..ctor(Stream stream) at Sitecore.Resources.Media.SaveColorProfileProcessor.Process(GetMediaStreamPipelineArgs args) at (Object , Object[] ) at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) at Sitecore.Resources.Media.Media.GetStreamFromPipeline(MediaOptions options, Boolean&amp; canBeCached) I've looked into it and thought it might be this bug, but it's for an older version of Sitecore: https://kb.sitecore.net/articles/856744 More info here: https://sitecorebasics.wordpress.com/2015/11/21/could-not-run-the-getmediastream-pipeline/ I've also checked the permissions on the images and they seem fine and this issue seems to affect all image types, jpeg, gif, pn etc so I'm a bit stumped what might be causing it. Other details: We are Running Sitecore 8.1 - update 2. --Update-- I've taken a copy of the SaveColorProfileProcessor Pipeline and it is indeed throwing an error when trying to read the properties of the image. I've wrapped it in a try{}catch{} and this is skips over the error and proceeds as expected with other Pipelines and resizes the images correctly. I have opened a ticket with Sitecore Support regarding this and why GetMediaStream() is returning this error: 'mediaStream.ReadTimeout' threw an exception of type 'System.InvalidOperationException' I'll update here further once I know more. try { PropertyItem propertyItem = ((IEnumerable<PropertyItem>) new Bitmap(mediaStream).PropertyItems) .SingleOrDefault<PropertyItem>((Func<PropertyItem, bool>) (x => x.Id == 34675)); if (propertyItem == null) return; args.CustomData.Add("ColorProfile", (object) propertyItem); } catch (Exception ex) { Log.Error("Error saving colour profile: " + ex.Message, ex); return; }
The reason the tracker is not initialized is because it can't work with session state disabled. As I understand, you don't want this page to be tracked anyway. To ensure that xDB tracking is disabled, just add the following code into the page: <script runat="server"> protected override void OnPreInit(EventArgs e) { Tracker.Enabled = false; } </script> This way, the startAnalytics pipeline will be aborted way before the StartTracking processor, which is where your exceptions occur. You may have to add the following lines at the top of the page: <%@ Page Language="C#" %> <%@ Import Namespace="Sitecore.Analytics" %>
Tracker.Current is not initialized for RSS page We're getting a ton of errors from an RSS page on one of the websites when bots hit it to get/parse RSS: Exception: System.InvalidOperationException Message: Tracker.Current is not initialized Source: Sitecore.Analytics at Sitecore.Analytics.Pipelines.StartAnalytics.StartTracking.Process(PipelineArgs args) at (Object , Object[] ) at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) at Sitecore.Analytics.Pipelines.HttpRequest.StartAnalytics.Process(RenderLayoutArgs args) There are thousands of errors in logs. The RSS page is fairly standard - using standard FeedDeliveryLayout. <%@ Page Language="c#" EnableSessionState="false" EnableViewState="false" Inherits="Sitecore.Syndication.Web.FeedDeliveryLayout, Sitecore.Kernel" CodePage="65001" %> I disabled analytics a few hours ago for this page by going to Appearance ->Tracking ->Attributes ->Settings ->Disable analytics. There are still errors in the log though. Are there any other settings I need to change to disable analytics for this page?
Tokenization I think that this problem is caused by the fact that your role fields are currently tokenized. I know that making the fields UNTOKENIZED in your previous question didn't help, but please try once again with the following instructions. First, locate you computed fields under <fields hint="raw:AddComputedIndexField"> and make sure they are untokenized. For example: <fields hint="raw:AddComputedIndexField"> <field fieldName="read_roles" indexType="UNTOKENIZED" returnType="stringCollection">MyAssembly.ReadItemRoles,MyAssembly</field> <field fieldName="denied_roles" indexType="UNTOKENIZED" returnType="stringCollection">MyAssembly.DenyReadItemRoles,MyAssembly</field> </fields> Then also add these fields to the <fieldNames hint="raw:AddFieldByFieldName"> section (which is located under the <fieldMap> node): <fieldNames hint="raw:AddFieldByFieldName"> <field fieldName="read_roles" indexType="UNTOKENIZED" returnType="stringCollection" /> <field fieldName="denied_roles" indexType="UNTOKENIZED" returnType="stringCollection" /> </fieldNames> Rebuild your index and see if the queries work well now. Sanitization If the above doesn't help, then try replacing all non-alphanumeric characters with underscores and converting role names to lower case. This is sort of a hack, but at least it will make sure that there are no problems with tokenization and casing. Put this method into a helper class and use it both in your computed fields and in the search query: private static Regex _regex = new Regex("[^a-z0-9]+"); public static string SanitizeRoleName(string roleName) { return _regex.Replace(roleName.ToLower(), "_"); }
How to properly search Solr for any match on one stringCollection field and no matches on a second stringCollection field? I have a Sitecore v8.1 site using Solr 4.10. Here is my index setup. First I have two custom fields defined in my index defined as follows: <field fieldName="read_roles" returnType="stringCollection">MyAssembly.ReadItemRoles,MyAssembly</field> <field fieldName="denied_roles" returnType="stringCollection">MyAssembly.DenyReadItemRoles,MyAssembly</field> The code for ReadItemRoles looks like this: public class ReadItemRoles : IComputedIndexField { public object ComputeFieldValue(IIndexable indexable) { var scIndexable = indexable as SitecoreIndexableItem; var item = (Item)scIndexable; List<string> rolesList = new List<string>(); using (new Sitecore.SecurityModel.SecurityEnabler()) { var roles = RolesInRolesManager.GetAllRoles(); var readRoles = roles.Where(r => item.Security.CanRead(r)); if (readRoles != null &amp;&amp; readRoles.Any()) { rolesList = readRoles.Select(r => r.Name.Replace(@"\", "|")).ToList(); } } return rolesList; } public string FieldName { get; set; } public string ReturnType { get; set; } } The code for DenyReadItemRoles is similar and looks like this: public class DenyReadItemRoles : IComputedIndexField { public object ComputeFieldValue(IIndexable indexable) { var scIndexable = indexable as SitecoreIndexableItem; var item = (Item)scIndexable; List<string> rolesList = new List<string>(); using (new Sitecore.SecurityModel.SecurityEnabler()) { var roles = RolesInRolesManager.GetAllRoles(); var denyRoles = roles.Where(r => r.IsDenied(item)); if (denyRoles != null &amp;&amp; denyRoles.Any()) { rolesList = denyRoles.Select(r => r.Name.Replace(@"\", "|")).ToList(); } } if (rolesList.Count == 0) { var denyRoles = new List<string>(); denyRoles.Add("none"); return denyRoles; } return rolesList; } public string FieldName { get; set; } public string ReturnType { get; set; } } internal static class SecurityExtensions { internal static bool IsDenied(this Role role, Item item) { if (item.Security.CanRead(role)) return false; AccessRuleCollection accessRules = item.Security.GetAccessRules(); if (accessRules != null) { foreach (AccessRule rule in accessRules) { if (rule.SecurityPermission == SecurityPermission.DenyAccess &amp;&amp; rule.AccessRight == AccessRight.ItemRead &amp;&amp; rule.Account == role) { return true; } } } return (item.Parent == null) ? false : role.IsDenied(item.Parent); } } So the intent here is that after I index my web database I should have a field for every item called read_roles that has a list of all of the roles that can read that item (with a | character instead of any backslashes). And I should have a field called denied_roles that has a list of all of the roles that can't read that item. These lists of roles are stored in a field of type stringCollection in Solr. Now I want to apply a security filter to every site search that we do. Basically I want to show all results where at least one of the current user's roles is in the read_roles field and none of the user's roles are in the denied_roles field. Here is my code to do that: public static IQueryable<T> ApplySecurityFilter<T>(this IQueryable<T> query) where T : SearchResultItem { var userRoles = Sitecore.Context.User.Roles.Select(r => r.Name.Replace(@"\", "|")); var readPredicate = PredicateBuilder.False<T>(); readPredicate = userRoles.Aggregate(readPredicate, (current, role) => current.Or(i => i["read_roles"].Equals(role))); var denyPredicate = PredicateBuilder.True<T>(); denyPredicate = userRoles.Aggregate(denyPredicate, (current, role) => current.And(i => !i["denied_roles"].Equals(role))); if (readPredicate.Body.NodeType != System.Linq.Expressions.ExpressionType.Constant) { query = query.Filter(readPredicate); } if (readPredicate.Body.NodeType != System.Linq.Expressions.ExpressionType.Constant) { query = query.Filter(denyPredicate); } return query; } The logic here is that I am getting a list of all of the current user's roles and I am extracting out a list of all of the role names and I am replacing any backslashes with the | character. Then I am using the OR operator to compare each role name to see if any of them are in the read_roles field. And I am using the AND operator to make sure none of them are in the denied_roles field. For some reason this isn't working and I am having a lot of trouble figuring out why it is failing. The best that I can figure out is that this code seems to be failing when the user belongs to a role that contains a space in it. And only the denied_roles part of the query is failing. I have been troubleshooting this by opening up the Sitecore Search.config file and looking at the query that was sent to Solr. If I manually issue the same query to Solr using the Solr UI I get zero results. Then if I remove the denied_roles part I get results. So I am thinking it has something to do with the denied_roles field. But I am really not 100% sure. EDIT: Here is an example of a query that doesn't seem to be working. I got this from the Sitecore Search.log file. ?q=(-isstandardvalue_b:(True) AND _language:(en)) AND (_content:(*acrygen*) OR _name:(*acrygen*) OR (short_description_t:(*acrygen*))^5 OR (search_title_t:(*acrygen*))^5)&amp;start=0&amp;rows=10&amp;fl=*,score &amp;fq=((((-denied_roles_sm:("extranet|Anonymous Role") AND -denied_roles_sm:("extranet|Approved Role")) AND (read_roles_sm:("extranet|Anonymous Role") OR read_roles_sm:("extranet|Approved Role"))) AND _latestversion:(1)))
When you get seemingly odd behavior like this, it's always a good idea to check the Network tab in Chrome Dev Tools (or Firebug in Firefox or whatever it's called in IE/Edge). When you click the "Generate ZIP" button, the Sitecore client makes a POST request to /sitecore/shell/Applications/Tools/Installer/Designer. Because nothing was logged to the Sitecore log on the server, I suspected that the response from the server would have some clues. In this case, the response had a HTTP status code of 200 OK, which threw me off at first. However, inspecting the actual response showed the problem: { "commands": [ { "command": "Alert", "value": "Cannot access path 'D:\\site\\web\\Data\\packages'. Please check PackagePath setting in the web.config file." } ] } I'm not sure why Sitecore returns a 200 OK here instead of a 500 Server Error, but that JSON clearly shows the problem in my case. This dev's local environment was missing the data\packages folder. Creating a new packages folder solved the problem (I encouraged the dev to copy a fresh Sitecore installation on top of the existing folders to ensure no other important items were missing.)
Package Designer shows blank modal window when clicking "Generate ZIP" On one of our developers' local development environment, when he tries to create a new Sitecore package via the package designer, Sitecore shows a blank modal popup when we click "Generate ZIP": We don't see any errors in the Sitecore logs or presented on screen. The package designer works properly on other environments, including other developers' local environments. We tried recycling the app pool, resetting IIS, and rebooting the computer, but the issue persists. Sitecore 8.0 rev 150223
Answer It is possible to set this data on your own. It can be done as Gatogordo suggests, using the following code snippet. Tracker.Current.Session.Interaction.SetGeoData(new WhoIsInformation { City = "Boston", Country= "US", Region = "North America" }); However, it's important to know how this data is initially collected in an out-of-the-box scenario. Background Information for Sitecore Version 8+ Within Sitecore Analytics, if you do a search in your configs for UpdateGeoIpData, you'll find 4 pipelines with a processor to handle retrieving this information. Each pipeline cares a little differently depending on what's going on. UpdateGeoIpData() on the Interaction returns a bool value depending on the success of gathering GeoIP data. Those pipelines include: commitSession <processor type="Sitecore.Analytics.Pipelines.CommitSession.UpdateGeoIpData, Sitecore.Analytics" patch:source="Sitecore.Analytics.Tracking.Database.config"/> This is the last line of defense in the system for making sure that GeoIP data can be recorded. createVisit <processor type="Sitecore.Analytics.Pipelines.CreateVisits.UpdateGeoIpData, Sitecore.Analytics"/> This is making sure that the GeoData is set on the Interaction when the visit is first created. ensureClassification <processor type="Sitecore.Analytics.Pipelines.EnsureClassification.UpdateGeoIpData, Sitecore.Analytics"/> This processor actually is a precursor processor for other functionality. It's purposes is to set the ShouldClassificationBeGuessed argument for the continuation of that pipeline. It utilizes !Tracker.Current.Interaction.UpdateGeoIpData(); as it's conditional statement. There is a side effect that in the envent the VisitData.GeoData is null, it will go ahead and attempt to set the geographical information. If the GeoData is present, it returns a fast true. startTracking <processor type="Sitecore.Analytics.Pipelines.StartTracking.UpdateGeoIpData, Sitecore.Analytics"/> This processor initially populates the GeoData inSession Interaction on Tracker.Current.Session. Specifically, these pipeline processes utilize Session.Interaction.UpdateGeoIpData(Timespan). Also important to note that Interaction is actually based off of CurrentInteraction which is an abstract class. There are four out-of-the-box implementations of this class, of which CurrentVisitContext is most commonly used: Unfortunately, CurrentVisitContext is NOT a class that can easily be extended or overridden through Sitecore configuration patching. A Closer Look at the Start Tracking Processor public class UpdateGeoIpData : StartTrackingProcessor { public override void Process(StartTrackingArgs args) { Assert.IsNotNull((object) Tracker.Current, "Tracker.Current is not initialized"); Assert.IsNotNull((object) Tracker.Current.Session, "Tracker.Current.Session is not initialized"); if (Tracker.Current.Session.Interaction == null) return; Tracker.Current.Session.Interaction.UpdateGeoIpData(); } } Notice it's a pretty simple processor. There is also an Expiry option for location data. Out of the box, the Expiry is turned off (hence TimeSpan.MaxValue). However, this is an option. Rolling Your Own - Overriding Default Functionality To override default functionality and seed your own Geographical Data, I would create processors of your own, mimicking the 4 processors mentioned above. This would ensure that your custom implementation is not confused with the out-of-the-box. An Example public class CustomGeoIpData : StartTrackingProcessor { public override void Process(StartTrackingArgs args) { Assert.IsNotNull((object) Tracker.Current, "Tracker.Current is not initialized"); Assert.IsNotNull((object) Tracker.Current.Session, "Tracker.Current.Session is not initialized"); if (Tracker.Current.Session.Interaction == null) return; Tracker.Current.Session.Interaction.SetGeoData(new WhoIsInformation { City = "Boston", Country= "US", Region = "North America" }); } } By setting it here in startTracking pipeline or createVisit pipeline, all other instances, which utilize UpdateGeoIpData(), will be ignored. This is because the very first thing UpdateGeoIpData() does is a check to see if VistiData.GeoData is set, which SetGeoData() does directly. public override bool UpdateGeoIpData(TimeSpan timeout) { VisitData visitData = this.visitData; if (visitData.GeoData != null) return true; ... snipped code .... return true; } Lastly, you can also run SetGeoIpData() during the course of a visit through code, to overwrite the data previously set.
Updating latest visit city, region, and country with third party data? In the Sitecore Experience Profile -- on the right side of a contact detail page --- you will see a section labeled Latest Visit. It has fields for City, Region, Country. I understand that if you purchase the Geo Location service from Sitecore this gets filled in. If we want to fill it in with another source of data -- is this possible? I can't seem to find this visit item exposed anywhere under the contact facets. I am utilizing Sitecore 8.1 Update 2.
Looks like your UAT is a Content Delivery Server and the List Manager is not disabled on it. Taken from the official Sitecore documentation (this one is for 8.2, but it hasn`t changed much from previous versions) Note You must completely disable List Manager and Path Analyzer on a content delivery server. So you will fix the error by removing the /App_Config/Include/ListManagement folder from the CD server. Also it worth taking a look at the config enable/disable excel spreadsheet that Sitecore Provides for each Sitecore Version.
"Could not create instance of type: Sitecore.Data.SqlServer.SqlServerIDTable. No matching constructor was found" exceptions on Alarm clock event My UAT logs are filled with the below logs. Could you please direct which area I should start looking to debug this issue. WARN Could not find constructor in ReflectionUtil.CreateObject: Sitecore.Data.SqlServer.SqlServerIDTable. The constructor parameters may not match or it may be an abstract class. Parameter info: Count: 1. Parameter types: System.String Heartbeat 04:42:27 ERROR Exception in alarm clock event subscriber. Exception: Sitecore.Exceptions.ConfigurationException Message: Could not create instance of type: Sitecore.Data.SqlServer.SqlServerIDTable. No matching constructor was found. Source: Sitecore.Kernel at Sitecore.Configuration.Factory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert) at Sitecore.Configuration.Factory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) at Sitecore.Configuration.Factory.CreateObject(String configPath, String[] parameters, Boolean assert) at Sitecore.Data.IDTables.IDTable.GetKeys(String prefix) at Sitecore.ListManagement.ContentSearch.Pipelines.Locking.GetLockedLists.GetLockedLists.Process(GetLockedListsArgs args) at (Object , Object[] ) at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) at Sitecore.ListManagement.ContentSearch.PipelineBasedContactListStore`2.GetLockedListIds() at Sitecore.ListManagement.ListManager`2.GetLockedLists() at Sitecore.ListManagement.Analytics.UnlockContactListsAgent.Execute() at Sitecore.Services.AlarmClock.Heartbeat_Beat(Object sender, EventArgs e)
Answering as a Community Wiki, aimed at keeping an up-to-date list of current ongoing activities of the Sitecore community in one place. Online Resources Sitecore Chat Engage with over a 1000 Sitecore users and enthusiasts from around the world in this community hub. Url, Info, &amp; Signup: https://www.sitecore.chat/ Sitecore Stack Exchange Community driven Q&amp;A site aimed at answering any and all questions you have in relation to Sitecore. Url: http://sitecore.stackexchange.com Info: New to the beta? This is what we&#39;re currently focusing on Signup: Anyone can join / No signup necessary Sitecore Community Portal Official Sitecore Community Portal. Url: https://community.sitecore.net/ Signup: Anyone can join / No signup necessary Sitecore Community Updates Mailing List The purpose of this signup is to gather the email addresses of Sitecore resources from around the world with only ONE thing in mind: To keep the Sitecore community updated with the community news. Signup: https://www.akshaysura.com/sitecore-community-update-mailing-list/ Coordinator: @akshaysura13 Community Docs A community-driven collection of developer resources - including blogs, videos, references, and articles. Url: https://sitecore-community.github.io/docs/ Signup: Anyone can join / GITHub account required to participate Meet The Community Meet the people behind the names. Catching Exceptions Watch Catching Exceptions, a video series about software developers. Catch passionate stories, humble beginnings and all around good people. Link: http://www.catchingexceptions.net/ Youtube: https://www.youtube.com/channel/UCfwf3o7zI2B-Ei9OMmHEleA Coordinator: @maaakstiles Core Sampler Core Sampler is a podcast that drills into the Sitecore Community to highlight the amazing work folks are doing on the Sitecore platform. Our goal is to bring you information you can use to leverage the investment you’ve made in Sitecore. Whether you are a developer writing custom plugins destined for the marketplace, or a marketer contimplating a new campaign, we aim to cover broad areas of the platform. Website: http://coresampler.fm) iTunes: https://itunes.apple.com/us/podcast/core-sampler/id1150477446?mt=2 Google Play: https://play.google.com/music/listen?u=0#/ps/Ivvzoireozeazfnlkh4ezn7dzo4 Coordinator: @DDysart Get to know an MVP A special series on Core Sampler which introduces some Sitecore MVPs. Every MVP answers 4 questions: • When did you join the Sitecore Community? • What do you find the most appealing in the Sitecore Community? • What is your suggestion for someone who would like to be an MVP? • What is your message/motivational quote to the Sitecore Community? Website: https://coresampler.fm/tags/gettoknowmvp Interviews by @VargaT Sitecore User Groups Current online directories of Sitecore User Groups: Sitecore User Group Directory http://sitecoreug.org/ http://www.MeetUp.com https://www.reddit.com/r/sitecore/wiki/user-groups Template: Name Description Url Twitter handle Coordinator Europe / Middle East Danish Sitecore Developer Group A group for developers working with or interested in Sitecore development and anything related to it. Url: https://www.meetup.com/Danish-Sitecore-Developer-Group/ Twitter: unknown Sitecore User Group France Sitecore User Group France (SUGF) is a group for developers and marketers Url: https://www.meetup.com/fr-FR/Sitecore-User-Group-France/ Sitecore User Group Nederland Sitecore User Group Nederland (SUGNL) is in het leven geroepen om het Sitecore platform binnen Nederland nog beter op de kaart te zetten. Het doel is hierbij om ontwikkelaars, marketeers en eindgebruikers die professioneel met Sitecore werken bijeen te brengen en te enthousiasmeren. Url: http://www.sugnl.net/ Twitter: @SUG_NL Sitecore User Group Bulgaria Sitecore User Group dedicated to support and grow the developer community in Bulgaria. Url: http://sitecoreug.org/en/usergroups/sitecore-user-group-bulgaria/ Url: https://www.facebook.com/groups/567189316760062/ Twitter: #SUGBG Sitecore User Group Deutschland Gemeinsame Gruppe der Sitecore Usergroup Deutschland. Interessierte und Teilnehmer können sich hier austauschen. Url: https://www.xing.com/communities/groups/sitecore-usergroup-deutschland-1073727 Twitter: #SUGDE Coordinator: @_chriswoj Sitecore User Group Belarus Sitecore community in Belarus, Minsk aims to bring together professionals who is already working with Sitecore or want to learn about it. This group is open to all developers, marketers and users. Url: https://www.meetup.com/Sitecore-User-Group-Belarus/ Twitter: #sugbelarus Twitter: @SUGBelarus Sitecore User Group Schweiz Für Sitecore Enthusiasten. Url: http://sugch.github.io/ Twitter: #SUGCH Sitecore User Group BeLux (Belgium / Luxembourg) A group for and by Sitecore users: developers, end-users, sales reps etc. Our goal is to provide insight into the possibilities and limitations of the Sitecore platform. Url: http://www.meetup.com/Sitecore-User-Group-Belgium/ Twitter: #SUGBeLux Sitecore User Group Budapest The Budapest based Sitecore User Group meets for networking and learning within Budapest / Hungary. For all the Sitecore users, developers, marketers and professionals who seek to know more about Sitecore. Join us! The meetups take place in Budapest [Hungary] Url: https://www.meetup.com/Sitecore-User-Group-Budapest/ Twitter: @SUGHungary Sitecore User Group Poland Sitecore User Group Poland (SUGPL) it is organization which promotes Sitecore in Poland and abroad, but our main gole is a knowledge sharing. Url: http://sugpl.info Meetup: https://www.meetup.com/Sitecore-User-Group-Poland-SUGPL/ Twitter: @SUGPoland Coordinators: http://sugpl.info/pl/kontakt/ Sitecore User Group Czechia &amp; Slovakia Sitecore User Group Czechia &amp; Slovakia meets for networking and learning within Prague (Czech Republic) / Bratislava (Slovak Republic). This is a group for anyone interested in Sitecore Experience Platform and its tools. All skill levels are welcome. I started this group to meet Sitecore enthusiasts, no matter if you are developer, marketer or business guy. Looking forward to meet you all. The meetups take place in Prague (Czech Republic) or Bratislava (Slovak Republic) Url: https://www.meetup.com/Sitecore-User-Group-Czechia-Slovakia/ Sitecore User Group UAE-Dubai Sitecore User Group UAE is established to share knowledge and inspire Sitecore developers, architects, administrators, designers, business , marketers and managers to avail best offering from Sitecore. Url: http://www.meetup.com/SUGUAE/ Twitter: #SUGUAE Twitter: @SUGUAE Sitecore User Group Gothenburg (Sweden) Sitecore User Group Gothenburg is an open forum where Sitecore developers in the Gothenburg area can meet up for knowledge sharing and networking with peers and Sitecore employees. Url: https://www.meetup.com/Sitecore-User-Group-Gothenburg/ Sitecore User Group United Kingdom The UK Sitecore User Group meets on each month for networking and learning. The user group is open to anyone using or considering the Sitecore Experience Platform, or who has an interest in .NET CMS platforms, regardless of technical proficiency. Programmers, marketers, content authors, CMS users and others are all welcome. The UK meetups take place in various locations: London, Bristol, Cardiff, Manchester and Leeds Url: https://scug.co.uk/ Sitecore User Group India Sitecore User Group India – SUGIN is a bunch of People for whom Sitecore is a Passion – A cohort coming together with an intention to share their Sitecore knowledge. The process of sharing the knowledge either happens online or offline. So, if you are a novice, an intermediate or an advanced Sitecore developer, whether transitioning or already working on Sitecore technology, SUGIN is the place to come to quench your Sitecore thirst! Do you want to share your Sitecore knowledge and experience, a distinct Sitecore implementation, present a session on this group?, you are most welcome! Url: http://sugin.in Twitter: @sitecoreugindia more TBD North America Sitecore User Group Portland OR The Portland Sitecore CMS User Group meets about once a quarter to discuss all things Sitecore from Marketing/Strategy to Development topics. This event is hosted in Downtown Portland Oregon. Url: https://www.meetup.com/Sitecore-Portland-Oregon-User-Group/ Coordinator: @sitecore_master and @jaxbaxter St. Louis Sitecore User Group Welcome to the Saint Louis Sitecore User Group Meetup! This group is a place for Sitecore users, prospective users and implementation/technology partners in the St. Louis metro area to share best practices, network, and expand their knowledge of the Sitecore Experience Platform. This group is open to anyone using or considering using Sitecore regardless of technical proficiency. Url: https://www.meetup.com/Saint-Louis-Sitecore-User-Group-Meetup/ Url: https://www.linkedin.com/groups/2499921 Coordinator: @roundedcube Toronto Sitecore User Group Please join us at the next Sitecore technical user group and come network with Sitecore employees, your peers, and Sitecore MVPs. Url: https://www.meetup.com/Toronto-Sitecore-User-Group/ Sitecore User Group Quebec Sitecore User Group Quebec is welcoming everyone working with Sitecore. Developers, marketers, administrators, designers, architects, analysts and much more. People working with .Net, web technologies, other CMS or WCM would also find this group useful to learn more about Sitecore. Our goal is to organize an event every other month. Url: https://www.meetup.com/Sitecore-User-Group-Quebec/ Url: https://plus.google.com/u/0/107096246413072998291 Coordinator: @jflh Sitecore User Group - Montreal Welcome to the Sitecore User Group Montreal! Every session is open to developers, marketers, administrators, designers, architects, analysts and anyone interested in web technologies, digital transformation, User experience, Contextual Marketing with Sitecore Experience Platform. Stay tuned for our coming session! Url: https://www.meetup.com/Montreal-Sitecore-User-Group/ Coordinators: Isabel Tinoco, Mohamed Krimi, Corina Boland Sitecore User Group - Minneapolis/St Paul The Sitecore User Group – Minneapolis/St. Paul is a collection of marketers and developers from companies, agencies and partners who know, use and love Sitecore. The group gathers in-person for informal, informative sessions of interest to both marketers and developers that focus on new Sitecore features, digital marketing strategies, tech tips, case studies by companies and partner presentations. The gatherings also include networking and socializing opportunities that support the regional Sitecore marketer and developer communities. Url: https://www.meetup.com/SitecoreUser/ Atlanta Sitecore User Group Focusing on the industry-leading Sitecore CMS platform, the Atlanta Sitecore User Group is a networking group located in the Greater Atlanta area. It aims to provide Sitecore partners, clients, prospects, and developers an opportunity to network with one another, share best practices with the Sitecore platform, and learn more about the tool and the people who are leveraging it. Membership is open to anyone interested in Sitecore Content Management Systems, from all levels of experience. Url: http://www.meetup.com/Atlanta-Sitecore/ Twitter: @AtlantaSitecore Coordinators: Martin English and Corey Smith Milwaukee Sitecore Developer Meetup - A developer focused meetup for Sitecore developers in the Southeastern Wisconsin area. - Url: http://www.meetup.com/Milwaukee-Sitecore-Developers-Meetup/ New England Sitecore User Group The New England Sitecore CMS User Group meets on a Wednesday once each month in Boston for networking, learning - and did we mention free pizza and drinks? The user group, led by Sitecore MVP Rick Cabral, is open to anyone using or considering the Sitecore Content Management System, or who has an interest in .NET CMS platforms, regardless of technical proficiency Url: http://www.meetup.com/Sitecore-User-Group-New-England/ New York Metro Sitecore User Group The New York Metro Sitecore User Group is built for anyone interested in learning the core staples, as well as cutting edge trends and features of the Sitecore to get the most out of this powerful web content management, digital marketing and customer experience platform. The group regularly meets in NYC, and each speaker-led meeting will cover interesting and informative technical, business, digital marketing and customer experience topics. Url: https://www.meetup.com/NY-Metro-Sitecore-User-Group/ Coordinators: @mickrhm Houston Sitecore User Group Houston Sitecore User Group - Meets quite regularly. Url: http://houstonsug.com https://www.meetup.com/preview/Houston-Sitecore-User-Group Coordinators: @DavidWalker and @wdrake98 Queen City Sitecore User Group, Manchester, NH Queen City Sitecore User Group - Meets once every month. Url: https://www.meetup.com/Queen-City-Sitecore-User-Group Coordinators: @mike_i_reynolds and Amitabh Vyas Seattle Sitecore User Group The Seattle Sitecore User Group is a Sitecore networking group covering the Puget Sound area. Membership is open to anyone interested in Sitecore, from all levels of experience and all disciplines. Url: https://www.meetup.com/Sitecore-Seattle-User-Group-Meetup Twitter: @SeattleSitecore Coordinators: @sandyfoley South America Sitecore User Group Brasil Sitecore User Group - Brasil - Grupo de usuários de Sitecore Experience Platform. Público alvo são Desenvolvedores, Editores de Conteúdo, Profissionais de Marketing, Proprietários de Licensa, entre outros usuários de Sitecore Experience Platform. Url: https://www.meetup.com/SUG-BR/ Coordinators: [email protected] and @diego_a_moretto Asia / Oceania Sydney Sitecore User Group The Sydney Sitecore User Group meets quarterly for networking, learning - and did we mention free pizza and drinks? Url: https://www.meetup.com/Sydney-Sitecore-User-Group/ Twitter: #SYDSUG Coordinator: @RichardHauer and @mike_i_reynolds Sitecore User Group Sri Lanka Sitecore User Group - Sri Lanka is an open discussion forum dedicated to support growing sitecore community in Sri Lanka. Url: https://www.meetup.com/sugsrilanka/ Facebook: https://www.facebook.com/sugsrilanka/ YouTube: https://www.youtube.com/channel/UCOEkI9lPwX8Z6E66bwimr2A E-mail: [email protected] Sitecore User Group Bangalore We are here to bring together professionals working on Sitecore to share our knowledge and experiences among each other, and enrich our own knowledge and spread the 'Joy' of Sitecore! Url: http://sugblr.in/ Twitter: @SUGblr Other Other relevant Sitecore community resources that doesn't fit into the above. Sitecore Technical blog feed: https://community.sitecore.net/technical_blogs/ Sitecore Business and Best Practices blog feed: https://www.sitecore.com/knowledge-center/blog Reddit /r/sitecore: https://www.reddit.com/r/sitecore/
How can I connect with the Sitecore Community? I'm looking to get more involved in the Sitecore community. I'm interested in any local, regional or global Sitecore User Groups, events, online resources, anywhere where the community is active and engaged.
Background What the error message means is that an object of type SearchResultItem could not be serialized as part of a session that is saved to a session store. There are two types of sessions used by Sitecore: private session (a.k.a. ASP.NET session) and shared session. SearchResultItem is a class that is used to retrieve results when querying indexes through the Sitecore search API. Sitecore does not store these objects in sessions out of the box, which means that some code in your solution does. As your question is described right now, and without going through your code base, it is impossible to provide you with a concrete solution. So here's the general solution: Do not attempt to put non-serializable objects into session. Below you can find some concrete advise on finding the offending code. Look through all usages of both ASP.NET session API and Sitecore session API See where and how HttpContext.Current.Session is used; Check if your code uses Sitecore's SharedSessionStateManager directly; Check if your code attaches any custom objects to: Tracker.Current.Interaction; Or Tracker.Current.Session.Interaction; Check if your code attaches any custom objects to: Tracker.Current.Contact; Or Tracker.Current.Session.Contact. The reason you need to check Interaction and its child objects is because the current interaction is saved to the ASP.NET session at the end of every request. The reason you need to check Contact and its child objects is because the current contact is saved to the Sitecore shared session at the end of every request. For all of the above instances, verify that no custom objects that may be saved to the session are of class SearchResultItem, and that no custom objects contain SearchResultItem objects at any nesting level. Look through all usages of SearchResultItem Perform a solution-wide search for "SearchResultItem" and see where and how it is used. If you see that these objects may be saved into private or shared session, review this approach: Consider whether you need to store these objects, at all; If you do, then consider storing them elsewhere; If you, for some reason, do need to store them in the session, then create a custom serializable type that is stored instead of the Sitecore native SearchResultItem.
Unable to serialize the session state. Sitecore.ContentSearch.SearchTypes.SearchResultItem Introduction After implementing private and shared outProc sessions states, I'm receiving the following error. This is a Sitecore 8.1 Update 3 environment. We are using SOLR as our indexer. We are also utilizing EXM. I decided to implement this when a slew of errors in the Content Delivery servers were indicating locked Contact records by the cluster, even though all of the CD's are in the same Analytics.ClusterName. Error Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode. [SerializationException: Type 'Sitecore.ContentSearch.SearchTypes.SearchResultItem' in Assembly 'Sitecore.ContentSearch, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.] System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type) +970 System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context) +306 System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo() +188 System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder) +250 System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder) +96 System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck) +710 System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck) +208 System.Web.Util.AltSerialization.WriteValueToStream(Object value, BinaryWriter writer) +2262 Configuration Settings Below are the configurations setup. This is a local environment. My environment is currently setup as a single instance, but with private and shared session state enabled. The intended production environment is a distributed environment. Content Delivery Web.config <sessionState mode="Custom" customProvider="mssql" cookieless="false" timeout="20" sessionIDManagerType="Sitecore.SessionManagement.ConditionalSessionIdManager"> <providers> <add name="mongo" type="Sitecore.SessionProvider.MongoDB.MongoSessionStateProvider, Sitecore.SessionProvider.MongoDB" sessionType="Standard" connectionStringName="session" pollingInterval="2" compression="true" /> <add name="mssql" type="Sitecore.SessionProvider.Sql.SqlSessionStateProvider, Sitecore.SessionProvider.Sql" sessionType="private" connectionStringName="session" pollingInterval="2" compression="true" /> </providers> </sessionState> Content Delivery Sitecore.Analytics.Tracking.config <sharedSessionState patch:source="Sitecore.Analytics.Tracking.config" defaultProvider="mssql"> <providers> <clear/> <add name="InProc" type="System.Web.SessionState.InProcSessionStateStore"/> <add name="mssql" type="Sitecore.SessionProvider.Sql.SqlSessionStateProvider,Sitecore.SessionProvider.Sql" connectionStringName="session" pollingInterval="2" compression="true" sessionType="shared" patch:source="Client.config"/> </providers> <manager type="Sitecore.Analytics.Tracking.SharedSessionState.SharedSessionStateManager, Sitecore.Analytics"> <param desc="configuration" ref="tracking/sharedSessionState/config"/> </manager> <config type="Sitecore.Analytics.Tracking.SharedSessionState.SharedSessionStateConfig, Sitecore.Analytics"> <param desc="maxLockAge">5000</param> <!-- If an item in session state is already locked, this parameter is the time in milliseconds that the system is idle before making another attempt to apply a lock. --> <param desc="timeoutBetweenLockAttempts">10</param> </config> </sharedSessionState> Intended Environment Setup 1 Primary CM Server 1 Secondary CM Server / Processing 3 Content Delivery Servers, load balanced. Heavy use of Analytics and xDB Contact Records Research Done On Sitecore's Known Issues for Sitecore 8, there is a mention of what seems to be a similar issue. But they don't list a Public Reference Number. A number of dialogs could not be opened on Content Management servers with out-of-process session-state configured. This happened because the pipeline arguments were not serialized correctly. This has been fixed to ensure that these dialogs function properly, however please note that other Sitecore functions (in an out-of-process session-state server configuration) may not be supported as a result of this fix. Summary This looks like a bug in the Sitecore Content Search DLL. Has anyone come across this? I can't imagine that no one else uses OutProc private / sharesession states in a distributed environment.
Currently there is no out of the box "settings" stored "somewhere" for SPE 4.1. Every solution is unique so it didn't make sense to build that. You can however create your own setting items and query that using the commands such as Get-Item. Have a look at the Authorable Reports module included. The Index Viewer contains an example of how to request information from the user. Example: The following is a simplified version of the Locked Items report. Notice the use of the Read-Variable command. $item = Get-Item -Path master:\content\ $props = @{ Title = "Items Locked" Description = "This report will analyse the branch and will tell you which items havehave beenn locked." Width = 450 Height = 300 OkButtonName = "Proceed" CancelButtonName = "Abort" Parameters = @( @{ Name = "item"; Title="Root Item"; Tooltip="Branch you want to analyse."} ) } $result = Read-Variable @props if($result -ne "ok") { Close-Window Exit } $items = Get-ChildItem -Path $item.ProviderPath -Recurse -Version * -Language * | Where-Object { $_.__Lock -and (-not ($_.__Lock -match "<r />"))} $items | Show-ListView -PageSize 25 -Property @{Label="Name"; Expression={$_.DisplayName} }, @{Label="Owner"; Expression={ $_.__Owner} }, @{Label="Locked"; Expression={ ([Sitecore.Data.Fields.LockField]($_.Fields["__Lock"])).Date} }, @{Label="Locked by"; Expression={$_.Locking.GetOwner() } }, @{Label="Updated"; Expression={$_.__Updated} }, @{Label="Updated by"; Expression={$_."__Updated by"} }, @{Label="Created"; Expression={$_.__Created} }, @{Label="Created by"; Expression={$_."__Created by"} }, @{Label="Path"; Expression={$_.ItemPath} } Close-Window
PowerShell Extensions reports: Is it possible to pass / choose parameters? I have created my first report, now I'd like to make it reusable. Is there any way I could read parameters from "somewhere" after the user clicks the report's name?
Can't provide you with a list of recommendations for all agents, but as you mentioned the event queue I can give some information on the CleanupEventQueue task. As we had issues with ever growing event queue tables (as many others probably) we reached out to Sitecore support and together we came up with some patches to the configuration. The idea is: On Content Management: Clean the eventqueue very aggressively On Content Delivery: Poll the eventqueue less aggressively Disable the eventqueue cleaning Polling the event queue every 2 minutes means that if the content editor changes a page, it can take up to 2 minutes for the changes to appear on the CD. You should check with your 'customer' if this is a problem and change the value accordingly. The patches would look like this: Content Management <sitecore> <scheduling> <agent type="Sitecore.Tasks.CleanupEventQueue, Sitecore.Kernel"> <patch:attribute name="interval">00:30:00</patch:attribute> <DaysToKeep> <patch:delete /> </DaysToKeep> <IntervalToKeep>01:00:00</IntervalToKeep> </agent> </scheduling> </sitecore> Content Delivery <sitecore> <eventing> <eventQueue> <processingInterval>00:02:00</processingInterval> </eventQueue> </eventing> <scheduling> <agent type="Sitecore.Tasks.CleanupEventQueue, Sitecore.Kernel"> <patch:attribute name="interval">00:00:00</patch:attribute> </agent> </scheduling> </sitecore> Changing to these values did the trick on some of our projects that had eventqueue-issues so they seem to be effective. ps: not sure when IntervalToKeep was introduced exactly - you should check if your Sitecore version supports it. And undoubtedly someone our here does know and can add that information here. Edit: I have no detailed information for the CleanupHistory and CleanupPublishQueue but what I normally do is lower the DaysToKeep for the CleanupPublishQueue (to 1 instead of 30). There is also an interesting blog post from Alan Coates on the subject, mainly focussing on the "how" though - but including a solution to tweak the CleanupHistory through the EntryLifeTime setting - which I haven't done myself yet. I do think it's quite hard to give real numbers as this is also determined by your content editors - how often and how much do they edit and publish..
How often should agents run to both minimize impact on users and reduce risk of other performance issues? First I referenced John West's article on agents here. He speaks of polling frequencies and intervals but neither there nor other places have I seen a clear guide on the agents that exist and best practices to their settings. There have been a number of issues reported both here on the Sitecore Stack Exchange and other places about the event queue filling up and the need to clear it out. As can be seen here on the Sitecore Community site there are solutions to cleaning out queues, especially when they exceed the recommended 1000 row count. Can anyone point to or provide a table which provides guidance to agent recommended settings from Development to Production?
The pure HTTP GET request to your ProductController, assuming it was registered by the aggregate descriptor as being part of the custom service, should look something like: GET /sitecore/api/ssc/aggregate/custom/Products HTTP/1.1 Host: test.site Accept: application/json; Via cUrl you would be able to request your Products: curl -X GET -H "Accept: application/json;" "http://test.site/sitecore/api/ssc/aggregate/custom/Products" If in doubt SSC provides a discovery service where you can identiy the aggregate services registered within a website. curl -X GET -H "Accept: application/json;" "http://test.site/sitecore/api/ssc/aggregate/" To retrieve the EDM metadata about your services fire a GET request at the sitecore/api/ssc/aggregate/custom/$metadata route. Hope that helps :)
Sitecore Services Client 8.2 ODataController - 406 Not Acceptable error I am trying to request a GET using SSC ODataController with Sitecore 8.2 and it keeps throwing a 406 Not Acceptable error. URL - http://sc82/sitecore/ssc/api/example-controller/products This is the sample ODataController code: public class ProductsController : ServiceBaseODataController<Product> { protected IReadOnlyEntityRepository<Product> ProductRepository { get; private set; } public ProductsController(IReadOnlyEntityRepository<Product> repository) : base(repository) { } public ProductsController() : this(new ProductRepository()) { } public override async Task<IHttpActionResult> Get() { IQueryable<Product> result = await ProductRepository.GetData(); return Ok(result); } } Please let me know if anyone has tried using ODataController with Sitecore 8.2 and faced similar issue.
You need to assign the Or statement to the filterPredicate because the Or and other operators return a new expression instead of building upon the current one. You are doing it correctly with the termPredicate. filterPredicate = filterPredicate.Or(termPredicate);
PredicateBuilder not adding any filters at all I am trying to put together a very simple predicate builder - I only have one predicate for now. But as far as I see in the logs, it isn't applying any clauses at all. This is what I have: using (var context = ContentSearchManager.GetIndex("resources_index").CreateSearchContext()) { string searchTerm = "press"; var filterPredicate = PredicateBuilder.False<ResourceSearchResultItem>(); string[] terms = searchTerm.Split(' '); var termPredicate = PredicateBuilder.False<ResourceSearchResultItem>(); foreach (string term in terms) { termPredicate = termPredicate.Or(p => p.BodyContent.Contains(term)); } filterPredicate.Or(termPredicate); IQueryable<ResourceSearchResultItem> query = context.GetQueryable<ResourceSearchResultItem>().Where(filterPredicate); } When I do this, the query in the logs is: 34184 00:02:23 INFO ExecuteQueryAgainstLucene (resources_index): -*:* - Filter : It's basically applying no filters at all. However, if I use just termPredicate in the .Where, like so: IQueryable<ResourceSearchResultItem> query = context.GetQueryable<ResourceSearchResultItem>().Where(termPredicate); ...Then the query in the logs is just fine: 33564 00:08:25 INFO ExecuteQueryAgainstLucene (resources_index): SpanWildcardQuery(bodycontent:*press*) - Filter : Not sure what I am missing. Any help would be appreciated!
SIM only works with ZIP archive of the Sitecore root folder archives, not with the .EXE installer versions. Also, it relies on the archive name being exactly the same as it is when downloaded directly from Sitecore. So if the 8.2 zip you have has been renamed or altered in any way, SIM will not recognise it.
SIM tool error installing new sitecore instance I want to install sitecore 8.2 instance through SIM tool but it's throwing below error I copied exe file in repository folder but it's not working. I tried to copy sitecore 8.2 zip file in repository folder but encountered same error. I cleaned up my temp folder as well but same result.
EDIT: Update based on comments If you check the definition of LogoutArgs used in the processor, there is a property called RedirectUrl that is of type: Sitecore.Text.UrlString - if you set this property in your processor, that should then be processed by the JavaScript section: $.ajax(ajaxSettings).done(function (data) { window.location = JSON.parse(data).Redirect; // possible to hack here }); The processor would be: public class LogoutFlowAdmin : ILogoutFlowAdmin { private readonly ISecurityContext _securityContext; public LogoutFlowAdmin(ISecurityContext securityContext) { _securityContext = securityContext; } public void Process(LogoutArgs args) { Tracer.Info("Intercepting call to Sitecore logout. Redirecting to Single Logout instead"); var urlString = _securityContext.GetLogoutUrl(); args.RedirectUrl = new UrlString(urlString); } } EDIT Removed the args.AbortPipeline() so that the pipeline continues and completes the redirect. See comments.
Add custom redirect on SPEAK logout We are using OIOSAML.NET/dk.Nita for NemLog-in (Danish National Identity Provider) as authentication mechanism for editors. Claims from the federation are mapped to Sitecore users on login, and that part works great. We are using Sitecore 8.1 update 3. However, when logging out the user is only logged out from Sitecore when pressing "Logout" in the Sitecore Shell. I have therefore added a pipeline component in the Logout pipeline, where I change the redirect URL by injecting SheerResponse.SetLocation(urlString) into the Pipeline before GotoLogin (and aborting the pipeline). This works great for some pages, like the Content Editor. public class LogoutFlowAdmin : ILogoutFlowAdmin { private readonly ISecurityContext _securityContext; public LogoutFlowAdmin(ISecurityContext securityContext) { _securityContext = securityContext; } public void Process(LogoutArgs args) { args.AbortPipeline(); Tracer.Info("Intercepting call to Sitecore logout. Redirecting to Single Logout instead"); var urlString = _securityContext.GetLogoutUrl(); SheerResponse.SetLocation(urlString); // only works for non-SPEAK } } However, since some pages use the SPEAK logout pipeline, I also need to inject my code here. This part does not include GotoLogin, so I assume the flow is somewhat different. When I debug logout from SPEAK, I can see that my code is hit every time, but adding JavaScript using SheerResponse has no effect. Also I have tried a standard redirect (which of course causes an error when invoked in an Ajax handler), changing the RedirectUrl property of the LogoutArgs, but nothing seems to work for SPEAK logout. One option would be to change the JavaScript that invokes the Ajax handler (Sitecore AuthenticationController) so the line below with window.location is hardcoded to point to the custom Logout handler, but I would rather not go into that direction. define(["sitecore", "jquery"], function (sc, $) { sc.Factories.createBaseComponent({ name: "AccountInformation", base: "ControlBase", selector: ".sc-accountInformation", logout: function (target, event) { event.preventDefault(); // Disable cache to make sure that URL is always "followed" // and the logout function gets executed on the server var ajaxSettings = { type: "POST", url: "/sitecore/shell/api/sitecore/Authentication/Logout?sc_database=master", data: {}, cache: false }; var token = sc.Helpers.antiForgery.getAntiForgeryToken(); ajaxSettings.data[token.formKey] = token.value; $.ajax(ajaxSettings).done(function (data) { window.location = JSON.parse(data).Redirect; // possible to hack here }); } }); }); Does anyone have a way to change the URL the editor is redirected to after logout? Preferably in a manner that would be supported by Sitecore, and is sufficiently stable? Update: I have been in contact with Sitecore support, that has informed that this is indeed a bug. It is fixed in 8.2. I still need a workaround, until we can upgrade, so any ideas are welcome :) Update: Quick fix I have implemented a temporary workaround in sitecore\shell\client\Business Component Library\Layouts\Renderings\Authentications\AccountInformation\AccountInformation.js where the line with window.location is hardcoded to redirect to the Single Logout Page, as hinted in the code above. Thank you all for your answers and comments :)
When using suggestions, you must also use the "Coveo Search Resources" component. The "Coveo Search Box Resources" component is too minimal to support suggestions.
JS error while implementing suggest with Coveo I'm implementing a field based suggestions with a coveosearchbox view. My searchbox is declared like this: <div class="CoveoSearchbox form-control" data-auto-focus="@Model.AutoFocus" data-enable-lowercase-operators="@Model.EnableLowercaseOperators" data-enable-partial-match="@Model.EnablePartialMatch" data-partial-match-keywords="@Model.PartialMatchKeywords" data-partial-match-threshold="@Model.PartialMatchThreshold" data-enable-question-marks="@Model.EnableQuestionMarks" data-enable-wildcards="@Model.EnableWildcards" data-enable-omnibox="true" data-omnibox-timeout="@Model.OmniboxTimeout" data-enable-field-addon="@Model.OmniboxEnableFieldAddon" data-enable-simple-field-addon="@Model.OmniboxEnableSimpleFieldAddon" data-enable-top-query-addon="@Model.OmniboxEnableTopQueryAddon" data-enable-reveal-query-suggest-addon="@Model.OmniboxEnableRevealQuerySuggestAddon" data-enable-query-extension-addon="@Model.OmniboxEnableQueryExtensionAddon"> <span class="CoveoFieldSuggestions" data-header-title="Results" data-field="@Model.ToCoveoFieldName("title")"></span> </div> But when I start typing on the coveo search box the suggest is not working. The error I get is: SearchEndpointWithDefaultCallOptions.ts:7 Uncaught (in promise) TypeError: Cannot read property 'options' of undefined(…) I'm using Coveo for Sitecore version 4.402 on a Sitecore 8.1 installation. Also on the diagnostics page I see all services as up and running. I'm assuming this is a misconfiguration but I'm not being able to pinpoint which one. any thoughts on what's wrong here? thanks
Your website is not set up correctly in the <site> config node of the web.config Try to load /sitecore/admin/showconfig.aspx and search for <sites> Within <sites> look for the <site> node that defines your website (this will be the one with the rootPath attribute pointing to the Sitecore content root item for your site) Verify the hostName attribute. This should be either the host name you are using to access your website or not defined (in that case it's a wildcard and will listen to all host names). Note that if it's a wildcard, you should set the targetHostName attribute, otherwise Sitecore doesn't know how to generate links on your site. If this does not help, you should revise your question and provide us with more details as requested in the comments.
Sitecore Not Finding Home Page This might be an obvious answer. I am setting up an existing site (website link changed, but still should point to the same directory) and I get the following error on the URL notfound?item=%2f&amp;user=sitecore%5cadmin&amp;site=scheduler. This is Sitecore 8.1. Any ideas on what I could of missed? Update: It turned out to be a hosting issue. Not sure how it still made it into Sitecore, but that is what threw me off.
Do we need to include both master and web db settings in CMS? Or just master settings in CMS. Only the master db will suffice. Web db items are only used when the site is accessed through the front-end which is usually not the case on CMS. Do we need to include master and web db settings in CD? Or just Web settings in CD. Only the web db. The master db is not accessible on CD servers (if configured correctly). Where does sitecore stores the cache data for (item cache, data cache and prefetch cache). Wondering if any of them are stored in physical file. They are stored in-memory on the instance, not on disk. I'm using out of box cache page and also sitecore cache admin module. The page shows prefetch cache data for both web and master. Wondering how this tool gets the data for web db prefetch for scenario where there are multiple CDs. Or is it just getting from CMS server? This is configured in the /App_Config/Prefetch/*.config files. There is one file for each database and one shared file. Here are some helpful resources on prefetch cache: https://www.cmsbestpractices.com/friday-sitecore-best-practice-configure-prefetch-cache/ https://sdn.sitecore.net/upload/sitecore6/sc62keywords/cache_configuration_reference_a4.pdf (old PDF, but still valid for prefetch cache)
Sitecore pre-fetch cache setting clarification Looks like out of the box prefetch cache setting has item and children set to items which no longer use. I've gone and added below on both master and web database settings. <prefetch hint="raw:AddPrefetch"> <cacheSize>500MB</cacheSize> <item desc="home">{4CE08AF0-CB20-40C2-BE74-BF049DE210B2}</item> <children desc="main items">{4CE08AF0-CB20-40C2-BE74-BF049DE210B2}</children> </prefetch> Where item is our Home node for the site. I assume children means prefetch all items underneath home node. Questions: Do we need to include both master and web db settings in CMS? Or just master settings in CMS. Do we need to include master and web db settings in CD? Or just Web settings in CD. Where does sitecore stores the cache data for (item cache, data cache and prefetch cache). Wondering if any of them are stored in physical file. I'm using out of box cache page and also sitecore cache admin module (https://marketplace.sitecore.net/en/Modules/Sitecore_Cache_Admin.aspx) The page shows prefetch cache data for both web and master. Wondering how this tool gets the data for web db prefetch for scenario where there are multiple CDs. Or is it just getting from CMS server? 5.When I search for the prefetch item using above mentioned module, I can find it on master prefetch but not on web prefetch. Hence I'm wondering how it shows the prefetch items for Web DB from CMS server.
This error appear when WFFM modules wasn't intalled correctly or some files are missing. In this case GroupListField.xml was missing. I can't tell you the reason, you need to investigate logs file from the day you intalled the module. Please check if the \sitecore\shell\Applications\Modules\Web Forms for Marketers\Controls\constituent\GroupListField.xml file exists in your Sitecore instance. You could compare the file in the module package with file from your installation.
How to solve this issue ("Resource GroupListField is not found Details") in wffm? Recently I installed the WFFM 8.1 upgrade-3 module in Sitecore (8.1 upgrade-3) on my local machine. When I was trying to open Sitecore/components/website/call to action it is showing an error like Resource GroupListField is not found Details. How to solve this issue? Thanks in Advance.
Prepare for a huge wall of text here which is not tested, but should work in theory and is a perfect blog post material :) So the easiest way to do this, is to actually act to the unselectable items in the same way that Sitecore reacts to the unselectable templates - i.e. showing a message and telling that this is not a valid choice. So the first stop should be GetRenderingDataSource Pipeline and GetRenderingDataSourceArgs. You need to create a Custom GetRenderingDataSourceArgs (inheriting from the existing ones) that will host your custom rules. After this being applied you need to create a custom processor and plug it in right before <processor type="Sitecore.Pipelines.GetRenderingDatasource.GetDialogUrl, Sitecore.Kernel"/>. Here you are going to plug your processor that is going to apply your custom rules. Next step would be to override the GetDialogUrl processor, which is going to spawn the window with the rules applied to it. The problem here is that it uses SelectDatasourceOptions class which is one more point you will need to extend. So in the Custom SelectDatasourceOptions you need to add a place for your custom rules, override the ToUrlString method and override the Parse Method, so it can parse correct parameters to the window. After that you need to go back to the GetDialogUrl Processor and pass the new parameter. Now we hopefully will have the window opened and the custom rules paramaters are going to be passed, so the next stop would be the SelectRenderingDatasourceForm. Here you will need to have to use your Custom SelectDatasourceOptions as options. In the parse method (which is actually located in the Property for the Options) I am not 100% sure that you will need to do a new override of the SelectItemOptions.Parse<SelectDatasourceOptions>(), but it is most likely the case that you will. In theory now the data which is passed to the dialog should be handled and you are ready to apply the filtering. The final thing that needs to happen is for you to override the IsSelectable method in which the actual filtering will happen. Hope this makes sense !
Advanced rendering data source criterias Has anyone got any ideas on how to customise the “choose data source dialog” / pipelines; so that only certain items (by tag or otherwise) are available as the selectable data source?
WeBlog utilize standard RSS feed functionality delivered by Sitecore. Take a look at the RSS feed item and its template: /sitecore/templates/System/Feeds/RSS Feed RSS Feed template uses default Feed Delivery Layout (/sitecore/layout/Layouts/System/Feed Delivery Layout) You can find it in your website root: /sitecore/shell/Applications/Feeds/Layouts/FeedDeliveryLayout.aspx When you open it there is nothing special there: <%@ Page Language=&quot;c#&quot; Inherits=&quot;Sitecore.Syndication.Web.FeedDeliveryLayout, Sitecore.Kernel&quot; CodePage=&quot;65001&quot; %> <meta http-equiv=&quot;X-Frame-Options&quot; content=&quot;SAMEORIGIN&quot;> If you feel you need to overwrite something this is the way to go. You can write your own implementation of Sitecore.Syndication.Web.FeedDeliveryLayout, Sitecore.Kernel class and edit the FeedDeliveryLayout.aspx file or create your custom Layout with your own implementation which is more elegant. Edit: TL;DR: I think you are using wrong validator Are you sure that content returned by RSS Layout is different than previously? I don't think that anything changed in Sitecore code. I compared code of following classes, used to generate RSS (8.1.0.0 vs 6.0.0.0) FeedDeliveryLayout.cs FeedManager.cs No changes. I think that right now your are trying to validate your feed as Atom feed. (Atom feed and RSS feed are different formats). Sitecore code: public static string Render(SyndicationFeed feed) { Assert.IsNotNull((object) feed, &quot;feed&quot;); StringWriter stringWriter = new StringWriter(); XmlWriter writer = (XmlWriter) new XmlTextWriter((TextWriter) stringWriter); feed.GetRss20Formatter().WriteTo(writer); return stringWriter.ToString(); } As you can see Sitecore use: GetRss20Formatter Rss20FeedFormatter Class A class that serializes a SyndicationFeed instance to and from RSS 2.0 format. Validation warnings are for Atom. You can find out more here: https://msdn.microsoft.com/en-us/library/system.servicemodel.syndication.syndicationfeed.aspx#Examples If you really want to switch to Atom format, then writing your own Feed Layout is the only one way
Rss Feeds - Weblog module - Sitecore 8.1 Update 2 I have the Weblog module installed on my site. I am now on sitecore 8.1 Update 2. Rss Feeds used to work well with old versions of sitecore. Not sure why it isn't working now. I used the following site to validate my feed and it is giving me the following errors: 1- This feed is valid, but interoperability with the widest range of feed readers could be improved by implementing the following recommendations. line 1, column 0: Avoid Namespace Prefix: a10 [help] 2- line 1, column 14721: Missing atom:link with rel="self" [help] ... Nov 2014 14:30:02 -0600 Any idea where I can fix those errors in the RSS feed, or should I update something or write a specific class to overwrite the current one? Your reply is kindly appreciated.. Thanks!
Answering as a community edit; hoping everyone will get engaged in compiling this list. Trials Do you want to know more about how to build with Sitecore products? Learn more about the trials Sitecore offers for some of the products in our composable DXP. https://developers.sitecore.com/trials Online Sitecore Learning Resources Online Training/E-Learning Official Sitecore learning website Learning@Sitecore (learning.sitecore.com) Official Sitecore developer documentation Developers documentation (doc.sitecore.com) Helix documentation (helix.sitecore.net) JSS Getting Started (jss.sitecore.com) Knowledge Base (kb.sitecore.net) Knowledge Center - Getting Started (sitecore.com) Boxever training is free for everyone Ordercloud (Four51) you can create a free account and start learning The Unofficial Sitecore 8 Training Webinar Series http://www.akshaysura.com/2016/02/03/unofficial-sitecore-8-training-webinar-series-full-curriculum/ Coordinator: @akshaysura13 Sitecore Community Docs Documentation and guides written by the community for developers. This is an open source initiative that the community can edit and contribute back to. Url: http://sitecore-community.github.io/docs/ The Sitecore Link Project This is the most complete collection of Sitecore references ever to exist, verified and classified for your convenience. It also has a section for the beginners for easier start. Url: http://sitecore.link/ You may also subscribe to 300+ RSS feeds of all Sitecore bloggers: http://sitecore.link/rss so that you'll get updated with dozens of new posts daily. Learn Sitecore CMS - Jon D Jones Tutorials, developers guide, content editors guide, and free video tutorials. Url: https://www.jondjones.com/learn-sitecore-cms/ YouTube Sitecore's Official Education Channel - Discover Sitecore https://www.youtube.com/c/DiscoverSitecore Sitecore Training https://www.youtube.com/user/sitecoreceptraining Friday Sitecore Best Practice https://www.youtube.com/user/vasyafomichev Thomas Eldblom's Channel - All things Habitat https://www.youtube.com/channel/UCWHYrLQQIx9vaXcqF5UV9Wg Dylan Young's Channel - Hands on Sitecore training https://www.youtube.com/channel/UC5krmrALirwZibfW9-c2JXw Short unofficial, ad-hoc, Sitecore SXA tutorials https://www.youtube.com/channel/UCn_P819AlbNv_maQCqrKp4g Gopikrishna Gujjula's channel https://www.youtube.com/c/GopiGujjula Sitecore User Group channels Sitecore User Group Bangalore E-books (note: Don't edit in copyright infringing links to e.g. John West's book here) The Quick-Start Guide to Sitecore DMS success http://www.awareweb.com/awareblog/11-2-12-dmsebook Sitecore XP: Valtech Insights https://go.valtech.com/Sitecore-XP-Valtech-Insights.html Books / Recommended Reading A List of Books That Every Sitecore Developer Should Read A comprehensive listing by Mike Reynolds Twitter: @mike_i_reynolds Url: https://sitecorejunkie.com/2015/06/22/a-list-of-books-that-every-sitecore-developer-should-read/ Sitecore Developer Bookshelf 2018 A comprehensive listing by Peter Prochazka Twitter: @chorpo Url: http://tothecore.sk/2018/07/23/sitecore-developer-bookshelf-2018 Professional Sitecore 8 Development: A Complete Guide to Solutions and Best Practices This book is targeted towards both the beginning Sitecore developer with no experience as well as those seasoned Sitecore developers looking to improve the stability, maintainability and quality of their Sitecore solutions. https://www.amazon.com/Professional-Sitecore-Development-Solutions-Practices/dp/1484222911 Practical Sitecore 8 Configuration and Strategy: A User Guide for Sitecore's Content and Marketing Capabilities This book is targeted towards the marketer looking to get the most out of their investment in the Sitecore platform. https://www.amazon.com/Practical-Sitecore-Configuration-Strategy-Capabilities/dp/1484212371 Sitecore Cookbook for Developers: Over 70 incredibly effective and practical recipes to get you up and running with Sitecore development This book is targeted towards beginner Sitecore developers as well as experienced who want to explore core Sitecore architecture for site development, doing customizations, improving performance, and scalability. https://www.amazon.com/Sitecore-Cookbook-Developers-Yogesh-Patel/dp/1784396524/ Ask questions and Connect with Experts Obviously, Sitecore Stack Exchange has great materials for getting answers to your questions. Here are some other ways to ask your questions: Community Forums: community.sitecore.net Slack chat: sitecore.chat Telegram: t.me/SitecoreTelegram Get Sandboxing Above all, only reading or going through blog or articles won't do it all. Start with a Sitecore Sandbox application and for any of the Sitecore components or modules...integrate them - break them and fix them until you get it right. That has helped me always. I am big fan of Sandbox Apps.
How can I get started learning Sitecore? I'm about to start on a Sitecore project in 6-8 weeks time. I have extensive ASP.NET MVC experience (4 years) and know the ins-and-outs of web development fairly well. I am scheduled for official Sitecore developer training in 4 weeks. I would like to prepare myself further by learning as much as I can from online, freely available resources. I am aware of the extensive blogging community that exists, but most of these blogs are focused at developers with some level of expertise. At this point I am more after resources that focus on learning and training from ground up. Where can I go to find information like this? Any community resources? E-books? Webinars? Youtube tutorials? Also; if anyone can recommend any books I can buy, that would be much appreciated as well.
The issue is where you're initializing the Web API DependencyResolver in the Sitecore initialize pipeline. In Sitecore 8.2, the part of the initialize pipeline where the MVC and Web API DependencyResolvers need to be registered is as follows: Sitecore 8.2 Initialize Pipeline <sitecore> <pipelines> <initialize> ... <processor type="Sitecore.Mvc.Pipelines.Loader.InitializeAspNetMvc, Sitecore.Mvc" patch:source="Sitecore.Mvc.config"/> <processor type="Sitecore.Mvc.Pipelines.Loader.InitializeGlobalFilters, Sitecore.Mvc" patch:source="Sitecore.Mvc.config"/> <processor type="Sitecore.Mvc.Pipelines.Loader.InitializeDependencyResolver, Sitecore.Mvc" patch:source="Sitecore.Mvc.config"/> <processor type="Sitecore.Mvc.Pipelines.Loader.InitializeControllerFactory, Sitecore.Mvc" patch:source="Sitecore.Mvc.config"/> <processor type="Sitecore.Mvc.Pipelines.Initialize.InitializeCommandRoute, Sitecore.Speak.Client" patch:source="Sitecore.Speak.Mvc.config"/> <processor type="Sitecore.ContentTesting.Pipelines.Initialize.RegisterContentTestingCommandRoute, Sitecore.ContentTesting" patch:source="Sitecore.ContentTesting.config"/> <processor type="Sitecore.ContentTesting.Pipelines.Initialize.RegisterWebApiRoutes, Sitecore.ContentTesting" patch:source="Sitecore.ContentTesting.config"/> <processor type="Sitecore.Social.Client.Mvc.Pipelines.Initialize.RegisterSocialArea, Sitecore.Social.Client.Mvc" patch:source="Sitecore.Social.config"/> <processor type="Sitecore.Mvc.Pipelines.Loader.InitializeRoutes, Sitecore.Mvc" patch:source="Sitecore.Mvc.config"/> <processor type="Sitecore.FXM.Service.Pipelines.EnableBeaconServiceSessionStateProcessor, Sitecore.FXM.Service" patch:source="Sitecore.FXM.config"/> <processor type="Sitecore.Services.Infrastructure.Sitecore.Pipelines.ServicesWebApiInitializer, Sitecore.Services.Infrastructure.Sitecore" patch:source="Sitecore.Services.Client.config"/> <processor type="Sitecore.PathAnalyzer.Services.Pipelines.Initialize.WebApiInitializer, Sitecore.PathAnalyzer.Services" patch:source="Sitecore.PathAnalyzer.Services.config"/> ... </initialize> <pipelines> </sitecore> You're currently patching your Web API DependencyResolver initialization after Sitecore.Mvc.Pipelines.Loader.InitializeControllerFactory. While that is a perfectly valid place to initialize the MVC DependencyResolver, it is too early for changes to Web API's configuration. For Web API, you must initialize your DependencyResolver no sooner than the Sitecore.Services.Infrastructure.Sitecore.Pipelines.ServicesWebApiInitializer processor, because this processor effectively overwrites the entire GlobalConfiguration.Configuration registry with a brand new one, erasing most configuration changes you make, including your DependencyResolver. Additionally, if you have xDB enabled, the Sitecore.PathAnalyzer.Services.Pipelines.Initialize.WebApiInitializer processor overwrites the HttpControllerActivator for Web API, which could be a breaking change if you choose to customize it in the future. As such, best practice as of Sitecore 8.2 is to make your Web API configuration changes after the Sitecore.PathAnalyzer.Services.Pipelines.Initialize.WebApiInitializer processor. Update your patch file as follows and you should be good to go: Patch <?xml version="1.0"?> <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <pipelines> <initialize> <processor type=" NameSpace.Ioc.Pipelines.InitializeAutofacControllerFactory, NameSpace.Ioc" patch:after="*[@type='Sitecore.PathAnalyzer.Services.Pipelines.Initialize.WebApiInitializer, Sitecore.PathAnalyzer.Services']" /> </initialize> </pipelines> </sitecore> </configuration> As an aside, if you're going to use the ChainedDependencyResolver, I recommend that you change your Autofac registration to register only your Web API Controllers, not all Controllers in the AppDomain. By registering all Controllers in the AppDomain with the Autofac container, you're effectively defeating the purpose of the ChainedDependencyResolver, which is to let your DependencyResolver (AutofacWebApiDependencyResolver) resolve your services, and let the fallback DependencyResolver resolve Sitecore's services. Autofac Initializer public virtual void Process(PipelineArgs args) { var builder = new ContainerBuilder(); // Register All Controllers In The Current Scope, for WebApi builder.RegisterApiControllers(Assembly.GetExecutingAssembly()); // Register Modules builder.RegisterModule<ServicesModule>(); // Register all modules in the data access project builder.RegisterAssemblyModules(typeof(DataAccess.Installer).Assembly); // Build The Container var container = builder.Build(); GlobalConfiguration.Configuration.DependencyResolver = new AutofacWebApiDependencyResolver(container); }
WebApi failing to resolve dependencies I am trying to resolve an implementation via constructor injection, however keep getting the following: An error occurred when trying to create a controller of type 'ApiController'. Make sure that the controller has a parameterless public constructor. We have a mix application which is running sitecore MVC and WebApi side by side in 8.2. MVC resolves dependencies just fine WebApi fails to do so however An example of our InitializeAutofacControllerFactory: public virtual void Process(PipelineArgs args) { var builder = new ContainerBuilder(); // Register All Controllers In The Current Scope, for WebApi builder.RegisterApiControllers(AppDomain.CurrentDomain.GetAssemblies()); // Register Modules builder.RegisterModule<ServicesModule>(); // Register all modules in the data access project builder.RegisterAssemblyModules(typeof(DataAccess.Installer).Assembly); // Build The Container var container = builder.Build(); GlobalConfiguration.Configuration.DependencyResolver = new AutofacWebApiDependencyResolver(container); } WebApi controller, where resolution is failing: public class ApiController : ServicesApiController { private readonly IEntityAccess _entityAccess; public ApiController(IEntityAccess entityAccess) { _entityAccess = entityAccess; } [HttpGet] public IHttpActionResult Create(string title = null, string description = null) { // we do some stuff here } } Stacktrace { "Message":"An error has occurred.", "ExceptionMessage": "An error occurred when trying to create a controller of type 'ApiController'. Make sure that the controller has a parameterless public constructor.", "ExceptionType":"System.InvalidOperationException", "StackTrace": "at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType)\r\n at System.Web.Http.Controllers.HttpControllerDescriptor.CreateController(HttpRequestMessage request)\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()", "InnerException":{"Message":"An error has occurred.", "ExceptionMessage": "Type 'NameSpace.ApiController' does not have a default constructor", "ExceptionType":"System.ArgumentException","StackTrace": " at System.Linq.Expressions.Expression.New(Type type)\r\n at System.Web.Http.Internal.TypeActivator.Create[TBase](Type instanceType)\r\n at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.GetInstanceOrActivator(HttpRequestMessage request, Type controllerType, Func`1&amp; activator)\r\n at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType)"} } We've been following this implementation: https://github.com/HedgehogDevelopment/sitecore-chained-dependency-resolver/tree/feature-autofac Patch <?xml version="1.0"?> <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <pipelines> <initialize> <processor type=" NameSpace.Ioc.Pipelines.InitializeAutofacControllerFactory, NameSpace.Ioc" patch:before="*[@type='Sitecore.Mvc.Pipelines.Loader.InitializeControllerFactory, Sitecore.Mvc']" /> </initialize> </pipelines> </sitecore> </configuration> OWIN Not sure if this is causing it but it has also come to my attention, that we have OWIN setup following similar approach found on: https://blog.baslijten.com/how-to-add-federated-authentication-with-sitecore-and-owin/ to set up OWIN. Trying to get an instance of IAppBuilder in the sitecore pipeline now to make the calls AutoFac recommend for using AutoFac with Owin and WebApi.
Sitecore Publishing Instance is nothing but a clone instance of Sitecore CM environment. On CM server, open \Website\App_Config\Include\Scalability.config file. Update Publish Instance Name as below. <setting name="Publishing.PublishingInstance"> <patch:attribute name="value">PI-Sitecore</patch:attribute> </setting> If the value is empty Sitecore will use the instance name by combining the machine name and the IIS Site name. So for the IIS Site Sitecore on the server PI the instance name would become PI-Sitecore. Just to remember, do not configure above setting on Publish Instance. Note: Sitecore allows to add only one publish instance name in this setting. Enable EventQueue on both CM and PublishInstance servers. To enable EventQueues, from web.config, find EnableEventQueues setting. Set its value to true. This setting can also be set from \App_Config\Include\ScalabilitySettings.config, which will be given more precedence over web.config settings. <setting name="EnableEventQueues"> <patch:attribute name="value">true</patch:attribute> </setting> Disable any scheduled tasks or agents running if not required. More information you can find here
Dedicated CM server for scheduled publish We have a requirement for setting up a dedicated CM server (CM2) that will handle scheduled publishes. Other publishing jobs the users are doing should be handled on the default CM server (CM1). How can we approach for this?
I checked the Goal Definitions table and it seems no more updates are coming to this table, I opened a ticket for Sitecore support and the issue is related to a UI bug. following reply from Sitecore support: The issue appears when the Deploy button is pressed, but the Taxonomies are not deployed (for example, only Goals are deployed). As a result, the processing is finished, but the UI will still display the spinning icon until the window is closed. The reference number for the bug is 107306 for more information.
Marketing definition deployment takes forever When I access Experience Analytics from the Launchpad and click on the goals report, I get a message saying "no data to display". After some searching, it seems that I should deploy marketing definitions (goals) in case I upgraded the site, which is my case. I went to Launchpad -> Control panel -> Analytics -> Deploy Marketing Definitions, then I selected "goals" only and clicked on "Deploy". My problem is the deployment is still working for 3 or 4 days now, and I can't see issues in the log files, is there a way to know how much time it will take? or how I can know if something wrong is happening?
You will need to use component personalization for this. That means all users get access to the page, but on the personalization rules for components you set exceptions based on security. For example: Here is a walkthrough on how to set up component personalization: https://doc.sitecore.net/sitecore_experience_platform/digital_marketing/personalization/walkthrough_personalizing_components
Securing a page with item permissions without redirecting the user away Is it possible to set restrictive extranet group permissions on a page-level item, and still have that page render, albeit differently, to users without the correct permission i.e. present a call to action. I don't want to redirect the user away to a login page. Sitecore's built in handling of this is fairly black and white. It the content user doesn't have item:read permissions, then you are redirected to the login page, or presented the noaccess.aspx page, if you don't have login url set in the site definition. For the sake of an example, if the item has the extranet/everyone inheritance permission denied, and a specific extranet role granted. This restricts the page appropriately. Because the access is blocked at the 'page level' no amount of SecurityDisabler() within controllers or renderings makes any difference. I don't want to use field level permissions, plus in the current scenario the same templates and fields are used for both public and restricted extranet roles. Update: I don't want to redirect away from the page due to SEO requirements (nothing will be indexed for this page if it redirects anonymous users away) and from a UX perspective it is a better experience to remain on the page.
I answered a similar question with Coveo: Speeding up Coveo reindex I am a Coveo guy but eh, indexing is indexing. So as Zachary said in the comments, ensure you do not have any errors and be careful with Computed Fields. I would also add to be careful with anything touching the indexing pipeline, ex: Inbound Filters. Solr is closer to Coveo than Lucene in it's possibility to scale. If you feel that your indexing is too slow, I would suggest to split your indexes using the crawler root: https://stackoverflow.com/questions/38198334/sitecore-solr-index-configuration-set-different-root-path This way you could rebuild your indexes without large media items. And maybe separate your media library in smaller pieces. You can also scale your Solr using slaves. @Søren Engel from Pentia did a great series of posts about scaling: https://soen.ghost.io/tackling-the-challenges-of-architecting-a-search-indexing-infrastructure-in-sitecore-part-1/ Slaves would get rid of the query load on the indexing server.
Configuring master and web index for faster rebuild During an upgrade from 6.x to 8.1 we decided to also move the indexes from Lucene to Solr. We ran into quite some troubles, but that is not the question as those are fixed. The "problem" I'm still having is that an index rebuild for sitecore_web_index or sitecore_master_index is taking 5 to 6 hours (on a dedicated dev server). Maybe that is normal for 1 to 1.5M items.. maybe it will go faster on the prod environment. To get it running, we had to put 14GB of memory into the dev server as the initial 7 was not enough. We also had to increase the timeout on the SolrConnection a lot higher than the default (in the Autofac Solr setup). We do use the index in code to search items based on path, template and or language but have no customizations to these indexes (we have a few custom indexes for those needs). I was wondering however (this is the actual question) if there is a way to get the indexes rebuild faster. Some config changes to Sitecore or Solr maybe, or .. well anything that might help to reduce the time to rebuild. Edit: On the CD's I do not need the media items in the indexes and apparently I could disable those (which would help - a lot), but what would the side effects be on the CM? Will image fields still work correctly and will I be able to search for a media item? And how do I disable the media items correctly in a default solr config?
As of Sitecore 7.5+ (applies to the latest 7.2 versions as well), Sitecore introduced a media request protection for image resizing (to make sure an attacker can't overload your server with image resize requests) In this case you have two options: Add a media hash to the resizing requests, like that: Sitecore.Resources.Media.HashingUtils.ProtectAssetUrl ( Sitecore.Resources.Media.MediaManager.GetMediaUrl( myMediaItem, new MediaUrlOptions() { Language = Context.Language, Width = 100, Height = 75 })) Disable media request protection (not recommended) You can find more details in this blog post: http://kirkegaard-at.blogspot.sg/2015/06/media-hash-and-resizing.html
Sitecore media ashx not resizing the image (version 7.2) We have 3 (near identical) Sitecore sites on a development server and 2 out of the 3 fail to resize the images using the inbuilt Sitecore query string parameters. Example URL: /~/media/59274CA8941B4540B7B1A6C0FEAE9F84.ashx?w=300&amp;h=30 The media image is returned but it fails to resize the image. So far I've tried file permissions, config diff (web.config and showconfig.aspx) but nothing obvious stands out. I'm thinking its something in IIS but cannot think what.
Turns out the problem was not having a -Language parameter for the Get-ChildItem call. Sometimes it would be evaluated for the correct language and sometimes not. Forcing the language fixed the problem :)
Sitecore ISE powershell inconsistent results I am running a script in Sitecore powershell to find items bases on a regular expression on a custom field ('Subkey'). This script sometimes shows results and sometimes shows 'No items available'. Why is this not consistent? And how is this possible? I am running this within the Sitecore ISE Write-Host "Begin script" function Get-InvalidKeysAndSubkeys { #param([string]$label) Get-ChildItem -Recurse | Where-Object { ( ((![string]::IsNullOrEmpty($_.Subkey)) -and ($_.Subkey -match "[^a-zA-Z0-9$ \-_\.!'()]")) ) } } $x = Get-InvalidKeysAndSubkeys $x | Show-ListView -Property Name,Key,SubKey,Id,ItemPath Write-Host "End script"
I think that what you want here is not actually feed data into xDB, but rather export data from xDB, Google Analytics and whatever other analytics you have, and combine it using an external BI tool so it can be analyzed as one set of data. Assuming your other analytics tools already have options for exporting the data, you only need to export the xDB data. This can be achieved with the upcoming xConnect API, which unfortunately is not yet available at this point (not until Sitecore 8.3). It will provide you with an oData endpoint that can be used in tools like Tableau and Power BI where you can analyse them. If you can't wait until 8.3 then there is a another way, although it's much less user-friendly, the Sitecore Experience Extractor: https://github.com/Sitecore/experience-extractor That tools allows you to extract data from xDB based on certain criteria which you can then load into an external BI tool, together with your other analytics data, in order to analyse it.
Can we feed external data to xDB? For example Google Analytics, Adobe Analytics or any other data to make a consolidated data report from Sitecore xDB. If it is feasible, is there any guide on how to feed in data in real time or automatically. Thank you in advance.
I had a similar issue and it was originated by the Guids. The multilist fields should store IDs instead of Guids. You can do the following: Remove all your selected items and add them manually. Save your changes and verify your raw values are IDs. Debug your solution and you will see that your items will be mapped. If you are adding items programmatically, you should add IDs (new ID(Guid/string))
Glass Sitecore Service save object for multilist resulting in 'Item not in list' warning I'm using ISitecoreService (Glass.Sitecore.Mapper, Version=2.0.11.0) to save a glass item defined like this in Sitecore.NET 6.6.0 (rev. 130111): [SitecoreClass(false,"{3ACCADE1-C482-422C-9A22-3479C661B6AD}")] public partial interface IAnnouncementInfoItem:ISitecoreItem { [SitecoreField(FieldName = "Announcement Text",CodeFirst = false)] string AnnouncementText { get; set; } [SitecoreField(FieldName = "Working Groups",CodeFirst = false)] IEnumerable<Guid> WorkingGroups { get; set; } } I'm running into an issue with the MultiList (mapped as IEnumerable<Guid>) where each value shows up as "Not in List" even though the value is clearly in the source. The Guids match up correctly with the items defined in the source. It even finds the names of the values correctly. The only difference I have found between the items saved through SitecoreService and those saved from Content editor is that the Guids are saved as lowercase values when saved from SitecoreService. Has anyone ran into this issue before? It seems like there is some case sensitivity happening but not sure if this is a bug in Sitecore, GlassMapper or something else entirely. Update When saving the item I'm passing in some text and a list of Guids: public void SaveAnnouncement(Guid announcementId, string text, IList<Guid> workingGroupIds) { var announcementItem = _srcItem.AnnouncementsFolderItem.GetChildrenOfType<IAnnouncementItem>().FirstOrDefault(c => c.Id == announcementId); announcementItem.AnnouncementText = text; announcementItem.Name = ItemUtil.ProposeValidItemName(text); announcementItem.WorkingGroups = workingGroupIds ?? new List<Guid>(); using (new SecurityDisabler()) { //wrapper on SitecoreServiceMaster _dependencies.GlassSitecoreServiceManager.Master.Save(item); } }
Yes, you definitely still need to perform regular database maintenance. Especially on Sitecore DBs like Analytics that have a lot of activity and develop index fragmentation quickly. At least, if you want to maintain performance of your site. I should mention, that whitepaper was written a long time ago, and Azure gets updates every month. A number of the suggestions and practices we put into that document have been superseded. For example, we mostly use SQL Elastic Pools for all non-production databases these days as they are very cost effective compared with standalone DB provisioning. They can also work for production DBs, but you might want to dedicate performance to your Analytics DB - depending on your workload. The comment about reduced cost is no longer applicable - SQL DBs now have a capped size based on their performance tier and there is no meter applicable to the actual storage consumed to my knowledge. Maintenance via Azure Automation We have an Azure Automation account that has runbooks that perform these tasks for us. Runbooks can be scheduled on a timer, or triggered via a webhook. Our runbook looks like this: workflow Update-SQLIndexRunbook { param( [parameter(Mandatory=$True)] [string] $SqlServer, [parameter(Mandatory=$True)] [string] $Database, [parameter(Mandatory=$True)] [string] $SQLCredentialName, [parameter(Mandatory=$False)] [int] $FragPercentage = 20, [parameter(Mandatory=$False)] [int] $SqlServerPort = 1433, [parameter(Mandatory=$False)] [boolean] $RebuildOffline = $False, [parameter(Mandatory=$False)] [string] $Table ) # Get the stored username and password from the Automation credential $SqlCredential = Get-AutomationPSCredential -Name $SQLCredentialName if ($SqlCredential -eq $null) { throw "Could not retrieve '$SQLCredentialName' credential asset. Check that you created this first in the Automation service." } $SqlUsername = $SqlCredential.UserName $SqlPass = $SqlCredential.GetNetworkCredential().Password $TableNames = Inlinescript { $db = $Using:Database $frag = $Using:FragPercentage # Define the connection to the SQL Database $Conn = New-Object System.Data.SqlClient.SqlConnection("Server=tcp:$using:SqlServer,$using:SqlServerPort;Database=$using:Database;User ID=$using:SqlUsername;Password=$using:SqlPass;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;") # Open the SQL connection $Conn.Open() # SQL command to find tables and their average fragmentation $SQLCommandString = @" SELECT t.Name, MAX(avg_fragmentation_in_percent) MaxFragmentation FROM sys.dm_db_index_physical_stats ( DB_ID(N'$db'), OBJECT_ID(0), NULL, NULL, NULL ) a JOIN sys.indexes b ON a.object_id = b.object_id AND a.index_id = b.index_id JOIN sys.tables t on t.object_id = a.object_id WHERE a.avg_fragmentation_in_percent >= $frag GROUP BY t.name; "@ # Return the tables with their corresponding average fragmentation $Cmd=new-object system.Data.SqlClient.SqlCommand($SQLCommandString, $Conn) $Cmd.CommandTimeout=120 # Execute the SQL command $FragmentedTable=New-Object system.Data.DataSet $Da=New-Object system.Data.SqlClient.SqlDataAdapter($Cmd) [void]$Da.fill($FragmentedTable) # Return the table names that have high fragmentation ForEach ($FragTable in $FragmentedTable.Tables[0]) { Write-Verbose ("Table:" + $FragTable.Item("Name")) Write-Verbose ("Max Index Fragmentation:" + $FragTable.Item("MaxFragmentation")) $FragTable.Item("Name") } $Conn.Close() } # If a specific table was specified, then find this table if it needs to indexed, otherwise # set the TableNames to $null since we shouldn't process any other tables. If ($Table) { Write-Output ("Single Table specified: $Table") If ($TableNames -contains $Table) { $TableNames = $Table } Else { # Remove other tables since only a specific table was specified. Write-Output ("Table not found: $Table") $TableNames = $Null } } # Iterate through tables with high fragmentation and rebuild indexes ForEach ($TableName in $TableNames) { Write-Output "Creating checkpoint" Checkpoint-Workflow Write-Output "Indexing Table $TableName..." InlineScript { $SQLCommandString = @" EXEC('ALTER INDEX ALL ON $Using:TableName REBUILD with (ONLINE=ON)') "@ # Define the connection to the SQL Database $Conn = New-Object System.Data.SqlClient.SqlConnection("Server=tcp:$using:SqlServer,$using:SqlServerPort;Database=$using:Database;User ID=$using:SqlUsername;Password=$using:SqlPass;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;") # Open the SQL connection $Conn.Open() # Define the SQL command to run. In this case we are getting the number of rows in the table $Cmd=new-object system.Data.SqlClient.SqlCommand($SQLCommandString, $Conn) # Set the Timeout to be less than 30 minutes since the job will get queued if > 30 # Setting to 25 minutes to be safe. $Cmd.CommandTimeout=1500 # Execute the SQL command Try { $Ds=New-Object system.Data.DataSet $Da=New-Object system.Data.SqlClient.SqlDataAdapter($Cmd) [void]$Da.fill($Ds) } Catch { if (($_.Exception -match "offline") -and ($Using:RebuildOffline) ) { Write-Output ("Building table $Using:TableName offline") $SQLCommandString = @" EXEC('ALTER INDEX ALL ON $Using:TableName REBUILD') "@ # Define the SQL command to run. $Cmd=new-object system.Data.SqlClient.SqlCommand($SQLCommandString, $Conn) # Set the Timeout to be less than 30 minutes since the job will get queued if > 30 # Setting to 25 minutes to be safe. $Cmd.CommandTimeout=1500 # Execute the SQL command $Ds=New-Object system.Data.DataSet $Da=New-Object system.Data.SqlClient.SqlDataAdapter($Cmd) [void]$Da.fill($Ds) } Else { # Will catch the exception here so other tables can be processed. Write-Error "Table $Using:TableName could not be indexed. Investigate indexing each index instead of the complete table $_" } } # Close the SQL connection $Conn.Close() } } Write-Output "Finished Indexing" } As you can see, this runbook takes a number of parameters. The only one worth mentioning is $SQLCredentialName which refers to the name of a Credential Asset stored in the Automation Account itself. Suggested Indexes In regards to the second part of your question, every team uses the Sitecore DBs a little differently. SQL Azure monitors the use of the system and the query plans it generates and tries to work out whether the plans could benefit from additional indexes. When it thinks it has one, it makes the suggestion. If you elect to implement the suggestion it will run some tests to ensure it has actually made an improvement, and will roll back if it hasn't. We implement almost all the suggestions it offers. Indexes are generally not material to the operation of a database so they're safe to add, with a few critical exceptions (like clustered and unique indexes). For the most part, as long as your DB tier offers you sufficient storage, we recommend adding any index suggested with either a Medium or High Impact rating.
Sitecore Azure SQL database maintenance In this Sitecore on Azure Migration white paper http://www.slideshare.net/Jerrynott/azuremigrationwp004 It mentions on Page 17 It should be remembered that general database maintenance is still required. Index rebuilds and defragmentation are a standard maintenance task that must be carried out on any database, even Azure SQL databases, as the platform cannot determine whether these tasks are relevant for a given implementation automatically. This is a common cause of Sitecore performance problems. Create stored procedures to perform routine index maintenance, and use the Azure Scheduling and Automation platform to execute these procedures regularly. Aside from improving database performance, reduced fragmentation also reduces the overall space of the database and therefore reduces the cost. Is this still needed in the latest version of Azure SQL (PAAS)? And are there any examples of this? I also found this quote https://mhwelander.net/2014/09/23/sitecore-azure-for-beginners-part-1-what-is-microsoft-azure/ Make sure you understand the limitations of the services that the Sitecore Azure module relies on – for example, SQL Azure has limits on transaction log size, which becomes an problem when attempting to rebuild heavily fragmented indexes. And am I right thinking that you shouldn't add any custom indexes to a sitecore database, even if Azure SQL recommends for an index to be added? (As these changes won't be supported by Sitecore)
I have this issue on Sitecore 8.1 Initial Release. To fix it you need to add on publish:end and publish:end:remote event a new handler. This is the class: public class DictionaryCacheClearer { /// <summary> /// Clears the whole dictionary domain cache. /// </summary> /// <param name="sender">The sender.</param> /// <param name="args">The <see cref="EventArgs"/> instance containing the event data.</param> public void ClearCache(object sender, EventArgs args) { Translate.ResetCache(); Log.Info("Dictionary cleared", this); } } On publish:end and publish:end:remote events you will have: <event name="publish:end:remote"> <handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel" method="ClearCache"> <sites hint="list"> <site s="1">YourSite</site> </sites> </handler> <handler type="YourNameSpace.DictionaryCacheClearer, YourAssembly" method="ClearCache" /> </event> <event name="publish:end"> <handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel" method="ClearCache"> <sites hint="list"> <site s="1">YourSite</site> </sites> </handler> <handler type="YourNameSpace.DictionaryCacheClearer, YourAssembly" method="ClearCache" /> </event> Other fix you find it here: https://community.sitecore.net/developers/f/8/t/173
Dictionary, getting key instead of phrase randomly We have a site that loads a fair deal of data via web api from inside our own project and have stumbled upon some odd behavior regarding dictionaries. It seems that it more or less randomly succeeds in getting the phrase from the dictionary. One example is a product listing page that fetches "in stock" and "out of stock" dictionaries along with other product information. Loading the page for the first time one product would get the "in stock" key instead of the phrase while the rest gets the correct phrase for the same key, reloading the page and a completely random product gets the key and not the phrase while the rest works. This is the method we are using: Sitecore.Globalization.Translate.Text("KEY"); We have tried getting the dictionaries from both static and non-static classes. The SC version we are using is 8.1 (rev. 160302) Any tips would be greatly appreciated. This occurs in multiple dev environment as well as on a test server. Thanks
I'll gather information from the comments and post them as a community wiki since not everyone is reading the comments and answer is always an answer. This issue might occur if there are multiple site definitions. Potential reasons: Accessing sites using different hostname that is defined in the site definition Preview.ResolveSite property in the Sitecore config is set to true Preview.DefaultWebsite property in the Sitecore config is set to the website you are visitinig Suggested workaround: Remove the parameter from query string Set the value of the parameter to 0 The button is in the core database, in /sitecore/client/Applications/Launchpad/PageSettings/Buttons/ContentEditing/ExperienceEditor There is an assumption that this might be a Sitecore bug. If you can explain the mechanism of how this parameter work please include information here. Sitecore has confirmed this behavior as a bug. The public reference number for it is 80705.
Experience Editor does not work from LaunchPad (if sc_resolvelanguage=1) Experience editor from content tree works fine, i.e. link: http://[myhostname]/?sc_mode=edit&amp;sc_itemid=%7bA072B881-5A9D-4288-A4E1-4F64CD7CFDA3%7d&amp;sc_version=1&amp;sc_lang=en&amp;sc_site=[mysite] Experience editor button form LaunchPad does not work (getting "The requested document was not found" error) I.e. link http://[myhostname]/?sc_mode=edit&amp;sc_resolvelanguage=1 If i remove &amp;sc_resolvelanguage=1 from params, it works fine Sitecore.NET 8.1 (rev. 160519) Managed to reproduce it on several projects/environments. Any ideas? Update to share site config: <site name="mysite" enableTracking="true" language="en" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/mysite" hostName="[myhostname]" startItem="/Home" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="50MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="25MB" filteredItemsCacheSize="10MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" cacheRenderingParameters="true" renderingParametersCacheSize="10MB" mvcArea="Public" patch:source="Z.mysite.SiteDefinition.config" />
As Sergeant Sitecore suggested, the WFFM submissions are stored in Mongo. This lead me to discover the reason I wasn't seeing the most up-to-date data was because the analytics database was out of sync with Mongo. Following these steps to rebuild the reporting database fixed my issue. https://doc.sitecore.net/sitecore_experience_platform/setting_up__maintaining/xdb/server_considerations/walkthrough_rebuilding_the_reporting_database So migrating WFFM reports will include migrating Mongo data as well as potentially rebuilding the reporting databases.
Is it possible to package WFFM form responses? Using Sitecore 8.1, we are migrating the site to a different server. During the content freeze there will probably be subscribers and registrations that happen after the database backup and before the database restore. Is it possible to package up the WFFM form captures? I have tested packaging up the forms themselves, but the recorded data is not included. If it's not possible, has anyone solved this in another was aside a second database backup and transfer post launch?
The URL of the Coveo/Rest extension is set in the Coveo.SearchProvider.Rest.config. Start by validating it. The the site itself is in the Coveo.SearchProvider.config and should look like this: <site patch:before="*[1]" name="coveorest" virtualFolder="/coveo/rest" physicalFolder="/coveo/rest" enableAnalytics="false" database="web" domain="extranet" /> Make sure the virtualfolder and the database are fine. Look at IIS to see if the site was added properly. Then for your CD error, the switch master to web deletes the Coveo Master Index, if you still have a shell or a master index on your CD, make sure to disable all of this, since you should only be hitting web on the CD.
Getting Coveo configured properly in a CD/CM server setup My environment scenario is the following: Database server CM server with CES 7 (free) installed CD server I was advised to follow the Coveo scaling guide (developers.coveo.com/display/public/SitecoreV4/Installing+Coveo+for+Sitecore+in+a+CM+or+CD+Configuration) for hooking up the CD server such that it doesn't need to be reindexed. However, that appears to assume: a) I have a database named "pub" from a Sitecore scaling (which I don't - I use default core, master, web) and b) that I have Coveo CES installed on a separate server (I don't but our database server was our QA server and has Sitecore and CES7 on it, but the end goal is to only run the databases there, not Sitecore or Coveo). So after following the guide as best I can, I have the following issues: On CM, if I navigate to [URL]/coveo/rest, I get a 404 error. I looked this issue up and checked what was suggested, but don't see any issues that should be keeping this from working. On CD, after I set up the "switch master to web" stuff, I now get a "Precondition failed: The parameter 'p_SearchIndex' must not be null" error when I hit a page with a Sitecore component. I'm using Sitecore 8.1 Update 1, with the 222 version of Coveo for Sitecore 4. Any advice on getting my setup tuned properly would be helpful. Thanks! Update: my CM configs from the Coveo folder are zipped up here: https://dl.dropboxusercontent.com/u/1654372/Coveo.zip - and my ShowConfig from my CM is here: https://dl.dropboxusercontent.com/u/1654372/ShowConfig.txt
I am not aware any IOPS guidelines, but there is a Sitecore Experience Platform 8.2 Performance White Paper where they have made many test and the Premium Storage Account is only mentioned for MongoDB. In general, your Primary MongoDB takes the biggest hit and needs the fastest drives. Other than that, Sitecore solutions have largely been found to be CPU bound, rather than bound by performance of drives and storage systems.
Sitecore CM/CD/SQL IOPS Guidelines When looking at whether Azure premium storage is necessary, IOPS (input/output operations per second) is a good metric/guideline to look at. Does Sitecore provide any recommendations/guidelines as to what range is recommended for content management, content delivery and SQL Servers? Sitecore does provide guidance for Mongo servers, as they are known for needing specific IOP levels. I am looking for specific numbers for the other server roles.
Your collection getters need to access the actual collections by using proper keys: public IElementCollection<IHistoryChangeElement> Changes { get { return GetCollection<IHistoryChangeElement>(COLLECTION_CHANGE); } } public IElementCollection<IHistoryLocationElement> Locations { get { return GetCollection<IHistoryLocationElement>(COLLECTION_LOCATION); } } Note that I used COLLECTION_CHANGE and COLLECTION_LOCATION instead of FACET_NAME. Those are the keys you used when you ensured these collections in the constructor: EnsureCollection<IHistoryChangeElement>(COLLECTION_CHANGE); EnsureCollection<IHistoryLocationElement>(COLLECTION_LOCATION); So now you should use the same keys to access them. The KeyNotFoundException is thrown because there are no collections registered in the facet with the key FACET_NAME.
System.Collections.Generic.KeyNotFoundException when calling Create method on Facet I have the following code to reference a custom facet. var contact = Tracker.Current.Session.Contact; IHistoryFacet history = contact.GetFacet<IHistoryFacet>("History"); IHistoryLocationElement historyLocation = history.Locations.Create(); It appears to fail on the last line with an error of: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary. I do not understand why. This is my HistoryFacet.cs file: using Sitecore.Analytics.Model.Framework; using System; namespace MySite.Models.Facets { [Serializable] public class HistoryFacet : Facet, IHistoryFacet { private const string FACET_NAME = "History"; private const string COLLECTION_CHANGE = "Changes"; private const string COLLECTION_LOCATION = "Locations"; public HistoryFacet() { EnsureCollection<IHistoryChangeElement>(COLLECTION_CHANGE); EnsureCollection<IHistoryLocationElement>(COLLECTION_LOCATION); } public IElementCollection<IHistoryChangeElement> Changes { get { return GetCollection<IHistoryChangeElement>(FACET_NAME); } } public IElementCollection<IHistoryLocationElement> Locations { get { return GetCollection<IHistoryLocationElement>(FACET_NAME); } } } } Here is my HistoryLocationElement.cs file: using Sitecore.Analytics.Model.Framework; using System; using System.Net; namespace MySite.Models.Facets { [Serializable] public class HistoryLocationElement : Element, IHistoryLocationElement { private const string FIELD_DATE = "Date"; private const string FIELD_IP_ADDRESS = "IP Address"; private const string FIELD_STREET_ADDRESS_LINE_01 = "Street Address Line 1"; private const string FIELD_STREET_ADDRESS_LINE_02 = "Street Address Line 2"; private const string FIELD_STREET_ADDRESS_LINE_03 = "Street Address Line 3"; private const string FIELD_STREET_ADDRESS_LINE_04 = "Street Address Line 4"; private const string FIELD_CITY = "City"; private const string FIELD_METRO_CODE = "Metro Code"; private const string FIELD_REGION = "Region"; private const string FIELD_REGION_CODE = "Region Code"; private const string FIELD_POSTAL_CODE = "Postal Code"; private const string FIELD_COUNTRY = "Country"; private const string FIELD_COUNTRY_CODE = "Country Code"; private const string FIELD_LONGITUDE = "Longitude"; private const string FIELD_LATITUDE = "Latitude"; private const string FIELD_ZENITH = "Zenith"; private const string FIELD_TIMEZONE = "Timezone"; public HistoryLocationElement() { EnsureAttribute<DateTime>(FIELD_DATE); EnsureAttribute<IPAddress>(FIELD_IP_ADDRESS); EnsureAttribute<string>(FIELD_STREET_ADDRESS_LINE_01); EnsureAttribute<string>(FIELD_STREET_ADDRESS_LINE_02); EnsureAttribute<string>(FIELD_STREET_ADDRESS_LINE_03); EnsureAttribute<string>(FIELD_STREET_ADDRESS_LINE_04); EnsureAttribute<string>(FIELD_CITY); EnsureAttribute<int>(FIELD_METRO_CODE); EnsureAttribute<string>(FIELD_REGION); EnsureAttribute<string>(FIELD_REGION_CODE); EnsureAttribute<string>(FIELD_POSTAL_CODE); EnsureAttribute<string>(FIELD_COUNTRY); EnsureAttribute<string>(FIELD_COUNTRY_CODE); EnsureAttribute<double>(FIELD_LONGITUDE); EnsureAttribute<double>(FIELD_LATITUDE); EnsureAttribute<double>(FIELD_ZENITH); EnsureAttribute<string>(FIELD_TIMEZONE); } public DateTime Date { get { return GetAttribute<DateTime>(FIELD_DATE); } set { SetAttribute(FIELD_DATE, value); } } public IPAddress IPAddress { get { return GetAttribute<IPAddress>(FIELD_IP_ADDRESS); } set { SetAttribute(FIELD_IP_ADDRESS, value); } } public string StreetAddressLine01 { get { return GetAttribute<string>(FIELD_STREET_ADDRESS_LINE_01); } set { SetAttribute(FIELD_STREET_ADDRESS_LINE_01, value); } } public string StreetAddressLine02 { get { return GetAttribute<string>(FIELD_STREET_ADDRESS_LINE_02); } set { SetAttribute(FIELD_STREET_ADDRESS_LINE_02, value); } } public string StreetAddressLine03 { get { return GetAttribute<string>(FIELD_STREET_ADDRESS_LINE_03); } set { SetAttribute(FIELD_STREET_ADDRESS_LINE_03, value); } } public string StreetAddressLine04 { get { return GetAttribute<string>(FIELD_STREET_ADDRESS_LINE_04); } set { SetAttribute(FIELD_STREET_ADDRESS_LINE_04, value); } } public string City { get { return GetAttribute<string>(FIELD_CITY); } set { SetAttribute(FIELD_CITY, value); } } public int MetroCode { get { return GetAttribute<int>(FIELD_METRO_CODE); } set { SetAttribute(FIELD_METRO_CODE, value); } } public string Region { get { return GetAttribute<string>(FIELD_REGION); } set { SetAttribute(FIELD_REGION, value); } } public string RegionCode { get { return GetAttribute<string>(FIELD_REGION_CODE); } set { SetAttribute(FIELD_REGION_CODE, value); } } public string PostalCode { get { return GetAttribute<string>(FIELD_POSTAL_CODE); } set { SetAttribute(FIELD_POSTAL_CODE, value); } } public string Country { get { return GetAttribute<string>(FIELD_COUNTRY); } set { SetAttribute(FIELD_COUNTRY, value); } } public string CountryCode { get { return GetAttribute<string>(FIELD_COUNTRY_CODE); } set { SetAttribute(FIELD_COUNTRY_CODE, value); } } public double Longitude { get { return GetAttribute<double>(FIELD_LONGITUDE); } set { SetAttribute(FIELD_LONGITUDE, value); } } public double Latitude { get { return GetAttribute<double>(FIELD_LATITUDE); } set { SetAttribute(FIELD_LATITUDE, value); } } public double Zenith { get { return GetAttribute<double>(FIELD_ZENITH); } set { SetAttribute(FIELD_ZENITH, value); } } public string Timezone { get { return GetAttribute<string>(FIELD_TIMEZONE); } set { SetAttribute(FIELD_TIMEZONE, value); } } } } Here is my IHistoryFacet.cs file: using Sitecore.Analytics.Model.Framework; namespace MySite.Models.Facets { public interface IHistoryFacet : IFacet { IElementCollection<IHistoryChangeElement> Changes { get; } IElementCollection<IHistoryLocationElement> Locations { get; } } } Here is my IHistoryLocationElement.cs file: using Sitecore.Analytics.Model.Framework; using System; using System.Net; namespace MySite.Models.Facets { public interface IHistoryLocationElement : IElement { DateTime Date { get; set; } IPAddress IPAddress { get; set; } string StreetAddressLine01 { get; set; } string StreetAddressLine02 { get; set; } string StreetAddressLine03 { get; set; } string StreetAddressLine04 { get; set; } string City { get; set; } int MetroCode { get; set; } string Region { get; set; } string RegionCode { get; set; } string PostalCode { get; set; } string Country { get; set; } string CountryCode { get; set; } double Longitude { get; set; } double Latitude { get; set; } double Zenith { get; set; } string Timezone { get; set; } } } I am not sure what key it is referring to.
It sounds like you have a matching item in /sitecore/System/Dictionary/. I did a quick test by adding a Dictionary item that matches the name of a field and the Content Editor picks it up.
Field names in content editor are wrong (multiple colons and no capitalisation) but fine in VS I have a situation where I have a template and thus content items of that template whereby the field names seem to have problems in the content editor but not in visual studio. Notice below that city and postal code both have 2 colons and postal code is not properly capitalised. But Visual Studio seems to show these field names just fine, and everywhere I look, everything seems fine. As a note, there is no complex template inheritance happening. The template where this occurs is derived only from Standard template and the fields in question are Template fields. Additionally, I can access the field values using their correct names. One example being item["Postal Code"], but the field name still displays incorrectly in the content editor. I have already tried deleting the fields and then re-adding them, and the problem still persists. I also created brand new content items from the template after the changes, and the problem still persists. I would and could delete the template and start over, but the template in question has a lot of fields and a lot of validation happening on each field, so I'd rather not restart. Thoughts are appreciated.
Actually, it's relatively straight forward. IsExperienceEditorEditing is false when you're editing a component - but editing it via Edit Related Item. I've added a bit of code to Default Sublayout.ascx to demonstrate. .IsExperienceEditor: <%= Sitecore.Context.PageMode.IsExperienceEditor %><br /> .IsExperienceEditorEditing: <%= Sitecore.Context.PageMode.IsExperienceEditorEditing %><br /> I then go... And Sitecore opens up like this. I think you're meant to use this to render your content "normally" when IsExperienceEditorEditing is false like this - and render it "context aware" when it's not.
What is the difference between IsExperienceEditor and IsExperienceEditorEditing What is the difference between Sitecore.Context.PageMode.IsExperienceEditor and Sitecore.Context.PageMode.IsExperienceEditorEditing? I've always used Sitecore.Context.PageMode.IsExperienceEditor in my code, but I've noticed that some frameworks such as Glass Mapper use Sitecore.Context.PageMode.IsExperienceEditorEditing. Sitecore.Context.PageMode.IsExperienceEditorEditing sounds like it would only return true when in the Experience Editor and Edit Mode is enabled, or when Editing is turned on under the view tab; however, I've found that Sitecore.Context.PageMode.IsExperienceEditorEditing always returns the same value as Sitecore.Context.PageMode.IsExperienceEditor.
Is it possible that the title field is not a facet? According to developers.coveo.com/display/SitecoreV4/Provide+Query+Suggestions: - The field used for suggestions needs to be a facet field
Suggestion error with Coveo search box Anyone know what could be causing this? I'm implementing a field suggest on a CoveoSearchBox and when I test the suggest on every char I enter it is calling the rest call and it shows a JS error. Here is the url it tries to access: http://sitecore81/coveo/rest/v2/values?sitecoreItemUri=sitecore%3A%2F%2Fmaster%2F%7B110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9%7D%3Flang%3Den%26ver%3D1&amp;siteName=website "statusCode" : 400, "message" : "The parameter is missing: field", "type" : "MissingParameterException", "executionReport" : [ { "children" : [ { "description" : "Perform authentication", "duration" : 1, "configured" : { "trust" : null, "primary" : [ "SearchToken", "Windows" ], "secondary" : [ ], "admin" : "NobodyAllowed", "fallback" : null, "mandatory" : [ ] }, Here is how my searchbox is defined: <div class="CoveoSearchbox form-control" data-auto-focus="@Model.AutoFocus" data-enable-lowercase-operators="@Model.EnableLowercaseOperators" data-enable-partial-match="@Model.EnablePartialMatch" data-partial-match-keywords="@Model.PartialMatchKeywords" data-partial-match-threshold="@Model.PartialMatchThreshold" data-enable-question-marks="@Model.EnableQuestionMarks" data-enable-wildcards="@Model.EnableWildcards" data-enable-omnibox="true" data-omnibox-timeout="@Model.OmniboxTimeout" data-enable-field-addon="@Model.OmniboxEnableFieldAddon" data-enable-simple-field-addon="@Model.OmniboxEnableSimpleFieldAddon" data-enable-top-query-addon="@Model.OmniboxEnableTopQueryAddon" data-enable-reveal-query-suggest-addon="@Model.OmniboxEnableRevealQuerySuggestAddon" data-enable-query-extension-addon="@Model.OmniboxEnableQueryExtensionAddon"> <span class="CoveoFieldSuggestions" data-header-title="Results" data-field="@Model.ToCoveoFieldName("title")"></span> </div>
Slow HTTP attacks are denial-of-service (DoS) attacks that rely on the fact that the HTTP protocol, by design, requires a request to be completely received by the server before it is processed. If an HTTP request is not complete, or if the transfer rate is very low, the server keeps its resources busy waiting for the rest of the data. When the server’s concurrent connection pool reaches its maximum, this creates a denial of service. These attacks are problematic because they are easy to execute, i.e. they can be executed with minimal resources from the attacking machine. Microsoft has confirmed the vulnerability in a security bulletin and released software updates. February 2014 Microsoft has released a security bulletin at the following link: MS14-009 Most enterprise sites/datacenters will have DoS defender specialized hardware, firewalls, load balancers, etc. DoS attacks should be blocked just while entering your hosting infrastructure not at the end when request is being processed by web server. Below are some configuration recommendations that may help preventing DoS attacks (tested with Sitecore 8.1 rev. 160519). Suggested configuration changes will not guarantee 100% protection. I would rather say it will defend from “junior” attackers with limited resources. Requests from let’s say 10000 different locations that bypass configuration limitations and dynamic IP restrictions will put a lot of stress on your web server and eventually cause denial of service. Request Limits <requestLimits> Requires Request Filtering feature has to be enabled. Maximum URL length (Bytes) Default value : 4096 Recommended value : 2048 Maximum query string length (Bytes) Default value : 2048 Recommended value : 1024 Allow unlisted verbs Default value : true Recommended value : false (Make sure to configure listed verbs) maxAllowedContentLength Default value : 30000000, which is approximately 28.6MB. Recommended value : Recommended value for Sitecore setup will vary based on requirements to upload media. For CD server such value can be minimized, while for CM server you may want to upload large size files i.e. have value maximized. Configuration instructions: https://www.iis.net/configreference/system.webserver/security/requestfiltering/requestlimits Website <limits> connectionTimeout Default value : 00:02:00 (two minutes) Recommended value : 00:00:30 Configuration instructions: https://www.iis.net/configreference/system.applicationhost/sites/sitedefaults/limits Application host <webLimits> connectionTimeout (Specifies the time that IIS waits before it disconnects a connection considered inactive). Default value : 00:02:00 (two minutes) Recommended value : 00:00:30 headerWaitTimeout (Specifies the time that the server waits for all HTTP headers for the request to be received before disconnecting the client.) Default value : 00:00:00 (disabled) Recommended value : 00:00:30 minBytesPerSecond (Specifies the minimum throughput rate, in bytes, that HTTP.sys enforces when it sends a response to the client. The minBytesPerSecond attribute prevents malicious or malfunctioning software clients from using resources by holding a connection open with minimal data.) Default value : 240 bytes Recommended value : 500 bytes Configuration instructions: https://www.iis.net/configreference/system.applicationhost/weblimits Dynamic IP Restrictions The Dynamic IP Restrictions Extension for IIS provides IT Professionals and Hosters a configurable module that helps mitigate or block Denial of Service Attacks or cracking of passwords through Brute-force by temporarily blocking Internet Protocol (IP) addresses of HTTP clients who follow a pattern that could be conducive to one of such attacks. When an attack pattern is detected, the module will place the offending IP in a temporary deny list and will avoid responding to the requests for a predetermined amount of time. Dynamically blocking of requests from IP address based on either of the following criteria: The number of concurrent requests. The number of requests over a period of time. Module download and configuration instructions https://www.iis.net/downloads/microsoft/dynamic-ip-restrictions
Best practices for HTTP Denial of Service configuration A security audit has been performed for Sitecore setup. One of the issues revealed is about "HTTP Denial of Service" Description: A malicious user with a computer can send a specially crafted sequence of HTTP packets to mount a Denial of service attack on the server. This will result in legitimate users not being able to access the services. Test findings: The website stopped responding during the attack simulation. The auditor simulated the HTTP slow body attack Recommendation: Please refer the document in the link to fix the issue. The idea is to configure the HTTP server in a specific manner to time out malicious sessions. https://blog.qualys.com/securitylabs/2011/11/02/how-to-protect-against-slow-http-attacks Following the link i understand the following settings need to be adjusted for IIS7: maxAllowedContentLength, maxQueryString, and maxUrl attributes headerLimits to configure the type and size of header your web server will accept. Tune the connectionTimeout, headerWaitTimeout, and minBytesPerSecond attributes of the <limits> and <WebLimits> elements to minimize the impact of slow HTTP attacks What are the best practices to configure above variables? What are your recommendations to identify above attributes? Are these changes likely to affect any of the default functionality in Sitecore backend and how can we avoid those?
This turned out to because of a rendering that's meant to display latest news in the standard values that was producing no markup at all. Added a quick if (Html.Glass().IsInEditingMode) {...} check to render something if in editing mode and there aren't any news articles, and all is well with the world. Thanks for your help anyway :)
Add Component buttons positioned offscreen after upgrade I recently upgraded one of our Sitecore sites from 8.0 to 8.1 update 3, which mostly went smoothly. Since the upgrade, in Experience Editor when adding components, the "Add component" buttons aren't appearing below certain renderings. They appear above the renderings. Inspecting in Chrome dev tools shows they missing buttons are there but positioned at top: 0px; left: 0px; and as such are behind the ribbon bar. This wasn't happening before the upgrade, and doesn't affect all renderings -- but there's nothing unusual about the ones it is affecting. Does anyone have any idea why this might be?
Delta packages are different from normal packages in only one way: instead of including all project items, they include only items that were changed after a certain date. Whether or not an item has changed is determined by taking the value of every item's __Updated field and comparing it to the date/time you set in TDS project settings. When generating packages, TDS also includes deployment property 'metadata' from ALL items in the project (whether they're included by Delta Packages or not). That metadata tells the update package installer, how to add/remove/update any set of items. If an item was removed at some point, then the package won't contain it, however the package may contain it's parent, and the ChildSync deployment property metadata for that. Therefore, if your project had the parent item, with child sync on, and you deleted that child item from your project, it will be deleted with the install of the package. For Delta Packages, this remains the same, even without the parent being part of the delta package (i.e even if itself wasn't updated itself since the delta date that's been set). So to the title of this question, YES, Delta packages can delete items, the exact same way complete packages generated by TDS can delete items. To directly answer the bulk of your question: no, without being able to set the child sync options, update packages (delta or complete) can not delete items.The recursive deploy action along with ChildSync is needed for that.
Does TDS know to delete items with delta packages? When using TDS to create delta packages for deployment does it know to delete items? It would appear that items which are deleted in the project aren't included in the delta package. UPDATE: Just to clarify using the child sync options isn't a solution in this case. The items being deleted reside under the /sitecore/content/Applications item in the Core database.
It's not required to be included or even included and then excluded from publish, it will not cause any issues with Intellisense or any other function of Visual Studio. The only reason for including it would be if you need to include some custom code on startup, even then it would be preferable to add a processor to into the initialize pipeline and run your logic there. If you do need to add custom logic that for some reason has to go in Global.asax the make sure you inherit from Sitecore.Web.Application as Mark Cassidy has pointed out.
Why do we need global.asax in Sitecore VS solution? I'm just going through the Sitecore documentation for setting up a Visual Studio project. One of the steps is to update the global.asax file in your solution: In the Visual Solution folder, copy the global.asax file from the Website folder of the Sitecore installation, overwriting the global.asax Visual Studio added when you created the project. I'm just wondering why this is necessary? If we delete the global.asax file - will it cause Intellisense issues with VS or something similar? We can use WebActivator to run code on start-up so we don't need to overwrite this file. If the global.asax is required fr some reason, could we set it not to publish (e.g. set the Build Action) rather than copying it from Sitecore.
As noted elsewhere, this is a limitation of TDS in general, since it has no knowledge of the deleted item once it is no longer in the scproj (TDS Project). One option would be to place your items into an isolated folder so that you can use Deployment Properties / Recursive Deployment Action to sync children of that folder. If that's not an option for you, you'll need another deployment step that can actually examine your source history or a previous version of the package to determine removed items, and delete them.
Given TDS delta packages do not track deletions how could this be achieved? Given the answer in the question here is it possible to achieve deletions while still using TDS' delta package functionality? I've previously used Sitecore Courier to do delta deploys but this relies on having both sets of serialised files.
This is a known issue with the General Link Field. To fix it open the Core database and navigate too: /sitecore/client/Applications/Dialogs/InsertLinkViaTreeDialog/PageSettings/TargetsSearchPanelConfig In there, find the Filters section and then the Root field. Change the field to point at: /sitecore/client/Business Component Library/System/Texts/Targets After you have done this, the list in the General Link Field will show the values: Select a target _blank _parent _top NOTE - this will not fix your existing link fields. You will have to go back and edit the existing fields and select one of the values to remove the Active Browser target
Setting the target on an internal link field Is the link target dropdown editable somewhere in the Sitecore tree? On a Sitecore v8.0 (rev. 150812) system, when editing a General Link field, the content editor is unable to set the "target" property for the link: On the resulting dialog, there is no "none" on the Target drop down: Selecting "Active Browser" and then rendering the field via a standard field renderer: foreach (Item menuItem in topMenu.Children) { <li>@Html.Sitecore().Field("Link", menuItem)</li> } results in the following markup: <a href="/products" target="Active Browser">Products</a> I'm assuming the list of link targets is somewhere core database? I'm able to correct the target by editing the raw values, but want to make sure my content editors don't run into this issue again.
Based on your comment above. You should move the definitions of those fields from the individual projects into a "Common" project in the Project Layer - you can then reference that in your individual Project Layer projects to keep the code as is. Then you can put your computed field into the "Common" project. It would only require a small refactor to do this, especially if you already have a Common project as the Habitat solution does.
Helix and Computed Index Fields with DI In my solution, I have some Computed Index Fields that I need to add that combine the values of fields from templates that belong to multiple Project-layer modules. I am using DI for initializing my Computed Index Fields, all of which inherit an IComputedIndexField interface. The problem is that I'm not sure where I should put the derived index field types, or how I should properly reference template types that live in multiple Project-layer modules. What would be the best way to do this? Am I totally off base?
This can be a number of things, but it sounds like the merge processes might be the thing. Look into this https://cwiki.apache.org/confluence/display/solr/IndexConfig+in+SolrConfig for more information. To limit disk space, you should use very LOW merge factors (segmentsPerTier in tieredmergepolicy - mergefactor in LogByteSizeMergePolicy). It will make indexing slower though (might be tremendously slower). If you have a growing index, you need more disk space. You need to use some sort of capacity management to foresee growth and align this with document growth and expectations of this to know what to ask for, but with indexes and growing contentsize taken into account, you just need to ask for a lot more than you expected.
How do I limit the size of my SOLR indexes? Every now and then my drive fills up with temp files from SOLR, and I can't figure out why that is happening. Here's what I know: I have a 50gb partition and my analytics index has numDocs:43,287,203 and maxDoc:43,316,981. We currently have 15 cores that live on that partition. The analytics index is usually around 30gb but every so often it fills the drive. We restart the SOLR services to dump the temp disk space usage, and that seems to fix the issue. This is a basic install of SOLR (we haven't done any tweaking to the configs). We are on SOLR 5.4.0.0. Questions: Is there a way to limit the merges it makes so it won't eat up my disk space? If not, what are the recommended disk space sizes for these merges? I can get more disk space if I need it, but I need to know how much to ask for. Thanks for your help!
Gonna take a stab at this. I'm not sure a module is what you're looking for, at least not for recent versions of Sitecore. At least for providing RSS feeds of Item specific content. Plus, you are really asking for two very different functionalities. Rendering of Sitecore Specific Content Items as an RSS Feed For Sitecore 8, you can use the built in RSS Feed generation utility to create your own RSS feeds of Sitecore based items. There is a very in-depth walk-through on Sitecore's Documentation Site for this. Displaying External RSS Feeds as a Rendering Component I'm, not sure that there's really any great modules out there on the Marketplace to solve this issue. However, what comes to mind is the uniqueness of how one might present and render the RSS feed would become very dependent on client guidelines and branding requirements. So, this solution might not be something that works great as a third party module. Having said that, I think that .NET provides some pretty nifty tools for dealing with external RSS feeds through the System.ServiceModel.Syndication library. There's a pretty extensive demo on how to utilize this on MSDN. I think with just a little bit of elbow grease, you can take this example demo and come up with a component to render an external RSS feed. In an MVC scenario, you can seed the model with the data as a collection of SyndicationItem's. Hope this helps!
Recommendations for RSS modules I am currently looking into which RSS modules are available for Sitecore. While doing so, I was wondering what the recommended module(s) are, and what I should be looking out for when deciding which RSS module to use. Edit: I would like to be able to use the module to create both RSS feeds from my own items and have them accessible from the outside, but also consume other RSS feeds from different online sources and present them on different pages in my solution (insertable as a rendering). As for the presentation goes I would like it to be fairly easy to change the look and feel of this, possible without any (or at least minimal) developer involvement. I am using MVC, so the RSS feed module should work with this as well.
Using IIS URL Rewrite (or firewall/load balancer/CDN) is appropriate for all domain-name and protocol changes (i.e. everything to the left of "/"). This covers #1, #2, and #3 from your list. I'd argue that Sitecore should be used for any redirect (other than the above redirects) that editors/authors are responsible for. Putting those redirects in Sitecore allows the editors/authors to change the redirects without asking IT/development to make any changes. This covers #4, #5, and #6 in your list.
URL Redirects, When to use Sitecore vs. when to use IIS UrlRewrite Rules For the purpose of this conversation, let's leave URL rewriting that doesn't result in a browser redirect off the table. Here are a number of URL Redirect scenarios that are regularly encountered for SEO purposes. Which ones should be handled by IIS UrlRewrite and which should be implemented by the Sitecore developer (using off-the-shelf or custom modules) Canonical Hostnames ex: mysite.com 301 to www.mysite.com Replacement Hostnames ex: myoldhostname.com 301 to mynewhostname.com Enforcing HTTPS ex: http://host.com 301 to https://host.com Marketing URLs ex: /myshortpath 301 to /the/actual/path/to/item Dead URLs ex: /myoldpage 301 to /mynewpage Relocated Branches ex: /myoldbranch/* 301 to /mynewbranch/here/* (other scenarios welcome!)
@Paul George is correct when he says there is a problem with the MVC Form Rendering and it requires a DataSource instead of a FormID Parameter. Now this causes a big problem, because there is no way of setting DataSource to the @Html.Sitecore.Controller() Helper Method. The only way to solve this is by actually rendering the form with @Html.Sitecore.Rendering() which support DataSource. So the code should look like this @Html.Sitecore().Rendering("{F2CCA16D-7524-4E99-8EE0-78FF6394A3B3}", new { Datasource = "<id of the form item>"}) Where {F2CCA16D-7524-4E99-8EE0-78FF6394A3B3} is the ID of the Mvc Form Controller rendering which is used for inserting forms in placeholders. But after testing this there is actually an exception that there is no UniqueId set for the Form, so it throws out an exception that the UniqueId (which is required) is empty. So the actual code that should be used for rendering form in this manner is: @Html.Sitecore().Rendering("{F2CCA16D-7524-4E99-8EE0-78FF6394A3B3}", new { Datasource = "<id of the form item>" , UniqueId = "<unique id of the form rendering>"}) I don't think there is problem setting <unique id of the form rendering> to some value you manually choose (or generate), but I might be wrong here. I tested a couple of submissions and they passed successfully. Still as this functionality is obviously not very tested and probably unstable, I think that the best solution for you might be to just add the form the old fashioned way, by inserting it into a placeholder.
Including a WFFM form in a page—how do I specify the form ID from code? I am trying to insert a form into a page via code; however, I can't get it to work. I am using the code from this Sitecore article: Insert a web form directly on a web page @using Sitecore.Mvc.Presentation; @{ RenderingContext.Current.Rendering.Parameters["FormId"] = "<id of the form item>"; } @Html.Sitecore().Controller("Sitecore.Forms.Mvc.Controllers.FormController, Sitecore.Forms.Mvc") Where <id of the form item> is being replaced with the form's item ID. The page tries to render the form using the data source of the current rendering instead of the <id of the form item>. Has anyone else experienced this or solved it? Sitecore 8.1 rev. 160519 Web Forms for Marketers 8.1 rev. 160523
I don't think there is any specific reason. My guess would be that it is just because that is how the ASP.NET Membership API is structured. You cannot change the password without knowing the password (which you can by resetting it). var user = Membership.GetUser(username); var randomPassword = user.ResetPassword(); user.ChangePassword(randomPassword, newPassword); They should of course easily be able to combine it like above, so it's probably just an oversight on their part.
Why does Sitecore insist on generating a new password to provide the 'old' password, when setting a new password If I need to change a Sitecore user's password, the dialog requires that I submit the old password at the same time. Often I don't know the old password, so within the same dialog I can generate a new one, copy-paste it into the 'old password' field and then set a new password. These seems like a strange process. What is the rationale to this?
We are using MongoDB extensively at present, rather than SQL, for Azure deployments. The number of MongoDB collections required for Sitecore's xDB means we run our own MongoDB server cluster as it's much more cost-effective than PaaS solutions at the moment, and cheaper than equivalent SQL performance too. Azure PaaS DocumentDB is billed per-collection and you'll need about 18 of them! If you have some linux boxes they are very cheap, and you can add as many collections as you want - we have lots of utility stuff in there, as well as ELMAH logging into a "fixed size" collection. I think the gold standard will be to get Redis going, either on the Azure Redis PaaS or on a standalone setup. Up until recently, the Azure Redis system did not support callbacks for items evicted from the cache (called keyspace notifications in Redis-speak). This made it clunky to support the OnSessionEnd event that Sitecore attaches its xDB processing tasks to. The currently available Redis ASPNET Session State provider does not support this critical event. We use Redis as well as MongoDB, but more for volatile cache and backing APIs. I imagine it won't be too long before someone has a good crack at this. I've looked into it, and it seems straight-forward enough, I just haven't had the time to string it all together. Until that's available, the Mongo provider on Ubuntu will perform better for the same price. There's no special security issues to speak of, as long as you remember to configure user accounts against your MongoDB.
Sitecore SessionState provider MongoDB or SQL My Clients Azure PAAS site uses In-role Cache. The caching service faces frequent downtimes due to high CPU Usage. On investigation from Microsoft, it is strongly recommended to move to Redis Cache. But since it doesn't support the session_end event. We want to explore either MongoDb or SQL sessionstate providers. I want to hear your views on MongoDB session provider (pros &amp; cons) , specifically, Are there any security pitfalls when using MongoDB session providers? Anyone who has experience using both , Please put in your two cents on this.
As the presentation details are stored in fields I wouldn't see why you couldn't use the Sitecore Data Exchange Framework to overwrite them. You'll have to create the right mapping to the field. Info about the mapping can be found here: http://integrationsdn.sitecore.net/DataExchangeFramework/v1.1/getting-started/mapping/index.html But I really doubt that it is a good idea. Can you explain more what the purpose of your import is? You'll have presentation details in a 3rd party system?
Can I import presentation details via the Sitecore Data Exchange Framework I have seen the Sitecore Data Exchange Framework documentation and it explains very well how to use and implement the tool. It allows you to import data from third party system to sitecore. My question is, does the Sitecore Data Exchange Framework allows to import presentations also? I know presentation on an item is stored as xml in the Renderings Fields but can I use the Sitecore Data Exchange to import this also? Note that I have not implement any code right now since I am still in the analysis phase. EDIT 1 Since the imported content will already be known, for example, the contents to be imported are Articles, I will already know what presentation details needs to be setup on the item. Then we will update the excel file accordingly to have a field for the presentation since some Articles presentation may be slightly different from other Articles. This is why I wanted to know if the rendering field can be modified by the Data Exchange as this field is a Sitecore Standard Field. Thanks
Making the assumption that your ajax calls go to some code of your own, you could add Tracker.Current.CurrentPage.Cancel(); to that code to tell Sitecore not to add a record for this interaction. This way your ajax calls will no longer be in the analytics. This is a solution for future requests - it does not remove the data that is already in your analytics though.
Filter pages from Path Analyzer In our site we have some Ajax calls for performance measurements and cookie management. These calls show up in the path analyzer and distort the statistics. They are reported as most visited and most efficient category which is, of course, not wat we want to see. In the marketing Control Panel you can add filtering rules for each Map, but I'm not sure if that would even work (I could test this of course), but would really like to add some paths to a config file and filter them globally. Is there a way to configure this?
In your System area of the master DB you should have items in roughly this location: /sitecore/system/Modules/Azure/<Environment>/<Location>/<Farm>/<WebRole>/<AzureDeployment> based on the template /sitecore/templates/Azure/Deployment/Azure Deployment On the item, go to the Excludes section. To exclude specific files use the Deployment Type Exclude Files or Exclude Files fields e.g: App_Config\ListManagement\Sitecore.ListManagement.config; Or to exclude an entire directory use Deployment Type Exclude Directories or Exclude Directories e.g.: App_Config\ListManagement;
How to disable a config file from CD server using Azure Deployment We are using Azure with Sitecore 8.0. I want to remove few config files(for e.g-all config files under ListManagement folder) which is already deployed in CD server. How to delete/disable config files under ListManagement folder using azure deployment?
Internal File Structure A big difference is the internal structure of the .update package file. If you open up an update package file you will see the following folder structure: A standard .zip package does not contain all the folders for added, changed or deleted data. So an update package can do more than a standard zip package. IIRC you can't delete items by installing a zip package. Installation method Also with the update package installation wizard, you get more visibility over what is being installed. You can analyze the package before installing. It will give you a report to show what is going to be changed and any conflicts that will occur because of the install. You do not get the same merge options with an update package tho, so an update package can overwrite your items. Error Reporting The update installation wizard also has better error reporting. On failure you can download details about the error to send to Sitecore support:
What are the differences between update and zip packages What is the difference between an update package (with *.update extension) and a regular package created from the Package Designer in the Sitecore Desktop? I know that: update packages are typically created from an automated system such as TDS package creator, Sitecore Courrier, etc while zip packages are normally manually created both can contain items as well as files update packages must be installed via /sitecore/admin/UpdateInstallationWizard.aspx zip packages must be installed via Sitecore Desktop > Development Tools > Installation Wizard But are there any other technical or semantic differences between the two? e.g. should an update package only be used to install updates to something, rather than installing a totally new module?
You need to create some custom code to have such a functionality, out of the box Sitecore doesn't have such a functionality. You can create a template with two fields : Publishing Date and Publishing By. Create your own class: public class UpdatePublishingStatistics : PublishItemProcessor { private const string PublishedFieldName = "__Published"; private const string PublishedByFieldName = "__Published By"; public override void Process(PublishItemContext context) { SetPublishingStatisticsFields(context); } private void SetPublishingStatisticsFields(PublishItemContext context) { Assert.ArgumentNotNull(context, "context"); Assert.ArgumentNotNull(context.PublishOptions, "context.PublishOptions"); Assert.ArgumentNotNull(context.PublishOptions.SourceDatabase, "context.PublishOptions.SourceDatabase"); Assert.ArgumentNotNull(context.PublishOptions.TargetDatabase, "context.PublishOptions.TargetDatabase"); Assert.ArgumentCondition(!ID.IsNullOrEmpty(context.ItemId), "context.ItemId", "context.ItemId must be set!"); Assert.ArgumentNotNull(context.User, "context.User"); SetPublishingStatisticsFields(context.PublishOptions.SourceDatabase, context.ItemId, context.User.Name); SetPublishingStatisticsFields(context.PublishOptions.TargetDatabase, context.ItemId, context.User.Name); } private void SetPublishingStatisticsFields(Database database, ID itemId, string userName) { Assert.ArgumentNotNull(database, "database"); Item item = TryGetItem(database, itemId); if (HasPublishingStatisticsFields(item)) { SetPublishingStatisticsFields(item, DateUtil.IsoNow, userName); } } private void SetPublishingStatisticsFields(Item item, string isoDateTime, string userName) { Assert.ArgumentNotNull(item, "item"); Assert.ArgumentNotNullOrEmpty(isoDateTime, "isoDateTime"); Assert.ArgumentNotNullOrEmpty(userName, "userName"); using (new SecurityDisabler()) { item.Editing.BeginEdit(); item.Fields[PublishedFieldName].Value = DateUtil.IsoNow; item.Fields[PublishedByFieldName].Value = userName; item.Editing.EndEdit(); } } private Item TryGetItem(Database database, ID itemId) { try { return database.Items[itemId]; } catch (Exception ex) { Log.Error(this.ToString(), ex, this); } return null; } private static bool HasPublishingStatisticsFields(Item item) { Assert.ArgumentNotNull(item, "item"); return item.Fields[PublishedFieldName] != null &amp;&amp; item.Fields[PublishedByFieldName] != null; } } Add your pipeline : <?xml version="1.0" encoding="utf-8"?> <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <pipelines> <publishItem> <processor type="Sitecore.Sandbox.Pipelines.Publishing.UpdatePublishingStatistics, Sitecore.Sandbox" patch:after="processor[@type='Sitecore.Publishing.Pipelines.PublishItem.UpdateStatistics, Sitecore.Kernel']" /> </publishItem> </pipelines> </sitecore> </configuration> All the informations you can find here : https://sitecorejunkie.com/2013/01/26/who-just-published-that-log-publishing-statistics-in-the-sitecore-client/
How to get a 'last publish date' for an item I am working in Sitecore version 7.2 and I was wondering how to get a last publish date for an item. I get that any item has date created and date updated but it does not have a property called date published. So, in order to get a last published date for an item, is it safe to assume that the last updated date in the web database for that particular item is the date the item was last published? Or is there something more elegant? Please let me know. Thanks!
I could get up on a soap box and speak for days on this. In fact I have. The Page Template Mistake. The role of Information Hiding The first concern you must address (from my viewpoint) is: You need to separate this decision making from your actual code build. Or put differently: Your components should make as few assumptions about the Information Architecture as possible In software engineering this loosely called Information Hiding. It's a good practice in software development, and it holds true for your Sitecore solutions as well. In computer science, information hiding is the principle of segregation of the design decisions in a computer program that are most likely to change, thus protecting other parts of the program from extensive modification if the design decision is changed. The protection involves providing a stable interface which protects the remainder of the program from the implementation (the details that are most likely to change). Translated into "Sitecore speak", this means you need to declare an interface between your Sitecore Information Architecture and your component - creating a clear definition of what information is the component is made aware of. Subsequently, everything else is "off limits". Fortunately we have a method for doing exactly that - it's the Datasource Template The shared interface So, we've established that any component should have a clearly defined interface. We then connect the two, by setting the Datasource Template on your rendering item. The Datasource Template looks like this: And we reference the template on the MetaHead Rendering like this: So far so good. You've established a basic "contract" between Sitecore and your component implementation. (As an aside, there are ways this can be overridden, so it's not a strict "guarantee". It's usually good enough however.) The next step is to use this in your code. The design pattern One of the oldest principles in Sitecore Information Architecture, is how the code treats the Datasource it is given given. When Sitecore was originally envisioned, I suspect sites were being built primarily using XSLT. As such, it makes sense to pay attention to how the XSLT engine treats a Datasource sent to a component. We find this in the Presentation Component XSL Reference: A rendering can retrieve data from its data source item. The $sc_item variable represents the data source item for an XSL rendering. If the developer does not specify a data source item for a rendering, the default data source item is the context item, and $sc_item and $sc_currentitem are the same item. Translated into technologies we use today, it basically says if a Datasource has been set, use it. If not, fall back to Context.Item Before doing anything else, your code should ensure that the item you get from the process above actually implements the template you defined in the contract above. (I know Glass Mapper can do this. It's also what my own Datalift project is all about.) Now implement your component; assume nothing about data outside your defined component template. No Context.Item, no Context.Database, nothing at all. That one item you end up with - will have all of that. I like to call this item your ActionItem, simply to distinguish it from other terms that are used a bit loosely (like Datasource Item and Current Item.) ActionItem.Database ActionItem.Language and so on. You should essentially never need to touch Context.Anything using this approach. We have now come full circle and I can explain how this relates to your question. (And more importantly, why you shouldn't spend a whole lot of time worrying about exactly this.) Page Templates. If you follow the above recommendations, you're largely free of constraints in your Page Templates - and you're also free to change your mind later on. The role of the Page Template So in your question you specifically ask for, where a field should live. I say; you don't make these decisions on field level. You make them on template level. Where each template matches a component. You don't want components cherry picking fields left, right, and center - you want Information Hiding so the components know nothing that isn't in the contract you've set up. To demonstrate and visualize what I mean, I've set up a few more component templates: And to match it, I've added some matching rendering definitions. We'll pretend I've coded them as described above ;-) And now we're at the key question: "How should I decide, what goes on the Page Templates?". First, let's make a Page Template called Homepage. I then say to myself; "Well for this type of page - I will always have at least one of each of my components on the page. (There may be additional promo spots, but I will always have one.)" In that case, we're good to use our component templates as base templates for our page template. We go to the Template Builder ribbon, select Base templates, and add all of them. And - this should come as no surprise - we end up with a Page Template that now has fields, for all of these components. And your code will work. Create new instances of this new Page Template, add your components to Presentation Details, and don't set a Datasource for them... everything works. Let's create another one called Section Page. This time we're not so sure there's always a Promotion on it. So, we won't use the Promotion template as a base for our Page Template itself. But you can of course, still add a promotion to your Presentation Details and set a Datasource for it. And so on. See what I'm getting at? It doesn't really matter. You can create a hundred Page Templates if you want (you probably shouldn't) - and if there are certain types of pages in your solution that would need to be under Workflow? Well then you make "thick" Page Templates, like I just did here. Do you have other types of pages that need to be as flexible as possible - an almost blank "canvas" for your editors to roam freely in? Well then make a thin one. Possibly not inheriting from anything other than maybe MetaHead, Header and Footer. Need some pages to enter a translation flow? Inherit from the components that are part of this flow, and make a Page Template for that. My point is; it doesn't really matter so much. As long as you're using solid implementation practices - you can freely mold your Information Architecture to suit your requirements. And not a single line of code in your solution should need to be changed in this process. Which, I'm guessing, is the primary reason you're asking this question at all.
When to store content on the Context Item vs. a Rendering's Datasource Item This is a best practices question. When designing the templates and content tree for a Sitecore installation, what determines whether a given field should be part of the "Page's" fields vs stored on a discrete Item and referenced as a DataSource? I'm looking for a list of decision-making concerns, for example - Workflow behavior, or ease of translation.
I don't think there is a way to create a standard .zip package from within Visual Studio/TDS but you can do that with Sitecore Rocks and there is an example here by Trevor Campbell: https://community.sitecore.net/technical_blogs/b/trevor_campbell/posts/28-days-of-sitecore-rocks-package-creation. As seen in your answer to Joe, if that's all the functionality you really need, then that should be all you need to create a package easily from within Visual Studio. You can get Sitecore Rocks by going into Visual Studio and going to Tools--> Extensions and Updates --> Select Online --> Search for Sitecore Rocks. It should be the first selection in the list.
How to generate Sitecore zip package from Visual Studio build process (or TDS) Is it possible to generate a Sitecore zip installation package from a TDS project in a Visual Studio solution? Ideally, but not strictly, in a way that could run on a CI server.
Layouts Provide the outermost HTML structure of a page. There is one layout (per device) per page. Apply to WebForms (.aspx) and MVC (.cshtml) Comprise of Layout definition item and aspx page (WebForms) or cshtml file (MVC) Sublayouts Provide inner HTML structure to a component or structuring element of a page. Apply only to WebForms Comprise of a definition item + .ascx control. Can contain nested Sublayouts within their placeholders Renderings Provide inner HTML structure to a component or structuring element of a page. Can be used with WebForms (if using XSLT) OR MVC Sitecore MVC uses the following rendering sub-types: Controller rendering: rendering definition item references a controller and action name View rendering: rendering definition item references a view (cshtml file) and optionally a viewmodel (which in turn references a model type in code) Item rendering: rendering definition item does not reference a controller or a view, instead it serves as a kind of 'placeholder'. The datasource item should have a rendering type associated with it via the __renderers field. Setting the datasource of an item rendering causes Sitecore to look at the datasource item itself to decide which rendering to use. Comprise of a definition item + .xslt or .cshtml view Can contain nested renderings (or sublayouts [1]) within their placeholders [1] can only contain nested sublayout if xslt rendering within a WebForms solution More information on MVC-specific aspects can be found here: http://www.matthewdresser.com/sitecore/sitecore-mvc-presentation-concepts
What is the difference between a Layout, Sublayout, and Rendering? In Sitecore, under /sitecore/layouts, I see the following: Layouts Sublayouts Renderings What are these, and what makes them different? Are there any other types of layouts?
Pipelines are defined in config. Sitecore's pipelines exist under: <sitecore> <configuration> <pipelines> Within a pipeline, handlers are processed in the order they are defined in config, the order and position of a handler is relevant. Here is a list of available pipelines The <httpRequest> pipeline is perhaps one of the most common to modify. Several of the steps there build the context information (item, site, language etc) that are then available under Sitecore.Context Usage of a pipeline involves inserting a handler at an appropriate point in the chain of handlers defined in config. A pipeline handler typically inherits a base class for that pipeline, overrides a method, and interacts with the pipeline args or other classes. In the case of the httprequest pipeline a processor would inherit from the abstract class HttpRequestProcessor and override the method public override void Process(HttpRequestArgs args) For example if you wanted to store the original request url before any possible modification by the LanguageResolver pipeline step, you could add the following, which stores the url in the Context.Items[] dictionary. Within config this handler would be added before LanguageResolver. public override void Process(HttpRequestArgs args) { args.Context.Items["OriginalRequestUrl"] = args.Context.Request.RawUrl; return; } It is also possible to build your own entire pipeline using the same framework for your own purposes, this is well described by Anders Laub in this blog post. You can also view active pipelines via the special admin page /sitecore/admin/pipelines.aspx
What is a pipeline? In the Sitecore configuration, I see a lot of different nodes under the <pipelines> element. I have been through the Sitecore Certification course and don't recall us covering these in detail? What is a pipeline? Specifically: What is a pipeline and how do I use one? What are the elements of a pipeline that I need in order to create a pipeline?
What is static- and dynamic bindings in general? Static binding means adding a rendering to a page in a raw way, e.g. in an mvc view: @Html().RenderAction(&quot;Controller&quot;, &quot;Action&quot;); Essentially, it means that you are not able to change this without editing the code. Dynamic binding means that on a page you will have a placeholder to put your renderings into: @Html().Sitecore().Placeholder(&quot;main&quot;) After that in the Content Editor (or Exp Editor) you will be able to &quot;dynamically&quot; add any rendering you like to that &quot;main&quot; placeholder. When would I use static bindings, and what are the use cases for doing so? When would I use dynamic bindings, and what are the benefits of this? It is generally recommended to use dynamic bindings, because of their flexibility. However you may want to use static bindigs for things like site header rendering, etc (something that should not be removed by editors mistake and is not supposed to be changed) Please refer to the official Sitecore documentation for more info on how this works altogether with layouts, sublayouts and renderings (https://sdn.sitecore.net/upload/sitecore6/sc62keywords/presentation_component_reference_sc62_a4.pdf)
Benefits of static vs dynamic binding of renderings In Sitecore's documentation you encounter terms such as "static binding" and "dynamic binding" of presentation components such as renderings. What are the differences between static- and dynamic bindings? Why would I use static bindings? Why would I use dynamic bindings?
Sitecore stores fields for templates as individual Items. As they are Items, they have a unique ID that can identify them. When Sitecore stores the values of fields for an item (most commonly in the SQL database), it references them via this unique ID rather than the field name. Because of this, this means that a Sitecore item can inherit from multiple templates that share the same name for fields of theirs, and it can read / write to each of these fields without conflict. You can even have multiple fields with the same name in the same template, though this is not advised. So, though there is no conflict there, it is very common for developers to access fields for an item via the name, not by the ID, e.g.: myItem.Editing.BeginEdit(); myItem["CommonFieldName"] = "Set this value"; myItem.Editing.EndEdit(); So what happens in this case? How does Sitecore know what field to update? In cases such as this, Sitecore will pick the field based on this order of preference: If there is a field on the direct template of the item with that name, it is used. The first matching field-name that is sorted highest (e.g. in the highest section and highest within that section) is selected. If not, then it will iterate over the base templates in the order they are set in the BaseTemplates field and pick the first field with a matching name belonging to one of these templates, using the same sorting logic as above. This logic is performed by the DoGetField method of the Template class. If you want to access a specific field, you can use the ID instead: myItem.Editing.BeginEdit(); myItem["{51F6F1D3-D8C6-427B-ADB8-AA3467B3E8DB}"] = "Set this value"; myItem.Editing.EndEdit();
What happens if the same field name is used in two separate inherited data templates? Given that a data template can inherit from other data templates, what happens if the same field name is used in two separate inherited data templates?
To answer your question directly; you would need to get in after the SiteResolver. Since you need to know what site you're on, to deliver your sitemap. It sits near the top in the <httpRequestBegin> pipeline. <httpRequestBegin> <processor type="Sitecore.Pipelines.PreprocessRequest.CheckIgnoreFlag, Sitecore.Kernel" /> <processor type="Sitecore.Pipelines.HttpRequest.EnsureServerUrl, Sitecore.Kernel" /> <processor type="Sitecore.Pipelines.HttpRequest.StartMeasurements, Sitecore.Kernel" /> <processor type="Sitecore.Pipelines.HttpRequest.IgnoreList, Sitecore.Kernel" /> <processor type="Sitecore.Pipelines.HttpRequest.SiteResolver, Sitecore.Kernel" /> So you would not be implementing an IHttpHandler as you suggest, you would instead inherit from Sitecore.Pipelines.HttpRequest.HttpRequestProcessor. If I may; I'd like to add a few architectural considerations to the mix as well. Be careful not to "render" your sitemap in real time on these requests. It's usually a very "heavy" operation and you open yourself up quite easily to a denial-of-service attack by doing so. Instead I propose you add sitemap generation as a scheduled task in Sitecore, to regularly (like hourly/daily/as appropriate) generate sitemaps for each site, and the processor in question only concerns itself with streaming back that generated sitemap to the client. IHttpHandlers usually execute before a Sitecore.Context is established - this is exactly the job of the <httpRequestBegin> pipeline. EDIT: Added based on comments Creating the sitemaps in the context of a Scheduled Task, you can indeed implement any class you like. Sitecore, however, expects to find the following method signature on whatever class you implement. public void Execute(Item[] items, Sitecore.Tasks.CommandItem command, Sitecore.Tasks.ScheduleItem schedule) A good guide for these can be found here: How To Create A Sitecore Scheduled Task
Using HttpHandler and Sitecore.Context We've got a sitemap generator class that inherits IHttpHandler. Because this is in a shared project with multiple sites, I want to ensure that when sitemap.xml is called, the correct tree structure is drawn out based on the site I'm visiting. I figure hooking into the Sitecore pipeline is the key, but can someone guide me to the proper one that I'd replace the standard .NET one with? Thanks much.
The fix There are invisible characters in the configuration file; this is something that may happen when you copy configuration text directly from a web page. Remove the characters and the issue will be fixed. Here they are, at the end of the line: </initialize>‌ You can make them visible in different ways, but the easiest that has worked for me was to: Open the file with Notepad++; Convert the file to ASCII via the menu Encoding –> Encode in ASCII. Where did they come from? Now, let's look into the page where this invisible characters appeared. Here's the relevant part of the source code of the KB article, as seen through Chrome Dev Tools: <pre class="prettyprint">&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt; &amp;lt;configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"&amp;gt; &amp;lt;sitecore&amp;gt; &amp;lt;pipelines&amp;gt; &amp;lt;initialize&amp;gt; &amp;lt;processor type="<strong>MyNamespace.RegisterCustomRoute, MyAssembly</strong>" patch:before="processor[@type='Sitecore.Mvc.Pipelines.Loader.InitializeRoutes, Sitecore.Mvc'] /&amp;gt; &amp;lt;/initialize&amp;gt;&amp;zwnj; &amp;lt;/pipelines&amp;gt; &amp;lt;/sitecore&amp;gt; &amp;lt;/configuration&amp;gt;</pre> See it now? It's &amp;zwnj; - the zero-width non-joiner character. It's not added there by JavaScript (I checked), which means it was the author of the article who put it there accidentally. Most likely, it's coming from some text editing software.
Cannot patch Sitecore initialize pipeline (Sitecore 8.1 Update 3) I am trying to patch the initialize pipeline to add a processor. I simply add the following config (obtained from a KB article here) in include folder: <?xml version="1.0" encoding="utf-8"?> <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <pipelines> <initialize> <processor type="MyNamespace.CustomProcessor, MyAssembly" patch:before="processor[@type='Sitecore.Mvc.Pipelines.Loader.InitializeRoutes, Sitecore.Mvc']"/> </initialize>‌ </pipelines> </sitecore> </configuration> It produces the following error even when I hit the show-config page: This patch file also produces same error: <?xml version="1.0" encoding="utf-8"?> <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <pipelines> <initialize> </initialize>‌ </pipelines> </sitecore> </configuration> Update: The file is located at: \App_Config\Include\Z.Customizations\ z_InitializePipeline.config There is no folder after Z.Customization, So based on the answer by @Zachary Kniebel, it should be the last file to be applied. Something I noticed is that when I move the file to Include folder, the error changes to Could not get pipeline: preprocessRequest (domain: ) This may be normal since it is not the last file to be processed for sure.
So long as you name the field section that contains the "Bar" field on Template B the same as you named the field section on Template A, Foo Data, the two field sections will merge. Example: Template Definitions: Template A Foo Data Baz - Single-Line Text Baz Thumbnail - Image Template B Foo Data Bar - Single-Line Text will result in a display like the following on your item instances of the Template B template, in the Content Editor: ----------------------------------- Foo Data v ----------------------------------- Baz [SLT Field] Baz Thumbnail [Image Field] Bar [SLT Field]
How can I merge field sections across templates in Sitecore Let's say I have a template, Template A, that has a field section, Foo Data, that contains some fields. If I create another template, Template B, that inherits Template A and add a new field, "Bar", how can I include the new field in the Foo Data field section from Template A?
Hooks A hook is a mechanism that you can use to run or "register" some logic at initialization time. To create one, you implement the IHook interface and add the necessary configuration as determined by your implemented hook. Hooks are loaded and executed when the application is initialized, via the Sitecore.Pipelines.Loader.LoadHooks processor of the <initialize> pipeline. Hooks are typically used for situations when you have some initialization-time logic that needs to be run but doesn't really belong within the <initialize> pipeline and doesn't depend on a context. For example, Sitecore uses hooks OOTB for health monitoring and memory checking. Hooks are especially useful when you have a recurring task that you want to set up to run on a time interval. For example, if you want to ping a service on a set time interval and you do not require any site or item context then a Hook may be what you need. Mike Reynolds has a great blog post describing what a hook is and how you can implement one, and I highly recommend it for additional details. Hooks vs. Pipeline Processors Remember that Hooks are loaded and executed in the <initialize> pipeline, but they are not processors. Hooks don't require any Sitecore context, and they do not have any arguments. As such, hooks are lighter-weight than processors and thus better suited for smaller tasks that don't depend on a context. This blog post by John West is a good resource for additional information on the differences between a Hook and a Pipeline Processor.
What is a hook and how does it differ from a pipeline processor? The title says it all: what is a hook and how does it differ from a pipeline processor? Specifically, I am looking for the following: What is a hook? How/when are hooks triggered? What are hooks used for? How do hooks differ from pipeline processors?
It looks like you want to directly paste the copied contents in experience editor, unlike RichText Field which provides dialog-popup. In your layout, any master rendering page, or any global javascript, try to add this javascript. <script> document.addEventListener('paste', function (e) { var content = e.clipboardData.getData('text/plain'); document.execCommand('insertText', false, content); e.preventDefault(); return false; }); </script> Refresh the page with disabled cache status in browser and test
Strip HTML when pasting into single-line text field If someone copies HTML from another site (like a title) and pastes it into a single-line text field, is there any way to automatically strip the HTML out? I know with rich text fields there are paste options to do this if you want, but with single-line text it sometimes throws one of those "an error occurred" messages in experience editor (logs come back with "After parsing a value an unexpected character was encountered: O") and sometimes it just shows the raw HTML instead. Thanks.
I think this is a bug with Sitecore. If you look more closely at their documentation you can see that in their sample code they have a TryCatch that expects a NullReferenceException: if (this.ShouldAutomaticallyAcceptChanges(notification)) { try { notification.Accept(ItemManager.GetItem(notification.Uri.ItemID, notification.Uri.Language, notification.Uri.Version, Database.GetDatabase(notification.Uri.DatabaseName))); } catch (NullReferenceException ex) { } } Interesting that they would put that specific exception as an example... as if they knew ahead of time it's very likely that call to notification.Accept() will throw that type of error. Hate to to say it, as I don't think swallowing that type of exception is a good solution, but it is the only solution for now. I'm guessing Sheer UI is looking for something inside that Item object you are passing and not finding it. That object is huge so it could be anything. Sitecore needs to fix this issue as it's still present in 8.2 as well.
Getting error in Automatically accepting changes for cloned items when adding new versions I have implemented Auto-accepting changes for cloned items by following this Sitecore Knowledge-base article However I get below error when adding new version from some translation services module working as Sitecore Agent: Message-Object reference not set to an instance of an object. Stack- at Sitecore.Web.UI.Sheer.ClientPage..ctor() at Sitecore.Context.get_ClientPage() at Sitecore.Data.Clones.FirstVersionAddedNotification.Accept(Item item) at Sitecore.Data.Managers.NotificationManager.DataEngine_AddedVersion(Object sender, ExecutedEventArgs`1 e) at System.EventHandler`1.Invoke(Object sender, TEventArgs e) at Sitecore.Data.Engines.EngineCommand`2.RaiseEvent[TArgs](EventHandler`1 handlers, Func`2 argsCreator) at Sitecore.Data.Engines.DataCommands.AddVersionCommand.Executed() at Sitecore.Data.Engines.EngineCommand`2.Execute() at Sitecore.Data.Engines.DataEngine.AddVersion(Item item) at Sitecore.Data.Managers.ItemProvider.AddVersion(Item item, SecurityCheck securityCheck) Main code snippet: private bool ShouldAutomaticallyAcceptChanges(Notification notification) { //Accepting notifications based on the setting value return Settings.GetBoolSetting("Cloning.AcceptChangesAutomatically", false); //Accepting notifications of the specific type //return notification is VersionAddedNotification; } The article has mentioned, Implement the ShouldAutomaticallyAcceptChanges method according to your requirements. For example, you may accept all notifications based on your custom web.config setting, or you can check for notifications of a specific type, e.g. VersionAddedNotification So Auto Accepting the VersionAddedNotication fails with above error. How we can achieve this without error? Or may be there something else that I'm missing? This is Sitecore 7.5 update-2
Its a sheer UI functionality that usually used if you are building new custom field and you want that field to have its own edit interface in Page editor, or you want to extend one of default sitecore fields. For example let say you want to add custom button next to "Single Text Line" field in page editor, that simply clears the content of your field. This code would be added to your custom "Web Edit Command" class to do that: //Set Html Value to be empty string SheerResponse.SetAttribute("scHtmlValue", "value", String.Empty); //Set Raw value to empty string SheerResponse.SetAttribute("scPlainValue", "value", String.Empty); //This line of code will not save the changed value back into the item (Empty string), // instead it will let page editor know that this field value has bee changed, // and once the user hits save, it will be stored back into the item SheerResponse.Eval("scSetHtmlValue('" + args.Parameters["controlid"] + "')"); So, as you can see, That function will inform Page editor that a change has been made to this field, And PE will store that change once the user clicks save.
What is the purpose of scSetHtmlValue? I am building a Sheer UI dialog following examples from the web. I keep seeing this throughout various examples: string controlId = args.Parameters["controlid"]; SheerResponse.Eval("scSetHtmlValue('" + controlId + "', false, true)"); What exactly does this do?
In general Solr usage, there are a few things you could do in order to tweak how data is stored in the index. In terms of Sitecore, I am not fully sure if the exact same rules apply, due to the way Sitecore internally might work with the indexes - so you may want to be a bit careful, when trying some of these things out and perform a thorough test for each tweak you apply. In your Solr core for the analytics core, find and open the schema.xml file. In this file, you could try to: Locate all fields that are being stored and try remove those stored fields from the index. Once done, try to let Sitecore make a query to the Solr index for the data it needs using the contacts API, and verify that it gets correct data back. Add omitNorms="true" to text fields that don't need length normalization. From the Solr wiki (http://wiki.apache.org/solr/SchemaXml): Set to true to omit the norms associated with this field (this disables length normalization and index-time boosting for the field, and saves some memory). Only full-text fields or fields that need an index-time boost need norms. Add omitPositions="true" to text fields that don't require phrase matching. This might be a bit tricky to test out, since you'd need to know how Sitecore internally works with the given fields. You can see the performance benchmarks found and described in this article http://css.dzone.com/news/solr-index-size-analysis, where omitting the norms and positions shows it will help you save a lot of space in terms of the index size. As said in the beginning of my answer, this may or may not work in terms of the way Sitecore works with the index, but it's worth a try to see if a bit of tweaking can solve your problems, as this is how you could solve the issue when working in a non-Sitecore context.
How can I reduce the size of the analytics index? [alt: Populating the Analytics Index] I'm working with a customer right now that has seen their Solr implementation become unstable lately. Based on some initial analysis, signs are pointing towards the analytics index. They've been live with xDB on Sitecore 8 for almost a year now, so this index has grown throughout the year. Currently it contains 25 million documents, and continues to grow. We can throw more memory at the server but that's a short term fix until this index grows beyond the hardware's capacity again. Right now the analytics index contains 25 million documents, consumes 51818368 of heap space, and is almost 11 GB on disk. The disk size will spike up to 30 GB as it merges, but we have plenty of disk space. RAM is another issue, that is being pushed to the limit. I'm also seeing in the resource monitor that this index is reading &amp; writing at about 14 MB/s to different segments in the core. Nothing else comes anywhere near that. We're investigating scalability options for the future, such as sharding with Solr Cloud, but the immediate problem is right now Solr will become unresponsive and needs to be restarted. When Solr fails, Sitecore fails. It's become an almost daily nuisance for the customer. In 8.1 update 3 and 8.2, there is a setting to disable anonymous contact indexing, ContentSearch.Analytics.IndexAnonymousContacts. I think this will go a long way to reducing the pace at which this index grows. In the short term, is there a way to safely reduce the size of this index? Can I run a query against the Solr core to remove these anonymous contacts? Really any advice offered on scaling and maintaining the analytics index would be appreciated.
A word on UUIDs The "3" part of the BinData field indicates that this is a Legacy UUID. If you are using a tool like MongoChef you can alter this representation to a .NET-encoded GUID using the Legacy UUID tab in the Preferences dialog, launched from the Edit menu. Select the entry Legacy .NET/C# Encoding. This should present the value in the form: AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE (.NET UUID) which will be easier to digest, visually speaking. The values are equivalent and MongoDB as everything is stored in binary in the end anyway. This is just about how the value is drawn to the screen in the client application. You need to execute the query using the BinData(3, "") notation with a first param of 3 if the field originally contained a .NET Guid. The value you mentioned for _id is actually 43acfde2-e3eb-5b4f-8871-49e39308c50b (it's just Base64 encoded). I can't guarantee that byte order is per the .NET encoding as I got it from the FileFormat.info site. Query Syntax While that's all interesting, I think you're asking about actually querying MongoDB. This isn't really the place for such a question, but you query it using JSON as follows: Search for a record by ID: Query: { "_id": BinData(3, "Q6z94uPrW0+IcUnjkwjFCw==") } Search for a record containing the value 'tester': Query: { "Fields.Value": "tester" } Search for a record where the field 'Name' has the value 'tester': Query: { Fields: { $elemMatch: { "FieldName": "Name", "Value": "tester" } } } In this example the $elemMatch operator is used to locate any element in the array that matches the provided criteria. Some incorrect versions of this you might have tried: { "Fields.FieldName": "Name", "Fields.Value": "tester" } While similar, this will locate any object containing an element in the Fields array with the FieldName = "Name", and, with an element in the Fields array with the Value = "tester" - not necessarily in the same child object! You don't want that as you'll get false positives. { "Fields": { FieldName: "Name", Value: "tester" } } This version will search for an object where the Fields array contains a sub-document that looks exactly like the one in the query, that is, no additional fields; just FieldName and Value. You don't want that as the sub-document also contains the FieldId attribute (though you could probably locate this value in Sitecore if you already know the field name to search).
How to query form data from mongodb, based on a specific value? I have the following data in MongoDB: { "_id":BinData(3, "Q6z94uPrW0+IcUnjkwjFCw=="), "_t":"FormData", "FormID":BinData(3, "nMVvjlcHGU68zFBBCeYdsg=="), "ContactId":BinData(3, "YJYiH5EJO0SPltvqhMrouw=="), "InteractionId":BinData(3, "ZQ1y+QcNf0qFzVvF6Axu+Q=="), "Timestamp": ISODate("2016-10-25T11:42:57.406 Z"), "Fields":[ { "FieldId":BinData(3, "SFmIPHlDp0y8t3KueJPHDQ=="), "FieldName":"Tell us a bit about yourself" }, { "FieldId":BinData(3, "SwTNPjQv80GYm0/Y0ZO/Tg=="), "FieldName":"Name", "Value":"tester" }, { "FieldId":BinData(3, "a3P3HWsSj0SPXepMcqb5Fw=="), "FieldName":"Email", "Value":"[email protected]" }, { "FieldId":BinData(3, "TeZGzCvk0Um6Pia1gtZXFQ=="), "FieldName":"Company Name", "Value":"test" }, { "Data":"multipleline", "FieldId":BinData(3, "GdX6eYcN2ka5Crjn2eex/A=="), "FieldName":"Message", "Value":"dont test the tester." } ] } How can we get this data based on a specific value?
You can use the ID instead of the path in your initial source: DataSource={C46A-4...CE}&amp;ExcludeTemplatesForSelection=Bar
Setting up a source using ID and limiting the items you can select. is it possible? I'm building a template and I want to limit the items the authors can select on a TreeListEx field. I know this can be done specifying the datasource as posted here Like setting the value on the Source field: DataSource=/sitecore/content/home/foo&amp;ExcludeTemplatesForSelection=Bar This is fine, although you are hard coding a path which might not be desired if the ability to move items is desidered. What if I'm setting an ID on the source field like shown here? How can I limit the selection?
This is what I worked out from playing with SxA: For your controller renderings, you need to make sure your controller inherits from Sitecore.XA.Foundation.Mvc.Controllers.StandardController Make sure your rendering has a rendering parameters template setup. If you inherit from /sitecore/templates/Foundation/Experience Accelerator/Rendering Variants/Rendering Parameters/IComponentVariant and /sitecore/templates/Foundation/Experience Accelerator/Presentation/Rendering Parameters/IStyling you will get the variant and styling options added to the properties of the rendering parameters. Finally make sure your component is added to the available renderings for your site's presentation:
Creating new renderings that are compatible with SXA I've been playing with SXA and some of the out of the box renderings and rendering variants that come with it. I understand how to create my own rendering variants, and I understand how to create my own renderings in a traditional Sitecore sense. That said, what I can't quite come around to figuring out is how to create new renderings that are peers with those of SXA. So, what I'm trying to understand is: How do I create new, SXA-enabled components that can be used by my content editors from the toolbar? What considerations do I need to take in to account to make rendering variants for my new rendering? How should I set this up in a solution to stay adherent to Helix principles? Any guidance on these or reading would be helpful; I haven't found much in the SXA documentation.
You're quite right about why it's not working - MVC renderings don't execute the global conditional rendering rules. This is not something I've had to do, but here's a suggestion. Someone might be able to suggest a better method, but here are a couple of suggestions: Setting parameters during rendering You could look at amending the mvc.renderPlaceholder pipeline to achieve what you want. The processor Sitecore.Mvc.Pipelines.Response.RenderPlaceholder.PerformRendering is what retrieves the renderings for a placeholder and calls the mvc.renderRendering for each. It doesn't pass any placeholder information into this pipeline, so you would need to act here. This is the method: protected virtual void Render(string placeholderName, TextWriter writer, RenderPlaceholderArgs args) { foreach (Rendering rendering in this.GetRenderings(placeholderName, args)) PipelineService.Get().RunPipeline<RenderRenderingArgs>("mvc.renderRendering", new RenderRenderingArgs(rendering, writer)); } You could extend this processor and override this method with one that executes rules for the rendering. It could then update the rendering item that gets passed into the pipeline. It's worth considering that Sitecore perhaps didn't implement the rules here due to performance issues, so rather than reintroduce global conditional rendering rules across all MVC renderings, you might want to make this a tailored processor that only acts differently for particular renderings. This amended processor could potentially just inject the placeholder name into the rendering parameters, and then the rendering itself could decide how to act upon this. Setting parameters upon saving As an alternative method, though one that depends on the nature of your solution, would it be appropriate to perhaps tackle this problem at the source rather at rendering time? For example, when the item is saved you could have an event that is triggered that looks through the placeholders + renderings and injects parameters into the renderings as required, which then get saved into the item. This way the rendering process doesn't need to be changed at all.
Adjust component parameters based on placeholder I'm trying to add Parameters to a rendering based on the placeholder it's been inserted into. I've been trying to handle this using rules (after reading through this blog post): I created a new condition (that the Placeholder name matched a given Key) based on the above blog post. Created a new Rule under /sitecore/system/Settings/Rules/Conditional Renderings/Global Rules which uses the new condition Set the Action for the Rule to be to change the rendering parameters Unfortunately, I couldn't get the new rule to work. I debugged the project and put a breakpoint in the Execute method of my ConditionalRenderingsRuleContext class. Unfortunately, it never gets hit. I've since seen this post on the Sitecore developers site which states MVC does not support global conditional rendering rules Does anyone have any suggestions on how to achieve this?
In EXM, the reason this list is blank is because the Default item for One-Time Messages has not been associated with any Message Templates. Background Information For Each EXM Manager Root, there are three types of Messages that can be sent out. One Time Messages Subscription Messages Triggered Messages Under a Single EXM Manager Root, it looks like this: The red arrow is pointing to the Default setting item for the One Time Messages. Open the item up in Content Editor to review settings for this item. Of particular interest is the Insert Option field on this item. EXM uses the Insert Options field of this item to store which Message Templates for the specific EXM Manager Root, should display in the Create Screen. In the above example, only one message shows up. When I go to the Create Screen, I see one message. When I add a new Message Template (located in the /sitecore/templates/branches folder: The resultant Create Message option dialog looks like: Why Aren't The Default EXM Insert Options Shown? For some reason, during the upgrade process, the default message create options were erased from this object. Simply add the default ones back in, if you'd like to use them. You can find them in the branch templates: Gotchas If dealing with multiple EXM Manager Root's, besure you are adjusting the right manager root, otherwise you'll pull your hair out for 2 hours like I did while writing this answer, just to realize that I had the wrong Manager Root selected in EXM. =) Opps.
Create Message Options are Blank in EXM I have a recently upgraded 8.1 Sitecore instance with EXM 3.3 installed. When I try to create a new regular Email Campaign I get the following screen. Am I doing something wrong? Is something not installed correctly or configured correctly? All I see is Import HTML.
The Formatter field is really only for date formatting, which is good since that is what you are looking for. The options for formatting the dates include the following list. Scroll to the bottom to get the full definition and regex treatment applied: mmss mss hmm hm ms ampm ap yyyy yy mm m dd d hh h ss s Background Information How is Formatter Handled? The Formatter field coming out of the ColumnField item type is used in the ListControl class as a Backbone data-bind attribute. You can see it in action below. The key to note is the formatValue(DataField,formatter) that is being used. public virtual string RenderRow() { Item dataSource = this.GetDataSource(); if (dataSource == null) return string.Empty; StringWriter stringWriter = new StringWriter(); HtmlTextWriter output = new HtmlTextWriter((TextWriter) stringWriter); foreach (Item child in dataSource.Children) { string str1 = string.IsNullOrEmpty(child["ContentAlignment"]) ? string.Empty : " sc-text-align-" + ClientHost.Items.GetItem(child["ContentAlignment"]).Name.ToLower(); output.AddAttribute(HtmlTextWriterAttribute.Class, "ventilate" + str1); output.AddAttribute("data-sc-important", "data-sc-important"); string str2; if (string.IsNullOrEmpty(child["Formatter"]) &amp;&amp; string.IsNullOrEmpty(child["HTMLTemplate"])) { string str3 = "typeof $data['" + child["DataField"] + "'] != 'undefined' ? $data['" + child["DataField"] + "'] : ''"; str2 = string.Format("{0},{1}", (object) ("text: " + str3), (object) ("attr: { title: " + str3 + " }")); } else if (string.IsNullOrEmpty(child["DataField"]) &amp;&amp; !string.IsNullOrEmpty(child["HTMLTemplate"])) str2 = "html: formatValue('', '" + child["HTMLTemplate"] + "')"; else str2 = string.Format("{0},{1}", (object) ("text: formatValue('" + child["DataField"] + "', '" + child["Formatter"] + "')"), (object) ("attr: { title: formatValue('" + child["DataField"] + "', '" + child["Formatter"] + "')}")); ListControl.SetWidthStyle(output, child); output.AddAttribute("data-bind", str2); output.RenderBeginTag(HtmlTextWriterTag.Td); output.RenderEndTag(); } return stringWriter.ToString(); } formatValue(object,format) This is a Sitecore ListControl.js Javascript method that is getting passed through the data-bind attribute listed above and executed on the client side when the List is created and displayed. It appears that formatValue() really is only meant to handle date formatting. However, as you look at formatValue() method below, you'll note that the dateConverter.toStringWithFormat() is getting called out of the Sitecore minified Backbone javascript. // apply formating itemModel.viewModel.formatValue = function (name, format) { var val = ""; // Checking for this[name]() invokes binding, so make sure this[name] is a function if (typeof this[name] === 'function' &amp;&amp; name != "" &amp;&amp; typeof this[name]() != 'undefined') { val = this[name](); } var tempValue = ''; var additionalValues; if (this.$formattedFields) { additionalValues = this.$formattedFields(); } if (format &amp;&amp; format == "short") { if (additionalValues &amp;&amp; additionalValues[name]) { tempValue = additionalValues[name].shortDateValue; if (tempValue) val = tempValue; } } else if (format &amp;&amp; format == "long") { if (additionalValues &amp;&amp; additionalValues[name]) { tempValue = additionalValues[name].longDateValue; if (tempValue) val = tempValue; } } else if (format) { var isHtmlTemplate = val == "" &amp;&amp; name == ""; if (isHtmlTemplate) { var viewModel = this; var getValue = function (fieldname) { if (typeof viewModel[fieldname] != "undefined") { return viewModel[fieldname](); } return undefined; }; tempValue = sc.Helpers.string.formatByTemplate(format, getValue); } else if (sc.Helpers.date.isISO(val)) { var dateConverter = sc.Converters.get("date"); tempValue = dateConverter.toStringWithFormat(val, format); } if (tempValue) val = tempValue; } return val; }; this.collection.add(itemModel); }, this); What can I pass into the Formatter Field? By looking at the toStringWithFormat method, you can pretty easily tell what date formatting options you have. toStringWithFormat: function (value, format) { if (Utils.date.isISO(value)) { try { var date = Utils.date.parseISO(value); var formats = { mmss: { expression: "(\\W|^)mm(\\W+s{1,2}\\W|\\W+s{1,2}$)", value: Utils.date.ensureTwoDigits(date.getUTCMinutes()) }, mss: { expression: "(\\W|^)m(\\W+s{1,2}\\W|\\W+s{1,2}$)", value: date.getUTCMinutes().toString(), }, hmm: { expression: "(\\Wh{1,2}\\W+|^h{1,2}\\W+)mm(\\W|$)", value: Utils.date.ensureTwoDigits(date.getUTCMinutes()), }, hm: { expression: "(\\Wh{1,2}\\W+|^h{1,2}\\W+)m(\\W|$)", value: date.getUTCMinutes().toString(), }, ms: { expression: "(\\Wss\\W|^ss\\W)00(\\W|$)", value: Utils.date.ensureTwoDigits(date.getUTCMilliseconds()), }, ampm: { expression: "(\\W|^)AM/PM(\\W|$)", value: ((date.getUTCHours() >= 12) ? "PM" : "AM"), }, ap: { expression: "(\\W|^)A/P(\\W|$)", value: ((date.getUTCHours() >= 12) ? "P" : "A"), }, yyyy: { expression: "(\\W|^)yyyy(\\W|$)", value: date.getUTCFullYear().toString(), }, yy: { expression: "(\\W|^)yy(\\W|$)", value: Utils.date.ensureTwoDigits(date.getUTCFullYear() % 100), }, mm: { expression: "(\\W|^)mm(\\W|$)", value: Utils.date.ensureTwoDigits(date.getUTCMonth() + 1), }, m: { expression: "(\\W|^)m(\\W|$)", value: (date.getUTCMonth()+1).toString(), }, dd: { expression: "(\\W|^)dd(\\W|$)", value: Utils.date.ensureTwoDigits(date.getUTCDate()), }, d: { expression: "(\\W|^)d(\\W|$)", value: date.getUTCDate().toString(), }, hh: { expression: "(\\W|^)hh(\\W|$)", value: Utils.date.ensureTwoDigits(date.getUTCHours()), }, h: { expression: "(\\W|^)h(\\W|$)", value: (date.getUTCHours() > 12) ? (date.getUTCHours() - 12).toString() : ((date.getUTCHours() == 0) ? 12 : date.getUTCHours()).toString(), }, ss: { expression: "(\\W|^)ss(\\W|$)", value: Utils.date.ensureTwoDigits(date.getUTCSeconds()), }, s: { expression: "(\\W|^)s(\\W|$)", value: date.getUTCSeconds().toString() } };
How do I format the value shown in a ColumnField using Sitecore Rocks? In Sitecore Rocks -- when editing ColumnField -- how do I format the text in a field? Basically, I have data being inserted into the ListControl via a SearchDataSource. One of the fields is a date field and it is coming through as: 2016-10-26T03:47:53.259Z I would like it a little cleaner in MM/dd/yyyy hh:mm AM/PM format. I see a field called Formatter but not sure what I should put in there.
To be able to search on a field in the Sitecore SearchAPI you need to add that field to a model. So you could create a new class derived from SearchResultItem and add your tags field in: public class MySearchResultItem: SearchResultItem { [TypeConverter(typeof (IndexFieldEnumerableConverter))] [IndexField("tags")] public IEnumerable<ID> Tags { get; set; } } I'm here assuming that your Tags field is a list type field that stores the Guids of the tags. The IndexField attribute tells Sitecore what the field name is for this property. The TypeConverter field tells the API how to convert the value stored in the index to the C# type. Now you have that you can use it in your Linq query: using (var context = ContentSearchManager.GetIndex(indexName).CreateSearchContext()) { //Filters related articles var relatedSearchQuery = context.GetQueryable<MySearchResultItem>() .Where(item => item.ItemId != currentArticle.Id.ToID() &amp;&amp; item.Tags.Contains(currentArticle.TagId)) Here I am assuming a single tag on the current article. If you need to compare a list with a list it gets a bit more complicated. In that case you need to create a search extension that will build that query. Here is the code. I have included the comments in the code to explain what is going on. public static class SearchExtensions { public static IQueryable<TSource> ContainsOr<TSource, TKey>(this IQueryable<TSource> queryable, Expression<Func<TSource, TKey>> keySelector, IEnumerable values) where TKey : IEnumerable { return Contains(queryable, keySelector, values, true); } public static IQueryable<TSource> ContainsAnd<TSource, TKey>(this IQueryable<TSource> queryable, Expression<Func<TSource, TKey>> keySelector, IEnumerable values) where TKey : IEnumerable { return Contains(queryable, keySelector, values, false); } public static IQueryable<TSource> Contains<TSource, TKey>(this IQueryable<TSource> queryable, Expression<Func<TSource, TKey>> keySelector, IEnumerable values, bool orOperator) where TKey : IEnumerable { const string methodName = "Contains"; // Ensure the body of the selector is a MemberExpression if (!(keySelector.Body is MemberExpression)) { throw new InvalidOperationException("Expression must be a member expression"); } var typeOfTSource = typeof(TSource); var typeOfTKey = typeof(TKey); // x var parameter = Expression.Parameter(typeOfTSource); // Create the enumerable of constant expressions based off of the values var constants = values.Cast<object>().Select(id => Expression.Constant(id)); IEnumerable<MethodCallExpression> expressions = Enumerable.Empty<MethodCallExpression>(); /* * Create separate MethodCallExpression objects for each constant expression created * * Each expression will effectively be like running the following; * x => x.MyIdListField.Contains(AnId) * * Check to see if we can find a method on TKey type which matches the method we want to run. * We do this because not all types use the static IEnumerable extension e.g. the String class * has it's own implementation of .Contains. * * If we can't find a matching method then we try to run the extension method found in Enumerable */ if (typeOfTKey.GetMethods().Any(m => m.Name.Equals(methodName))) { var method = typeOfTKey.GenericTypeArguments.Any() ? typeOfTKey.GetMethod(methodName, typeOfTKey.GenericTypeArguments) : typeOfTKey.GetMethod(methodName); /* * instance -> this would be property we want to run the expession on e.g. * IQueryable<MyPocoTemplate>.Where(x => x.MyIdListField) * so keySelector.Body will contain the "x.MyIdListField" which is what we want to run * each constant expression against * method -> the method to run against the instance e.g. "x.MyIdListField.Contains(...)" * arguments -> * constant -> this is the constant expression (value) to be passed to the method */ expressions = constants.Select(constant => Expression.Call(keySelector.Body, method, constant)); } else { /* * type -> we need to specify the type which contains the method we want to run * methodName -> in this instance we need to specify the Contains method * typeArguments -> the type parameter from TKey * e.g. if we're passing through IEnumerable<Guid> then this will pass through the Guid type * this is because we're effectively running IEnumerable<Guid>.Contains(Guid guid) for each * guid in our values object * arguments -> * keySelector.Body -> this would be property we want to run the expession on e.g. * IQueryable<MyPocoTemplate>.Where(x => x.MyIdListField) * so keySelector.Body will contain the "x.MyIdListField" which is what we want to run * each constant expression against * constant -> this is the constant expression (value) to be passed to the method */ var typeArgs = typeOfTKey.IsArray ? new[] { typeOfTKey.GetElementType() } : typeOfTKey.GenericTypeArguments; expressions = constants.Select(constant => Expression.Call(typeof(Enumerable), methodName, typeArgs, keySelector.Body, constant)); } /* * Combine all the expressions into one expression so you would end with something like; * * x => x.MyIdListField.Contains(AnId) OR x.MyIdListField.Contains(AnId) OR x.MyIdListField.Contains(AnId) */ var aggregateExpressions = expressions.Select(expression => (Expression)expression).Aggregate((x, y) => orOperator ? Expression.OrElse(x, y) : Expression.AndAlso(x, y)); // Create the Lambda expression which can be passed to the .Where var lambda = Expression.Lambda<Func<TSource, bool>>(aggregateExpressions, parameter); return queryable.Where(lambda); } } This will then allow you to do a .ContainsAnd or a .ContainsOr with your lists. ContainsAnd means that all entries in the list must be present in the returned item. ContainsOr returns items where it contains any of the ID's in the list. So your query would become: using (var context = ContentSearchManager.GetIndex(indexName).CreateSearchContext()) { //Filters related articles var relatedSearchQuery = context.GetQueryable<MySearchResultItem>() .Where(item => item.ItemId != currentArticle.Id.ToID()) .ContainsAnd(item => item.Tags, currentArticle.Tags) Where currentArticle.Tags is an already populated list of ID's. SearchExtensions code taken from Fortis Search Extensions
Help with ContentSearch LINQ query syntax Here is my scenario: Bucket of sitecore items of a specific template This template has a field tags(which is a treelist) where you can associate x items there. I'm building a query using lucene to retrieve all the items from the index that have the same tags as my current item. How can I do that? My code is not 100% done because getting this relashionship is not working properly. using (var context = ContentSearchManager.GetIndex(indexName).CreateSearchContext()) { //Filters related articles var relatedSearchQuery = context.GetQueryable<SearchResultItem>() .Where( item => item.ItemId != currentArticle.Id.ToID() How do I make that relationship as I can't make standard Linq queries at this point?
My reply does not answer your question directly, because Azure caching is to be defined dynamically according to your load factor. Nevertheless, for the high load website I would personally recommend the following: Tune your Sitecore rendering output caches as per Sitecore official performance tuning guide (your case is section 4.4, but it always good to get yourself acquainted with all the information) https://sdn.sitecore.net/upload/sitecore7/70/cms_tuning_guide_sc70-72-a4.pdf ; Do not deploy your code to all the servers at once. Instead, deploy one by one, to make sure there is at least one alive cluster Create a warmup script which will browse through the website sitemap and fill the sitecore output cache and azure cache for the CD instance that has got an updated code. I don't have any figures (like % of reduced load), but correctly configured output caching always improves the performance dramatically. p.s. As a general suggestion, I would also recommend you to use the dotTrace profiler to identify places in code, which utilize most of the CPU time and cause the load. This will help you a lot to identify places in your code to optimize and debug.
Sitecore Azure Cachingservices Sizing on Prod Based on number of CD servers Is there any rule of thumb on the number of caching services to have with Content delivery servers. Like 2 Cache services with 1 CD in Azure PAAS. Asking this question, because one of our clients faces 100% CPU usage on Caching service and Content delivery services, for at least 15-20 minutes after the Sitecore Azure PAAS build completes successfully and web role is started. This issue we are facing after the Client added 2 more Content delivery servers (in anticipation of more site visits) during the festival week in China. So do we have to increase the Caching service count from current 2 to 4? The only issue is high CPU usage after the build and sites are unavailable for at least 25 minutes after. Currently, we have 4 CD's but only 2 cache services. I understand that the number of Caching services may be dependent on the No of Site hits and other factors as well. Does Azure support team help clients in issues like these to verify Site installations?
If you know what is the ID of an item you click on you can simply redirect user using this url: http://domain/sitecore/shell/Applications/Content%20Editor.a‌​spx?sc_bw=1&amp;fo=ID, where ID value in a query string is an id of an item you want to open for example: http://domain/sitecore/shell/Applications/Content%20Editor.a‌​spx?sc_bw=1&amp;fo={3C1715FE-6A13-4FCF-845F-DE308BA9741D}
How to open the content editor from SPEAK? I've created a custom SPEAK 2.0 dashboard that lists sitecore items for a specific template. This dashboard was created for low level content editors which will only manage (create, edit, delete &amp; publish) those items. I want to add the following functionality but I'm completely stuck at the moment... When you click on an item, it opens the content editor so you can edit it Something useful that I already found: setting a HTML template on a DataField as shown by Martina: https://mhwelander.net/2014/07/03/speak-for-newbies-part-5-building-a-custom-form-3/ Locate the HTMLTemplate field and add the following: <a href="/sitecore/client/Your Apps/Properties/AddEditProperty?id={{itemId}}">{{Location}}</a> {{Location}} is the name of the field we want to output, and {{itemId}} is a standard token which will be replaced by the ID of the item in the row. Lastly, delete the contents of the DataField field. If you leave this filled in, the contents of the HTMLTemplate will not be output. The ‘Location’ text of each row will now link to the ‘Add/Edit Property’ page. Reasons for not choosing to create an edit page for the item in SPEAK: no default rich text editor (there is a plugin though) no default datepicker field I have no idea on how to handle versioning ...
I can confirm this is a bug in the current release of Sitecore Powershell Extensions (4.1). There is some regex that is applied to account names and it looks like it is too restrictive. As you have already opened an issue on the project, the bug will be tracked there - https://github.com/SitecorePowerShell/Console/issues/731 Hopefully I can shortly update this answer for future users, to say that the answer here is to upgrade to 4.2.
Cannot add a User to a Role where the User name contains the "@" sign using PSE I have to bulk-add a large number of users to a role, to this extent I am using the Add-RoleMember cmdlet. If I run Add-RoleMember -Identity "<role name>" -Members "name.lastname" it works fine, however in our instance the users come from an Okta Membership Provider, where they are identified by their domain\email - such as domain\[email protected] When I try to run Add-RoleMember -Identity "<role name>" -Members "domain\[email protected]" I am greeted with a: "Error: The name is improperly formatted. The name can only contain the following characters: a-z, 0-9, periods, dashes, underscores, backslashes, and spaces." So there is ABSOLUTELY no way of using Add-RoleMember if my user name contains an @ sign, even though the Role already contains users with such character in the name? I surely hope this isn't the case, otherwise I will have to handle everything through code, which means I won't be able to do this until the next deployment.
This can be achieved by updating your Schedule field on your task. 127 represents the days of the week, this task is meant to run. This only makes sense if you convert it to binary. 127d = %01111111 Each of the bits represent a day of the week. Like this. -SFTWTMS 01111111 So to disable the tasks for the weekend, change it to: -SFTWTMS 00111110 %00111110 = 62d See also: How to create Sitecore Scheduled Task
How to stop schedule publishing in weekends? I am using Sitecore.NET 7.2 (rev. 140228). For my project schedule publishing is in place. In weekends I have a separate job which creates over 100k items and this job publishes all the items after creation programmatically. So, I want to stop my regular schedule publishing as my publishing struck as both publishing happening simultaneously in weekend. Could anyone suggests how to stop my schedule publishing only in weekends?
I'd say you can either use the first or second approach. I'm normally using the first approach (the one you got working now) for these sorts of things. What I do is having the same method action defined twice, one for get and one for the post, and in the post version I pass in the ViewModel, which I then rebuild the same way you are doing it. The action methods should be annotated correctly with the [HttpGet] and [HttpPost] attributes. If you use Html.BeginForm(controller, controllerAction), you will experience that you are being redirected to the controller's URL (like /sitecore/api/{controller}/{action}), and not the page containing the controller rendering(s), as you'd expect. This is something to keep in mind when doing some sort of model checking, where you want to show the error message in the view, if the model is not valid.
How do I do custom forms in Sitecore MVC? I am trying to get a form in my MVC Controller Rendering to work. I have read these posts: https://mhwelander.net/2014/05/30/posting-forms-in-sitecore-mvc-part-2-controller-renderings/ https://ctor.io/posting-forms-in-sitecore-controller-renderings-another-perspective/ I have tried these form options My controller public class VacanciesController : SitecoreController { public ActionResult VacancyDetail() { var model = RenderingContext.Current.Rendering.GetRenderingModel<VacancyDetailModel>(); var item = Sitecore.Context.Item; return this.View(model); } } with this attribute public override bool IsValidForRequest(ControllerContext controllerContext, MethodInfo methodInfo) { var controller = controllerContext.HttpContext.Request.Form["fhController"]; var action = controllerContext.HttpContext.Request.Form["fhAction"]; return !string.IsNullOrWhiteSpace(controller) &amp;&amp; !string.IsNullOrWhiteSpace(action) &amp;&amp; controller == controllerContext.Controller.GetType().Name &amp;&amp; methodInfo.Name == action; } this is my view form code @using (Html.BeginForm()) { <button id="btn-save" class="btn btn-highlight" type="submit">Solliciteer direct empty form</button> <input type="hidden" name="fhController" value="Vacancies" /> <input type="hidden" name="fhAction" value="VacancyDetail" /> } This seems to work now @using (Html.BeginRouteForm(Sitecore.Mvc.Configuration.MvcSettings.SitecoreRouteName, FormMethod.Post)) { @Html.Sitecore().FormHandler("Vacancies", "VacancyDetail") <button id="btn-save" class="btn btn-highlight" type="submit">Solliciteer direct routeform</button> } this goes to the correct controller and action. Bu my RenderingContext.Current.Rendering is null @using (Html.BeginForm("VacancyDetail", "Vacancies", new { id = "1" }, FormMethod.Post, new { @id = "form1", @enctype = "multipart/form-data" })) { <button id="btn-save" class="btn btn-highlight" type="submit">Solliciteer direct routeform</button> } This goes to the correct controller and action. But Sitecore.Contect.item is null &amp; RenderingContext.Current.Rendering is null What is the correct way to create a custom form?
I talk about this in a series of posts (https://grantkillian.wordpress.com/2014/12/26/sitecore-logging-to-the-database-part-1/, https://grantkillian.wordpress.com/2014/12/26/sitecore-logging-to-the-database-part-2-earning-the-good-developer-badge/, and https://grantkillian.wordpress.com/2014/12/26/sitecore-logging-to-the-database-part-3-the-performance-picture/) The other answers here are all good, but for any large Sitecore implementation I would encourage you to look at any performance implications and the asynchronous logging solution. If you don't want to dig into the async stuff, and last I looked there was some custom development needed to complete that properly for Sitecore, I'd recommend: Use SQL Server stored procedure Tune the Log4Net BufferSize setting Consider data retention as log records could accumulate quickly: do you archive or remove the old data every month? Be sure to have proper SQL Server maintenance plans etc (https://ola.hallengren.com/) to keep the system optimal
Sitecore Logging (Log4Net) Log to Database as Well as Text Files Sitecore 7.5 The text file logging is working fine. But, I would like the logging to go to a SQL Server database so that I can search the data with T-SQL. How would I do that? I imagine it would be a change to the web.config file inside the <log4net> block. And, also an additional connection string. <log4net> <!-- LOGGING SETTINGS The file element defines the location of the log files. This location must be the same as the setting in LogFolder. The file element is a relative or absolute path that always uses slashes (/) as separators. A valid file element for a relative path would be: <file value="/data/logs/log.{date}.{processid}.txt"/> A valid element for an absolute path would be: <file value="C:/inetpub/wwwroot/data/logs/log.{date}.{processid}.txt"/> The macros supported are: {date}: Replaced with the current date (in the format yyyyMMdd) {time}: Replaced with the current time (in the format HHmmss) {processid}: Replaced with the current Windows process id For further information refer to the Log4Net documentation. --> <appender name="LogFileAppender" type="log4net.Appender.SitecoreLogFileAppender, Sitecore.Logging"> <file value="$(dataFolder)/logs/log.{date}.txt" /> <appendToFile value="true" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%4t %d{ABSOLUTE} %-5p %m%n" /> </layout> <encoding value="utf-8" /> </appender> <appender name="WebDAVLogFileAppender" type="log4net.Appender.SitecoreLogFileAppender, Sitecore.Logging"> <file value="$(dataFolder)/logs/WebDAV.log.{date}.txt" /> <appendToFile value="true" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%4t %d{ABSOLUTE} %-5p %m%n" /> </layout> <encoding value="utf-8" /> </appender> <appender name="SearchLogFileAppender" type="log4net.Appender.SitecoreLogFileAppender, Sitecore.Logging"> <file value="$(dataFolder)/logs/Search.log.{date}.txt" /> <appendToFile value="true" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%4t %d{ABSOLUTE} %-5p %m%n" /> </layout> <encoding value="utf-8" /> </appender> <appender name="CrawlingLogFileAppender" type="log4net.Appender.SitecoreLogFileAppender, Sitecore.Logging"> <file value="$(dataFolder)/logs/Crawling.log.{date}.txt" /> <appendToFile value="true" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%4t %d{ABSOLUTE} %-5p %m%n" /> </layout> <encoding value="utf-8" /> </appender> <appender name="PublishingLogFileAppender" type="log4net.Appender.SitecoreLogFileAppender, Sitecore.Logging"> <file value="$(dataFolder)/logs/Publishing.log.{date}.txt" /> <appendToFile value="true" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%4t %d{ABSOLUTE} %-5p %m%n" /> </layout> <encoding value="utf-8" /> </appender> <appender name="NHibernateLogFileAppender" type="log4net.Appender.SitecoreLogFileAppender, Sitecore.Logging"> <file value="$(dataFolder)/logs/NHibernate.log.{date}.txt" /> <appendToFile value="true" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%4t %d{ABSOLUTE} %-5p %m%n" /> </layout> <encoding value="utf-8" /> </appender> <root> <priority value="INFO" /> <appender-ref ref="LogFileAppender" /> </root> <logger name="Sitecore.Diagnostics.WebDAV" additivity="false"> <level value="INFO" /> <appender-ref ref="WebDAVLogFileAppender" /> </logger> <logger name="Sitecore.Diagnostics.Search" additivity="false"> <level value="INFO" /> <appender-ref ref="SearchLogFileAppender" /> </logger> <logger name="Sitecore.Diagnostics.Crawling" additivity="false"> <level value="INFO" /> <appender-ref ref="CrawlingLogFileAppender" /> </logger> <logger name="Sitecore.Diagnostics.Publishing" additivity="false"> <level value="INFO" /> <appender-ref ref="PublishingLogFileAppender" /> </logger> <logger name="NHibernate" additivity="false"> <level value="WARN" /> <appender-ref ref="NHibernateLogFileAppender" /> </logger> <logger name="NHibernate.SQL" additivity="false"> <level value="WARN" /> <appender-ref ref="NHibernateLogFileAppender" /> </logger> </log4net>
After lot of investigation, I have seen that the Branch Template cannot be used since I get the following error: Template is invalid (cdbb9572-14b6-4ea2-818e-bb6c15beda94) The reason is because of the Add Method from the namespace Sitecore.Services.Infrastructure.Sitecore.Data.ItemRepository Below is the Code for creating the item: public Guid Add(ItemCreateRequest request, string databaseName, string language) { Database database = ItemRepository.GetDatabase(databaseName); Language language1 = ItemDataBase.GetLanguage(language); Item obj = database.GetItem(request.ParentPath, language1); if (obj == null) throw new ArgumentException(ItemDataBase.InvalidParameterMessage("Path", (object) request.ParentPath)); TemplateItem template = database.GetTemplate(new ID(request.Template)); if (template == null) throw new ArgumentException(ItemDataBase.InvalidParameterMessage("Template", (object) request.Template)); Item itemToUpdate = obj.Add(request.Name, template); using (new EditContext(itemToUpdate)) this.UpdateFields(request.Fields, itemToUpdate); return itemToUpdate.ID.Guid; } The above code is used for creating an item from a template and not from a Branch Template. For Branch Template it should have been as below: private const string _BRANCH_ITEM = "/sitecore/templates/Branches/MyBranches/MyBranch"; public void Create(Item parent, string name) { BranchItem branch = globalDataFolder.Database.GetItem(_BRANCH_ITEM); Assert.IsNotNull(branch, "Could not find Data branch at " + _BRANCH_ITEM); parent.Add(name, branch); } The difference is instead of using TemplateItem, it need to be changed to BranchItem in order to create item from Branch Template. Example is taken from Brian Pedersen post It seems that the only way to achieve this is to override the ItemRepository and implement a new method that caters for Branch Template. Maybe, introducing the creation of items from Branch Template in future releases of the Sitecore Data Exchange Framework might be considered.
Adding Subitems with the Data Exchange Framework I am currently working on a Proof of Concept using the Data Exchange. I have implemented the demo from the Sitecore Documentation. The example is working as expected. However, I need to create subitems based on a Branch Template but I don't know how since I just started working on the Data Exchange Framework. So, in brief, I have a Container in the Sitecore Content Tree. Under the Container, the Data Exchange will create the items. Right now, all items are being created under the container. I need to have the item structure as below: Can anyone provide a sample code or link to achieve this. I am new to Data Exchange.
In the previous question you gave an excellent description on what a Hook is. 1. How are Scheduled Tasks different from Hooks? Hooks are specific pieces of code that are loaded into the worker process and generally attach to some sort of event that occurs in the system. One of the most common events that Hooks utilize is the HeartBeat static class which in it's own right runs very similarly to the Scheduler spawning a continuous loop. The Heartbeat events are subscribed to by Hooks through the AlarmClock class. When the HeartBeat beats a tick, if the AlarmClock interval is reached, it invokes all of it's event subscribers by instantiating the class for that beat/interval, executing their delegate method, and then disposing. The Scheduler is not much different to some degree from the HeartBeat static class. It too is a static class that when instantiated, spawns a Worker thread that continuously loops. The biggest difference though is that the Scheduler loads into memory all of the Agent objects together as array and instead of subscribing to events, checks a time interval of each agent. When the time interval has passed, then it executes the agent. The other big difference between a Hook and Scheduled Task/Agent is that you have to use the Agent class mechanism in a Scheduler task. A Hook can be any type of custom code, logic, or method and not confined to the rigor of an Agent. 2. When would I use a Scheduled Task over a Hook? Scheduled tasks are meant for small pieces of work that are intended to be executed for a specific purpose and if turned off are not going to hurt or jeopardize the overall function of the product. An example is the CleanupEventQueue task. It does one function and gets out. If this function were to be disabled, chance of a major Sitecore malfunction are low. 3. When would I use a Hook over a Scheduled Task? When more core, and possibly more important functionality needs to be executed that would not be affected by user intervention. Hooks are separated from the Scheduler configuration and therefore the likely hood of a hook being modified or interfered with by a developer or other factor is much lower. An great example of a hook being chosen over a Scheduled Task is actually the UnlockContactListAgentLoader Hook. <hook type="Sitecore.ListManagement.Analytics.Hooks.UnlockContactListsAgentLoader, Sitecore.ListManagement.Analytics" patch:source="Sitecore.ListManagement.config"> <param name="agent" type="Sitecore.ListManagement.Analytics.UnlockContactListsAgent, Sitecore.ListManagement.Analytics"> <param name="listManager" ref="contactListManager" /> <param name="mapper" type="Sitecore.ListManagement.ContentSearch.BatchIdMapper, Sitecore.ListManagement.ContentSearch" /> <param name="operationManager" type="Sitecore.Analytics.Data.Bulk.Contact.ContactBulkUpdateManager, Sitecore.Analytics" /> </param> <param name="interval">00:00:10</param> </hook> Here we have a hook that is being initialized, and it's actually creating an Agent Task to run on a specific interval. The reason why Sitecore did this (assumption) is that this is a process that would have detrimental effect if the scheduler was turned off or disabled. If Lists were to be created and not unlocked (There is a side conversation here about a bug that is preventing list from getting unlocked, but that's for another time) this would pose a significant issue to the operation of Sitecore. Especially if EXM was in play. :wink: Summary As far as Hooks and Scheduled Tasks are concerned, I see them as cousins in a big family tree. The only difference is that the parents of Hooks are more strict and less likely to be swayed by adolescent rage. Where as Schedule Tasks parents are more laid back and subdue. They probably let the kids play out in less than ideal conditions. To put it in short terms: If it's important use a Hook. If it's for convenience use a Scheduled Task.
How does a Hook differ from a Scheduled Task? In a previous question, I asked what a hook is and how it differs from a pipeline processor. Now, I'm wondering how it differs from a Scheduled Task. I know that hooks are for context-agnostic logic and super useful for logic that should be executed repeatedly at defined interval. Isn't that what Scheduled Tasks do, though? How are Scheduled Tasks different from Hooks? When would I use a Scheduled Task over a Hook? When would I use a hook over a Scheduled Task?
Hot to fix In Sitecore, go to Control Panel -> Deploy Marketing Definitions. Select "Campaigns". Click "Deploy". See this official documentation page for detailed instructions on deploying marketing definitions: https://doc.sitecore.net/sitecore_experience_platform/developing/marketing_operations/deploy_marketing_definitions Explanation Based on the error you're getting, xDB can't seem to find a definition of a particular campaign activity. Campaign activities are one of many types of marketing definitions; goals and outcomes are other examples. Marketing definitions are stored and retrieved by using repositories which may use different storage types. There are two default repository types that are shipped with Sitecore: item repositories—these work with definition items directly. The default database used is master. rdb repositories use the Reporting database. The reason for this is that some server roles (like the Processing server in your case) may not have direct access to the Master database. remote repositories are used in environments where the Sitecore instance doesn't have direct access to the Reporting database. To access marketing definitions, remote repositories will query web services hosted on a remote reporting server. In Sitecore configuration files, all repository references have the repository path parameterized. <param desc="repository" ref="marketingDefinitions/campaign/repositories/$(marketingDefinitions.repository)" /> The value of the $(marketingDefinitions.repository) parameter is defined in Sitecore.Analytics.config as a variable and defaults to using item repositories: <sc.variable name="marketingDefinitions.repository" value="item" /> This means that by default all marketing definitions will be read directly from items in the Master database. Server role specific configs will override this setting. For example, here's an excerpt from Sitecore.MarketingProcessingRole.config in Sitecore 8.2: <sc.variable name="marketingDefinitions.repository"> <patch:attribute name="value">rdb</patch:attribute> </sc.variable> In order for an RDB repository to have up-to-date data, the data needs to be deployed there. Normally, when you create or update a marketing definition in the Master database, it will also be automatically deployed to RDB. But, in case the RDB was unavailable at the time, you will need to redeploy marketing definitions manually. This is exactly what the "Deploy Marketing Definitions" app does—it takes the selected types of marketing definitions from their item repositories and saves them to all the other repositories.
Definition Not Found in Analytics Aggregation In performing an audit of Sitecore logs, I came across a slew of Aggregation Errors on the Processing Server all complaining about a definition not found. 1172 11:08:41 ERROR Aggregation Error Exception: System.Exception Message: Definition not found: itemId: '{28A4B856-37C1-446C-B0C1-E56F78252AA0}' culture: 'Invariant Language (Invariant Country)' type: 'Sitecore.Marketing.Definitions.Campaigns.ICampaignActivityDefinition' Source: Sitecore.ExperienceAnalytics at Sitecore.ExperienceAnalytics.Aggregation.Pipeline.SegmentProcessor.ProcessSegments(AggregationPipelineArgs args, IEnumerable`1 segments) at Sitecore.ExperienceAnalytics.Aggregation.Pipeline.SegmentProcessor.OnProcess(AggregationPipelineArgs args) at Sitecore.Analytics.Aggregation.Pipeline.AggregationProcessor.Process(AggregationPipelineArgs args) Nested Exception Exception: System.InvalidOperationException Message: Definition not found: itemId: '{28A4B856-37C1-446C-B0C1-E56F78252AA0}' culture: 'Invariant Language (Invariant Country)' type: 'Sitecore.Marketing.Definitions.Campaigns.ICampaignActivityDefinition' Source: Sitecore.ExperienceAnalytics at Sitecore.ExperienceAnalytics.Core.Repositories.ClassificationResolver`1.GetClassificationUris(ID itemId) at Sitecore.ExperienceAnalytics.Aggregation.Dimensions.CampaignFacetBase.HasDimensionKey(IVisitAggregationContext context) at Sitecore.ExperienceAnalytics.Aggregation.Dimensions.CampaignFacetBase.<GetData>d__3.MoveNext() at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext() at Sitecore.ExperienceAnalytics.Aggregation.Pipeline.SegmentProcessor.ProcessSegments(AggregationPipelineArgs args, IEnumerable`1 segments) The Item Guid in Question points to a Campaign Item: Every error in the log seems to point just to this item. Has anyone seen this before?
Although the Helix documentation does cover this, I guess it's a big pill to swallow all at once so here are a few simple guidelines to help you on the Helix path: Foundation module This acts as an API to Feature modules. The Foundation does not contain any form of presentation! Feature module This contains logic and presentation, but never styling. So presentation is usually in the form of semantic HTML so it can be styled per Project module. Feature modules may reference Foundation modules. Project module I guess you would typically not include this in a Marketplace package as this is the site-specific stuff, but you could add a demonstration project, for example to explain how the module could be styled. In reference to Richard's answer: Foundation Modules that are really CMS based. So a control panel, some admin interface etc.. Feature Modules that obey the Common Closure Principle I do not agree with this; The fact that it's a control panel or admin tool does not indicate whether or not the module contains presentation. Features do not have to be client (front-end) features! You could say that if the module is exposed to a user (whether that is a content editor or a site visitor, doesn't make a difference) it's a Feature module. Also, the Common Closure Principle applies to all the modules in the Helix architecture, not just the Feature modules! For example: Take a look at the MultiSite module in the Habitat example. This module is contains both Feature and Foundation projects. The Feature project contains the stuff that is exposed to the user. The Foundation project contains the stuff that is used by the Feature project and may be used by other Feature projects as well. TLDR; Your Marketplace module can contain both Feature and Foundation projects. It does not necessarily have to either a Feature or a Foundation project.
Helix Best Practice when developing components for the Marketplace So I've been planning to develop some modules for the community to place in the marketplace but also as code on GitHub that people can extend from. Having said that, I'm hoping to develop these modules using the Helix pattern, but I'm running into a question often from an architectural standpoint. If I develop a "Feature" does it belong in Feature or Foundation. I'm still fairly new to Helix, this would be an easy question to answer if it was for one of my own projects (it would be Feature), but since this is likely to be something someone else pulls in and potentially extends, wouldn't it make more sense in the Foundation?
If you log in to the Partner Network portal at http://spn.sitecore.net you can see your regional contact at the top right corner of the site.
How to find my regional office contact? I need to update my credentials for the various Sitecore websites. I tried updating my info on https://portal.sitecore.net, but that seems to have done very little. In a couple of locations, I have seen messages indicating that I should contact "my regional office", but there is no help provided to find said office. The main Sitecore site has contacts for sales, but this doesn't seem like something that sales would handle. Where can I find the contact information for my regional office?
After a nice weekend of trial-and-error with the help of DotPeek, here is what I've come up with. This should be a complete example for use after installing the Active Directory module (using version 1.3 with Sitecore 8.2). With the following code you should now be able to patch domains required when using switchingProviders as well as add domains through the Domain Manager when needing to add custom domains that align with the tenants. From what I have seen in products like SXA, you can create roles such as the following: tenant1\Admin tenant1\FrontEnd tenant2\Admin tenant2\FrontEnd DynamicConfigDomainProvider - Combines the behaviors of two config providers using System; using System.Collections.Generic; using System.Collections.Specialized; using System.Xml; using Sitecore.Collections; using Sitecore.Configuration; using Sitecore.Diagnostics; using Sitecore.IO; using Sitecore.Security.Domains; namespace Company.Feature.Authentication.Domains { public class DynamicConfigDomainProvider : ConfigStoreDomainProvider { private SafeDictionary<string, Domain> _domainsFromList; private readonly object _lock = new object(); public override void Initialize(string name, NameValueCollection config) { base.Initialize(name, config); RefreshDomainsFromList(config); } private void RefreshDomainsFromList(NameValueCollection config) { lock (_lock) { var path = config.Get("domainList"); Assert.IsNotNullOrEmpty(path, "No valid domainList has been provided in the DynamicConfigDomainProvider configuration."); var xpath = FileUtil.MakePath(path, "domain", '/'); var domains = new SafeDictionary<string, Domain>(StringComparer.OrdinalIgnoreCase); foreach (XmlNode node in Factory.GetConfigNodes(xpath)) { var domain = ParseDomain(node); Assert.IsFalse(domains.ContainsKey(domain.Name), $"Duplicate domain definitions in DynamicConfigDomainProvider configuration. Domain name: {0}", domain.Name); domains.Add(domain.Name, domain); } Assert.IsTrue(domains.Count > 0, $"No domains found in the list pointed to in the DynamicConfigDomainProvider configuration ({0}).", path); _domainsFromList = domains; } } private static Domain ParseDomain(XmlNode node) { var domain = Factory.CreateObject(node, true) as Domain; if (domain == null) { throw new InvalidOperationException("Could not create domain from configuration node: " + node.OuterXml); } return domain; } public override IEnumerable<Domain> GetDomains() { foreach (var domain in base.GetDomains()) { yield return domain; } foreach (var domain in _domainsFromList.Values) { yield return domain; } } public override Domain GetDomain(string name) { Assert.ArgumentNotNull(name, "name"); lock (_lock) { return base.GetDomain(name) ?? _domainsFromList[name]; } } } } Company.Feature.Authentication.config - Patches the LDAP and domain settings <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <settings> <setting name="Authentication.ClientSessionTimeout"> <patch:attribute name="value">180</patch:attribute> </setting> <setting name="LDAP.EnableSorting"> <patch:attribute name="value">true</patch:attribute> </setting> <setting name="LDAP.SortKey"> <patch:attribute name="value">samaccountname</patch:attribute> </setting> </settings> <domainManager> <patch:attribute name="defaultProvider">dynamicConfig</patch:attribute> <providers> <clear /> <add name="file" type="Sitecore.Security.Domains.ConfigStoreDomainProvider, Sitecore.Kernel" configStoreName="domains" /> <add name="config" type="Sitecore.SecurityModel.ConfigDomainProvider, Sitecore.Kernel" domainList="domainManager/domains" defaultDomain="sitecore" /> <add name="dynamicConfig" type="Company.Feature.Authentication.Domains.DynamicConfigDomainProvider, Company.Feature.Authentication" configStoreName="domains" domainList="domainManager/domains" /> </providers> <domains> <patch:delete /> </domains> <domains> <domain id="abc" type="Sitecore.Security.Domains.Domain, Sitecore.Kernel"> <param desc="name">$(id)</param> <ensureAnonymousUser>false</ensureAnonymousUser> </domain> </domains> </domainManager> <switchingProviders> <membership> <provider patch:before="*" providerName="ad" storeFullNames="false" wildcard="*" domains="abc" /> </membership> <roleManager> <provider patch:before="*" providerName="ad" storeFullNames="false" wildcard="*" domains="abc" /> </roleManager> <profile> <provider patch:before="*" providerName="ad" storeFullNames="false" wildcard="*" domains="abc" /> </profile> </switchingProviders> </sitecore> </configuration> Web.Common.config - Transforms the web.config Update : I noticed that the profile defaultProvider did not have switcher configured which caused the "FullName" value to be empty when viewing users in the User Manager. <?xml version="1.0"?> <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> <system.web> <authentication> <forms xdt:Transform="Replace" xdt:Locator="Match(name)" name=".ASPXAUTH" cookieless="UseCookies" timeout="180" /> </authentication> <machineKey xdt:Transform="Remove" /> <machineKey xdt:Transform="InsertBefore(/configuration/system.web/membership)" validationKey="[INSERT_KEY]" validation="SHA1" decryption="AES" /> <membership> <providers> <add xdt:Transform="SetAttributes" xdt:Locator="Match(name)" name="sitecore" realProviderName="switcher" /> <add xdt:Transform="InsertIfMissing" xdt:Locator="Match(name)" name="ad" type="LightLDAP.SitecoreADMembershipProvider" connectionStringName="activedirectory" applicationName="sitecore" connectionProtection="Secure" attributeMapUsername="sAMAccountName" enableSearchMethods="true" customFilter="(memberOf=CN=GRP-Sitecore-Users,OU=Groups,OU=Company,DC=abc,DC=company,DC=corp)" /> </providers> </membership> <roleManager> <providers> <add xdt:Transform="SetAttributes" xdt:Locator="Match(name)" name="sitecore" realProviderName="switcher" /> <add xdt:Transform="InsertIfMissing" xdt:Locator="Match(name)" name="ad" type="LightLDAP.SitecoreADRoleProvider" connectionStringName="activedirectory" applicationName="sitecore" attributeMapUsername="sAMAccountName" customFilter="(memberOf=CN=GRP-Sitecore-Users,OU=Groups,OU=Company,DC=abc,DC=company,DC=corp)" /> </providers> </roleManager> <profile xdt:Transform="SetAttributes" defaultProvider="switcher"> <providers> <add xdt:Transform="InsertIfMissing" xdt:Locator="Match(name)" name="ad" type="LightLDAP.SitecoreADProfileProvider" connectionStringName="activedirectory" applicationName="sitecore" sitecoreMapDomainName="abc" /> </providers> </profile> </system.web> </configuration>
How do you best manage security domains using SXA with the Active Directory module? SXA provides the ability to create new tenants on-the-fly. Ideally each tenant would have a unique set of roles such as tenant1\admin and tenant1\editor. How do you configure roles and domains in Sitecore on-the-fly while also using the configuration patch for the abc domain? Is there a need for a domain provider that merges the behavior of both the file and config providers? Requirements Here are the following requirements: Use Microsoft Active Directory for authentication Users should login with their domain credentials (i.e. abc\michael.west) Each tenant should have unique roles managed through Sitecore and not influence the groups found in AD. The service account for the Sitecore App Pool only has read access to AD. Only users in a specific group in AD have access to Sitecore. Configuration Here is what I have setup: Created a new AD group called GRP-Sitecore-Users Installed Sitecore AD module. Configuration sample below. Added machine key Added AD membership provider with a custom filter for the GRP-Sitecore-Users Added AD role provider with a custom filter for the GRP-Sitecore-Users Company.Authentication.config <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <domainManager> <patch:attribute name="defaultProvider">config</patch:attribute> <providers> <clear /> <add name="file" type="Sitecore.Security.Domains.ConfigStoreDomainProvider, Sitecore.Kernel" configStoreName="domains" /> <add name="config" type="Sitecore.SecurityModel.ConfigDomainProvider, Sitecore.Kernel" domainList="domainManager/domains" defaultDomain="sitecore" /> </providers> <!-- Sample for use with config provider above --> <domains> <domain id="abc" type="Sitecore.Security.Domains.Domain, Sitecore.Kernel"> <param desc="name">$(id)</param> <ensureAnonymousUser>false</ensureAnonymousUser> </domain> </domains> </domainManager> <switchingProviders> <membership> <provider providerName="ad" storeFullNames="false" wildcard="*" domains="abc" /> </membership> <roleManager> <provider providerName="ad" storeFullNames="false" wildcard="*" domains="abc" /> </roleManager> <profile> <provider providerName="ad" storeFullNames="false" wildcard="*" domains="abc" /> </profile> </switchingProviders> </sitecore> </configuration> Errors: Using the patch for domainManager I'm unable to use the role manager for creating roles under abc and unable to use the domain manager for creating new domains. When adding a domain The ConfigDomainProvider does not support adding domains programmatically. Please edit the config files instead. When adding a role under the abc AD domain Environment: Sitecore 8.2 initial update 4 Active Directory Module 1.3 Update This has been working fine for some time now. I've even added the sync of roles using Unicorn.
If you want to restrict access to all renderings selected in the Allowed Controls field of a particular placeholder settings item, you can just restrict read access to the placeholder settings item. If you are trying to be more selective, you may want to add your own processor for the GetPlaceholderRenderings pipeline. You could use the rules engine to make it even more flexible similar to these projects: https://github.com/matthewkenny/ConditionalPlaceholderSettings https://github.com/williamsk/SitecorePlaceholderSettingsRules
How to Restrict by Role Adding Rendering to Placeholder in Experience Editor Would anyone know a way to restrict/allow by role the ability to add a rendering to a placeholder in the Experience Editor? This is for Sitecore 8.0.
I've put a lot of thought into how I might go about formulating an answer to this question. If anyone knows me personally, they'll know I'm pretty passionate about things that I care about, and Dynamic Sites Manager was pretty much the love child between immense frustration about how other Site Managers were going about doing it and the fact that I had a week off of time between Christmas (2014) and New Years (2015). So it's with that disclaimer that I tried to provide as much objectivity in this answer as possible. Birth of Dynamic Sites - Doing Multi-Site the Sitecore Way! I wanted to figure out how Sitecore intended to do multi-site. The goal being, I didn't want to override a SINGLE Sitecore class. So the requirements ended up being: No Class Overrides Must be able to add sites in the Sitecore editor. Must be able to add sites without a worker process recycle Prevent caging people into using a specific templates (as much as possible). Must be fast Must not adjust, muck, or any way alter httpRequestBegin pipeline. It must solve the problem. And that's exactly what I did. Dynamic Sites adds additional Site Providers to the mix. Executes and respects the ConfigSiteProvider out of the box, and implements it's own DynamicSiteProvider class along side of it. The custom provider only cares about it's sites and nothing else. I also added a switcher provider that allowed me to combine all of the providers in order to feed the SiteCollection. I also included some custom Sitecore caching to cache the Sites so that retrieving site information was as fast as possible. The end result being that Context.Site is updated, naturally, without being forced, Sitecore is aware of all sites (no sites masked), and all sites even had their own Sitecore site caching for things like xsl, html, and data caching. I decided to launch it as a Marketplace Module, provide the Shared Source license for use, and post it on Github. Was/Is it perfect? Oh god no. It was a rush job, at least the early iterations of it. As time past, I made small tweaks here and there as bug reports from users using it out in the wild started providing me with information. I tried to respond to all of them posting small updates as fixes were implemented. Current State of Dynamic Sites When Sitecore 8.2 was released, I immediately spent the night updating Dynamic Sites to support 8.2 and went through all of my test cases to ensure it was still functional. More information about this can be found on my blog, Sitecore Hacker. Future State of Dynamic Sites As much as it needs to be, I will continue to provide updates for the module. I am also working on Version 2.0 which is being completely rewritten to support Helix guidelines. In addition, I am planning on seeing how Dynamic Sites Manager needs to be adjusted for the Solution Experience Accelerator and taking into account Habitat's multi-site solution. As needed, I will make adjustments. How does it differ from Niket's Multiple Site Manager Niket took an entirely different approach, but ultimately he tied into the system by overriding the ConfigSiteProvider with his own class as well as injecting logic into the httpRequestBegin pipeline. He does manage to register the site with SiteContextFactory but does it in a way that requires him to lock down the factory from other threads while he builds the Site context for each site. He does this during the httpBeginRequest pipeline which means during the first request visit after a restart, Sitecore has to sit there and rebuild the site collection. He also goes through and hard codes some of the default Sitecore sites in order to appropriately order them since scheduler, system, and publisher are all special sites that have to come AFTER custom site definitions. And last, but not least, he updates new sites by touching the web.config which performs a worker process recycle to restart the Sitecore services. By doing that, the first request of httpBeginRequest is able to process and create his site definition again.
Preference of Multi-Site modules What is the primary difference between the MultipleSitesManager (https://github.com/JimmieOverby/MultipleSitesManager) vs. the DynamicSites (https://github.com/Vapok/Sitecore.SharedSource.DynamicSites) modules? Looking for reasons why one may be better than the other for a project with dozens of sites. Thanks.
I'm not sure if "tricking" sitecore by switching the connection strings for master to the other publishing databases would work, However i would suggest the following: In Sitecore Desktop, Switch to one of your publishing databases. Open content editor, then navigate to the items that you don't want to be overwritten by a publish process Click on "DEVELOPER" tab, then click "Serialize Tree", this will serialize this section on the tree into XML files, which can be found within your data\serialization[Database name] folder, I would back them up before i start the upgrade. Do the same for the other publishing database Install Sitecore upgrade packages for core and master and publish from master to publishing tagets Deserialize the items, by going back to sitecore desktop, and switching to one of the publishing databases. Navigate to the items that you want to restore as it was. Click on "DEVELOPER" tab, then click "Revert Tree" You should be able to get these items to the previous state before the upgrade was applied. Hope this helps!
Upgrade strategy for multiple publishing targets It's my understanding that the Sitecore upgrade packages are designed to run against only core and master - where changes are published to web. I need to upgrade 2 additional publishing targets that retain state (I can't just publish from master). Is there an alternative approach other than running the upgrade multiple times and tricking Sitecore into thinking the additional publishing targets are the master database?