output
stringlengths
34
25.7k
instruction
stringlengths
81
31k
input
stringclasses
1 value
I know that you are looking for a way to do it via the Rules Engine. However, you can do it with a custom field validator. You can restrict the MIME types that are passed to the custom validator through a parameter named MimeTypesNotAllowed, and these are injected into a property of the same name and map them in Sitecore. Take a look at https://sitecorejunkie.com/2014/04/06/restrict-certain-files-from-being-attached-to-web-forms-for-marketers-forms-in-sitecore/
How do I restrict mime types on files uploaded through a WFFM form in MVC? I am looking for a way to restrict MIME Types on files uploaded through a WFFM form. What I am really hoping for is a way to control the allowed MIME Types using the rules engine. Even if the solution doesn't use the rules engine, it may still help and is still welcome. Update: We are using our own custom File Upload field that inherits from the OOTB one. I would prefer to not have to rewrite or modify this field for this solution to work, but I will if I absolutely must. I am using Sitecore 8.1u2 and WFFM 8.1.160304 in an MVC solution.
If you don't have access to the server, you can upload a package and you will get the option to restart the sitecore server when it is done. I know this isn't the exact answer to your solution, but it is helpful if the only issues is that you don't have access to the App Pool to recycle it manually.
How to stop an active publishing process without recycling app pool I've ran publish process and forgot to uncheck republish checkbox. Now I need to wait while publishing finish. How I can stop publish process without recycling app pool?
We have just recently implemented a solution for this, to handle links to a specific template (Modal) differently. We created a custom renderField pipeline processor like the following: namespace Pipelines { public class RenderModalLink { public void Process(RenderFieldArgs args) { Assert.ArgumentNotNull(args, "args"); if (Sitecore.Context.Site.DisplayMode == Sitecore.Sites.DisplayMode.Edit) return; var field = Sitecore.Data.Fields.FieldTypeManager.GetField(args.GetField()); // Is it a linkField if (field is LinkField) { // Explicit cast required for some reason LinkField linkField = (LinkField) field; // Check if link is if (linkField.LinkType.ToLower() == "internal") { // Check if field has a value if (linkField.TargetItem == null) return; // Check if target item derives modal template (Synthesis) var modal = linkField.TargetItem.As<IModalItem>(); if (modal != null) { // Add your custom parameters (HTML attributes) here args.Parameters.Add("data-modal", linkField.GetFriendlyUrl()); args.Parameters.Add("href", "javascript:void(0);"); } } } } } } and patched it in after the SetParameters processor: <renderField> <processor type="Pipelines.RenderModalLink" patch:after="processor[@type='Sitecore.Pipelines.RenderField.SetParameters, Sitecore.Kernel']"/> </renderField>
Adding Attributes to Rendered Link Programmatically We need to apply attributes to rendered links conditionally. For example, if an internal link points to a specific template, add an attribute to the rendered anchor tag. Our initial efforts have focused on the <renderField> pipeline. We have patched in a processor attempted to modify the args.RenderParameters, but so far we're out of luck. Ultimately, this is so that we can open certain links with modal windows.
With this error in the stack trace "The remote name could not be resolved: 'platform.cloud.coveo.com'","errorCode":"NameResolutionFailure", it looks like your Sitecore instance can't communicate with Coveo Cloud. Have you tried accessing this URL directly from a browser in this same instance? You should probably check if there are any errors in the Coveo Diagnostic Page, accessible from YOUR_SITECORE_INSTANCE/sitecore%20modules/Web/Coveo/Admin/CoveoDiagnosticPage.aspx
Coveo cloud indexing error with "NameResolutionFailure" error code I am using Coveo for Sitecore 4 450 build. Noticing this error only on few environments. I looked up there is no CleanUpIndexAfterRebuildException entry in the coveo configs. Any ideas on how I can troubleshoot this? Job started: Index_Update_IndexName=Coveo_master_index|#Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Coveo.CloudPlatformClient.Exceptions.CleanUpIndexAfterRebuildException: An error occurred while querying documents to delete. ---> Coveo.Framework.Utils.Rest.HttpClientException: Failed to obtain resource located at 'http://devsite/coveo/rest?pipeline='. [BEGIN RESPONSE BODY]{"message":"The remote name could not be resolved: 'platform.cloud.coveo.com'","errorCode":"NameResolutionFailure"}[END RESPONSE BODY] ---> System.Net.WebException: The remote server returned an error: (503) Server Unavailable. at System.Net.HttpWebRequest.GetResponse() at Coveo.Framework.Utils.Rest.HttpClient.ExecuteRequest(String p_Url, Func`2 p_CreateRequest, Int64 p_CallId) --- End of inner exception stack trace --- at Coveo.Framework.Utils.Rest.HttpClient.HandleResponseException(WebException p_Exception, String p_Url, Int64 p_CallId) at Coveo.Framework.Utils.Rest.HttpClient.ExecuteRequest(String p_Url, Func`2 p_CreateRequest, Int64 p_CallId) at Coveo.Framework.Utils.Rest.HttpClient.PostRaw(String p_Url, String p_Body) at Coveo.Framework.Utils.Rest.HttpClient.Post(String p_Url, String p_Body) at Coveo.SearchServiceProvider.Rest.SearchQueryHelper.ExecuteQuery(QueryParams p_QueryParams, String p_Username) at Coveo.CloudPlatformClient.CleanUpAfterRebuild.CleanUpIndexAfterRebuildPerformer.ExecuteQuery(QueryParams p_QueryParams, String p_Username) --- End of inner exception stack trace --- at Coveo.CloudPlatformClient.CleanUpAfterRebuild.CleanUpIndexAfterRebuildPerformer.ExecuteQuery(QueryParams p_QueryParams, String p_Username) at Coveo.CloudPlatformClient.CleanUpAfterRebuild.CleanUpIndexAfterRebuildPerformer.QueryForDocumentToDelete(QueryParams p_QueryParams, String p_Username) at Coveo.CloudPlatformClient.CleanUpAfterRebuild.CleanUpIndexAfterRebuildPerformer.ExecuteCleanUp(String p_SourceName, DateTime p_LastRebuildDate, String p_Username, ICloudPlatformClient p_CloudPlatformClient, IManagedThreadPool p_ManagedThreadPool, HashSet`1 p_IndexedDocuments) at Coveo.CloudPlatformClient.DocumentManagement.CloudPlatformDocumentsHandler.ProcessStopRebuild(RebuildContext p_Context) at Coveo.CloudPlatformClient.DocumentManagement.CloudPlatformDocumentsHandler.StopRebuild(RebuildContext p_Context) at Coveo.CloudPlatformClient.DocumentManagement.CloudPlatformDocumentIndexer.StopRebuild(RebuildContext p_Context) at Coveo.CloudPlatformClient.Communication.CloudPlatformCommunication.StopRebuild(RebuildContext p_Context) at Coveo.SearchProvider.ProviderIndexBase.PerformRebuild(IProviderUpdateContext p_Context, Action`1 p_CrawlerAction) at Coveo.SearchProvider.ProviderIndexBase.Rebuild(IndexingOptions p_IndexingOptions, IProviderUpdateContext p_Context, Action`1 p_CrawlerAction) at Coveo.SearchProvider.ProviderIndex.TryPerformIndexingOperation(IndexingOptions p_IndexingOptions, Action p_Action) at Coveo.SearchProvider.ProviderIndex.Rebuild() --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Sitecore.Reflection.ReflectionUtil.InvokeMethod(MethodInfo method, Object[] parameters, Object obj) at Sitecore.Jobs.JobRunner.RunMethod(JobArgs args) at (Object , Object[] ) at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) at Sitecore.Jobs.Job.ThreadEntry(Object state)
As already mentioned, and you are probably aware, what you are doing is really not a good way to edit data. But to fix your issue now: Sitecore does cache data. So you will need to clear those caches to see your changes. You can use ../sitecore/admin/cache.aspx to clear caches. Or restart your site to clear everything ;)
Direct SQL INSERT/UPDATE not showing on Web page I'd use the API if having the choice, but right now I don't have the time for a learning curve, so I'm doing direct: UPDATE VersionedFields SET Value = 'Hypothesis Testing' WHERE Id = 'B8B9465E-1FB9-4717-BE14-0524DA1B4630' in preparation for bigger batching to come. However the change is not showing on the page, after browser reload and browser cache clearing. No "Publishing" action is involved because the test site points on the Master database (so from "Content Editor" a simple Save is enough to show the change instantly on the Web site pointing on Master). Also when I open a fresh /sitecore "Content Editor" after a SQL direct UPDATE, this is still the old value from before my UPDATE that shows. So I know that it's not reading directly from the DB even when starting a new Editing session, but from some cache. I had tried a: /Sitecore => Control Panel => Database => "Rebuild search indexes" on my local box, but it had done just bubbles. I must not be very far and will continue to search for answers, but in the meantime if one knows how to trigger the DB change to finally show on the page, I'll take that!
Apparently there's a checkbox.
Validation Errors Not Showing Up in Experience Editor Validation errors are not appearing in the experience editor for our shared QA environment. I have a content item that is identical in both environments (I packaged it up to make sure). On my local developer environment, I see the following: However, on the shared QA environment, I see this: I pointed my local connection strings to the shared QA environment to see if everything still worked. The validation errors no longer displayed on my local environment. To me, this indicates the following: It is not likely a config issue It is not likely an environment-specific issue It is likely a database/content issue I did the following: Compared the validation rules on the fields across, and they're both the same. Compared workflows and the user's security rights/roles. Confirmed the validation in the content editor works fine on both environments. I want the validation errors to display on all environments. Sitecore 8.1 rev. 151207 Update: It turns out 1 user (mine) can see validation, but nobody else can. I tested between two admin accounts. All security permissions are the same between them. I serialized both users and saw this: I suspect the blue box is why I can see validation but they cannot.
The boolean for the CheckSecurity method will specify whether or not to allow users of the Developer role access (or not). If 'false' (as shown) only admin users can get through. I also recommend that you place this physically inside the /sitecore/admin folder to take advantage of any hardening you might have configured on your servers to prevent access to the admin pages. If you choose to do in another location, you should make sure that the same hardening rules are applied to your custom location.
Creating a Custom Sitecore Admin Page to Create a Report I would like to add a new admin page that will only be available to users logged into the Sitecore admin. I guess the page is supposed to inherit from Sitecore.sitecore.admin.AdminPage. And, then call the CheckSecurity method: protected override void OnInit(EventArgs e) { this.CheckSecurity(false); base.OnInit(e); } Is this basically all I need to know to get this to work?
With this solution, it will create a new log file call audit.{date}.log and log any change the users make to the content. To achieve this, the pipeline subscribes the audit class to the item:creating, saving, deleting, copying, moving, renamed, sortorderchanged, templatechanged and itemProcessed events. Each time one of these events is triggered, a new log will be logged to the audit log describing the change. It details what field has changed, by who, and when. The logs look like this 24320 00:40:07 INFO (sitecore\admin): DELETE: master:/sitecore/content/Sites/Bonfire/Settings/Authors/test, language: en, version: 1, id: {25FBDA3C-1B2A-46C2-A1C6-0DE06F44CFE4} 2316 00:41:26 INFO (sitecore\admin): SAVE: master:/sitecore/content/Sites/Bonfire/Settings/Authors/Chris Auer, language: en, version: 1, id: {F808FA41-3483-4334-8DF1-CB1AD1079F56} 2316 00:41:26 INFO (sitecore\admin): ** [Author Image] 2316 00:41:26 INFO (sitecore\admin): -> New: <image mediaid="{C6888F94-FB48-493B-9399-83871CAF5446}" /> 2316 00:41:26 INFO (sitecore\admin): -> Old: <image mediaid="{C1838093-8EFD-4204-A665-7A700EBBBA62}" /> This code was taken from the blog post http://info.exsquared.com/ex-squared-blog/logging-changes-in-sitecore-made-by-content-authors#audit_code. I changed it a little bit because I wanted to use config files for consistency and not the AssemblyInfo class. The code using System; using System.Collections.Generic; using System.Linq; using Sitecore.Diagnostics; using Sitecore.Data.Items; using Sitecore.Events; using Sitecore.Data.Events; using Sitecore.Pipelines; using Sitecore.SecurityModel; namespace Custom.Diagnostics { public class Audit : Sitecore.Mvc.Pipelines.Loader.InitializeRoutes { #region Configuration Entries // The master switch for allowing auditing; To disable Sitecore item auditing add the following to <settings> section within a patch config: <setting name="Audit.Enabled" value="false"/> private static readonly bool _auditingEnabled = Sitecore.Configuration.Settings.GetBoolSetting("Audit.Enabled", true); // Boolean indication if this is a content authoring server (CAS) - which uses the master database. Content delivery servers use the web database... private static readonly bool _isCAS = Sitecore.Sites.SiteManager.GetSite("website").Properties["database"].ToLower() == "master"; // To prevent duplicate item names via the shell editor (UI) add the following to <settings> section within a patch config: <setting name="PreventDuplicateItemNames" value="true"/> // Both auditing, and auditing created items must be enabled... private static readonly bool _preventDuplicateNames = Sitecore.Configuration.Settings.GetBoolSetting("PreventDuplicateItemNames", false); // To disable auditing item creations, add the following to <settings> section within a patch config: <setting name="Audit.ItemCreating" value="false"/> private static readonly bool _auditItemCreating = Sitecore.Configuration.Settings.GetBoolSetting("Audit.ItemCreating", true); // To disable auditing changes to items, add the following to <settings> section within a patch config: <setting name="Audit.ItemSaving" value="false"/> private static readonly bool _auditItemSaving = Sitecore.Configuration.Settings.GetBoolSetting("Audit.ItemSaving", true); // To disable auditing item deletions, add the following to <settings> section within a patch config: <setting name="Audit.ItemDeleting" value="false"/> private static readonly bool _auditItemDeleting = Sitecore.Configuration.Settings.GetBoolSetting("Audit.ItemDeleting", true); // To disable auditing copying items, add the following to <settings> section within a patch config: <setting name="Audit.ItemCopying" value="false"/> private static readonly bool _auditItemCopying = Sitecore.Configuration.Settings.GetBoolSetting("Audit.ItemCopying", true); // To disable auditing item moves, add the following to <settings> section within a patch config: <setting name="Audit.ItemMoving" value="false"/> private static readonly bool _auditItemMoving = Sitecore.Configuration.Settings.GetBoolSetting("Audit.ItemMoving", true); // To disable auditing renaming of items, add the following to <settings> section within a patch config: <setting name="Audit.ItemRenamed" value="false"/> private static readonly bool _auditItemRenamed = Sitecore.Configuration.Settings.GetBoolSetting("Audit.ItemRenamed", true); // To enable auditing item sort order changes, add the following to <settings> section within a patch config: <setting name="Audit.ItemSortOrderChanged" value="true"/> private static readonly bool _auditItemSortOrderChanged = Sitecore.Configuration.Settings.GetBoolSetting("Audit.ItemSortOrderChanged", false); // To disable auditing item template changes, add the following to <settings> section within a patch config: <setting name="Audit.ItemTemplateChanged" value="false"/> private static readonly bool _auditItemTemplateChanged = Sitecore.Configuration.Settings.GetBoolSetting("Audit.ItemTemplateChanged", true); // To enable auditing item publish processed events, add the following to <settings> section within a patch config: <setting name="Audit.ItemPublished" value="true"/> private static readonly bool _auditItemPublished = Sitecore.Configuration.Settings.GetBoolSetting("Audit.ItemPublished", false); #endregion private static log4net.ILog _log = Sitecore.Diagnostics.LoggerFactory.GetLogger("Sitecore.Diagnostics.Auditing"); public override void Process(PipelineArgs args) { OnStart(); } public void Log(string message) { if (_log == null) Sitecore.Diagnostics.Log.Audit(message, this); else { string user = (Sitecore.Context.User == null) ? "extranet\\Anonymous" : Sitecore.Context.User.Name; _log.Info(string.Format("({0}): {1}", user, message)); } } public static void OnStart() { //if (_isCAS &amp;&amp; _auditingEnabled) //{ var handler = new Audit(); if (_auditItemCreating) Sitecore.Events.Event.Subscribe("item:creating", new EventHandler(handler.OnItemCreating)); if (_auditItemSaving) Sitecore.Events.Event.Subscribe("item:saving", new EventHandler(handler.OnItemSaving)); if (_auditItemDeleting) Sitecore.Events.Event.Subscribe("item:deleting", new EventHandler(handler.OnItemDeleting)); if (_auditItemCopying) Sitecore.Events.Event.Subscribe("item:copying", new EventHandler(handler.OnItemCopying)); if (_auditItemMoving) Sitecore.Events.Event.Subscribe("item:moving", new EventHandler(handler.OnItemMoving)); if (_auditItemRenamed) Sitecore.Events.Event.Subscribe("item:renamed", new EventHandler(handler.OnItemRenamed)); if (_auditItemSortOrderChanged) Sitecore.Events.Event.Subscribe("item:sortorderchanged", new EventHandler(handler.OnItemSortOrderChanged)); if (_auditItemTemplateChanged) Sitecore.Events.Event.Subscribe("item:templateChanged", new EventHandler(handler.OnItemTemplateChanged)); if (_auditItemPublished) Sitecore.Events.Event.Subscribe("publish:itemProcessed", new EventHandler(handler.OnItemPublished)); //} } protected void OnItemPublished(object sender, EventArgs args) { Assert.IsTrue(args != null, "args != null"); if (args != null &amp;&amp; args is Sitecore.Publishing.Pipelines.PublishItem.ItemProcessedEventArgs &amp;&amp; _auditItemPublished) { using (new SecurityDisabler()) { Sitecore.Publishing.Pipelines.PublishItem.PublishItemContext context = (args as Sitecore.Publishing.Pipelines.PublishItem.ItemProcessedEventArgs).Context; if (context.Result.Operation == Sitecore.Publishing.PublishOperation.Skipped) { try { // If we skipped publishing this item, we only care about logging why if we deliberately tried to republish this item... if (!context.PublishOptions.CompareRevisions &amp;&amp; context.PublishOptions.RootItem.ID == context.ItemId) { if (context.PublishHelper.SourceItemExists(context.ItemId)) { Item sourceItem = context.PublishHelper.GetSourceItem(context.ItemId); Log(string.Format("PUBLISH [{0}]: {1}", context.Result.Operation, AuditFormatter.FormatItem(sourceItem))); } else { Log(string.Format("PUBLISH [{0}]: {1}", context.Result.Operation, context.ItemId.ToString())); } Log(string.Format("** {0}", context.Result.Explanation)); } } catch (Exception) { // We don't need to log - we were skipping this item from getting published anyway } } else { if (context.PublishHelper.SourceItemExists(context.ItemId)) { Item sourceItem = context.PublishHelper.GetSourceItem(context.ItemId); Log(string.Format("PUBLISH [{0}]: {1}", context.Result.Operation, AuditFormatter.FormatItem(sourceItem))); } else { Log(string.Format("PUBLISH [{0}]: {1}, msg: {2}", context.Result.Operation, context.ItemId.ToString(), context.Result.Explanation)); } } } } } /// <summary> /// Responds to Sitecore new item creation, cloning an item, and duplicating an item (either via the UI or API) /// </summary> /// <param name="sender"></param> /// <param name="args">Param index 0 contains the ItemCreatingEventArgs: Contains item ID, name, master and template IDs, parent item</param> protected void OnItemCreating(object sender, EventArgs args) { Assert.IsTrue(args != null, "args != null"); if (args != null &amp;&amp; _auditItemCreating) { using (new SecurityDisabler()) { ItemCreatingEventArgs arg = Event.ExtractParameter(args, 0) as ItemCreatingEventArgs; Assert.IsTrue(arg != null, "arg != null"); if ((arg != null) &amp;&amp; (Sitecore.Context.Site.Name == "shell") &amp;&amp; (_preventDuplicateNames)) { foreach (Item currentItem in arg.Parent.GetChildren()) { if ((arg.ItemName.Replace(' ', '-').ToLower() == currentItem.Name.ToLower()) &amp;&amp; (arg.ItemId != currentItem.ID)) { arg.Cancel = true; Sitecore.Context.ClientPage.ClientResponse.Alert("Name \"" + currentItem.Name + "\" is already in use. Please use another name for the item."); return; } } } if (arg != null &amp;&amp; ShouldAudit(arg.Parent)) { Item t = arg.Parent.Database.Items[arg.TemplateId]; string templateName = t != null ? t.Name : arg.TemplateId.ToString(); Log(string.Format("CREATE: {0}:{1}/{2}, id: {3}, template: {4}", arg.Parent.Database.Name, arg.Parent.Paths.Path, arg.ItemName, arg.ItemId.ToString(), templateName)); } } } } /// <summary> /// Responds to Sitecore item deletions /// </summary> /// <param name="sender"></param> /// <param name="args">Param index 0 contains the Item being deleted</param> protected void OnItemDeleting(object sender, EventArgs args) { Assert.IsTrue(args != null, "args != null"); if (args != null &amp;&amp; _auditItemDeleting) { using (new SecurityDisabler()) { Item item = Event.ExtractParameter(args, 0) as Item; Assert.IsTrue(item != null, "item != null"); if (item != null &amp;&amp; ShouldAudit(item)) { Log(string.Format("DELETE: {0}", AuditFormatter.FormatItem(item))); } } } } /// <summary> /// Responds to Sitecore item updates /// </summary> /// <param name="sender"></param> /// <param name="args">Param index 0 contains the Item being saved</param> protected void OnItemSaving(object sender, EventArgs args) { Assert.IsTrue(args != null, "args != null"); if (args != null &amp;&amp; _auditItemSaving) { using (new SecurityDisabler()) { Item item = Event.ExtractParameter(args, 0) as Item; Assert.IsTrue(item != null, "item != null"); if (item != null &amp;&amp; ShouldAudit(item)) { Item originalItem = item.Database.GetItem(item.ID, item.Language, item.Version); var differences = FindDifferences(item, originalItem); if (differences.Any()) { TimeSpan createdTS = item.Statistics.Updated - item.Statistics.Created; TimeSpan sinceLastSave = item.Statistics.Updated - originalItem.Statistics.Updated; if (createdTS.TotalSeconds > 2 &amp;&amp; sinceLastSave.TotalSeconds > 2) Log(string.Format("SAVE: {0}", AuditFormatter.FormatItem(item))); foreach (string f in differences) { if (string.IsNullOrWhiteSpace(originalItem[f])) Log(string.Format("** [{0}]: {1}", item.Fields[f].DisplayName, item[f])); else if (originalItem[f].Length <= 40 &amp;&amp; item[f].Length <= 40) Log(string.Format("** [{0}]: {1}, old: {2}", item.Fields[f].DisplayName, item[f], originalItem[f])); else { Log(string.Format("** [{0}]", item.Fields[f].DisplayName)); Log(string.Format(" -> New: {0}", item[f])); Log(string.Format(" -> Old: {0}", originalItem[f])); } } } } } } } /// <summary> /// Find non-system fields that have changed /// </summary> /// <param name="newItem"></param> /// <param name="originalItem"></param> /// <returns></returns> private static List<string> FindDifferences(Item newItem, Item originalItem) { newItem.Fields.ReadAll(); IEnumerable<string> fieldNames = newItem.Fields.Select(f => f.Name).Where(name => !name.StartsWith("__")); return fieldNames .Where(fieldName => newItem[fieldName] != originalItem[fieldName] &amp;&amp; originalItem.Fields[fieldName] != null &amp;&amp; newItem.Fields[fieldName].ID == originalItem.Fields[fieldName].ID) .ToList(); } /// <summary> /// Retrieve the current workflow state for the Sitecore item /// </summary> /// <param name="item"></param> /// <returns></returns> private static string GetWorkflowState(Item item) { Sitecore.Workflows.WorkflowInfo info = item.Database.DataManager.GetWorkflowInfo(item); return (info != null) ? info.StateID : String.Empty; } private static bool ShouldAudit(Item item) { return item.Database.Name.ToLower() == "master"; } /// <summary> /// Responds to Sitecore item copying /// </summary> /// <param name="sender"></param> /// <param name="args"> /// Param index 0 contains the Item being copied, /// Param index 1 contains the Item Copy destination, /// Param index 2 contains the Result item name, /// Param index 3 contains the Result item ID, /// Param index 4 contains the boolean indication whether it is a recursive copy (including children) or not /// </param> protected void OnItemCopying(object sender, EventArgs args) { Assert.IsTrue(args != null, "args != null"); if (args != null &amp;&amp; _auditItemCopying) { using (new SecurityDisabler()) { Item item = Event.ExtractParameter(args, 0) as Item; Assert.IsTrue(item != null, "item != null"); if (item != null &amp;&amp; ShouldAudit(item)) { Item destination = Event.ExtractParameter(args, 1) as Item; string itemName = Event.ExtractParameter(args, 2) as string; Sitecore.Data.ID itemID = Event.ExtractParameter(args, 3) as Sitecore.Data.ID; bool recursive = (bool)Event.ExtractParameter(args, 4); if (item.Parent.Paths.Path == destination.Paths.Path &amp;&amp; item.Name != itemName) Log(string.Format("DUPLICATE: {0}:{1}, destination: {2}/{3}, id: {4}{5}", item.Database.Name, item.Paths.Path, destination.Paths.Path, itemName, itemID.ToString(), item.Children.Count == 0 ? string.Empty : string.Format(" recursive: {0}", recursive.ToString()))); else Log(string.Format("COPY: {0}:{1}, destination: {2}/{3}, id: {4}{5}", item.Database.Name, item.Paths.Path, destination.Paths.Path, itemName, itemID.ToString(), item.Children.Count == 0 ? string.Empty : string.Format(" recursive: {0}", recursive.ToString()))); } } } } /// <summary> /// Responds to Sitecore item moving /// </summary> /// <param name="sender"></param> /// <param name="args"> /// Param index 0 contains the Item being moved, /// Param index 1 contains the ID of the old parent, /// Param index 2 contains the ID of the new parent /// </param> protected void OnItemMoving(object sender, EventArgs args) { Assert.IsTrue(args != null, "args != null"); if (args != null &amp;&amp; _auditItemMoving) { using (new SecurityDisabler()) { Item item = Event.ExtractParameter(args, 0) as Item; Assert.IsTrue(item != null, "item != null"); if (ShouldAudit(item)) { Sitecore.Data.ID oldParentID = Event.ExtractParameter(args, 1) as Sitecore.Data.ID; Sitecore.Data.ID newParentID = Event.ExtractParameter(args, 2) as Sitecore.Data.ID; Item oldParent = item.Database.Items[oldParentID]; Item newParent = item.Database.Items[newParentID]; if (item != null &amp;&amp; oldParent != null &amp;&amp; newParent != null &amp;&amp; oldParent.ID != newParent.ID) { Log(string.Format("MOVE: [{0}] from: {1}:{2} to: {3}:{4}", item.Name, oldParent.Database.Name, oldParent.Paths.Path, newParent.Database.Name, newParent.Paths.Path)); } } } } } /// <summary> /// Responds to Sitecore item rename /// </summary> /// <param name="sender"></param> /// <param name="args"> /// Param index 0 contains the result Item, /// Param index 1 contains the Item name prior to being renamed /// </param> protected void OnItemRenamed(object sender, EventArgs args) { Assert.IsTrue(args != null, "args != null"); if (args != null &amp;&amp; _auditItemRenamed) { using (new SecurityDisabler()) { Item item = Event.ExtractParameter(args, 0) as Item; string itemNameBeforeRename = Event.ExtractParameter(args, 1) as string; Assert.IsTrue(item != null, "item != null"); if (item != null &amp;&amp; itemNameBeforeRename != item.Name &amp;&amp; ShouldAudit(item)) { Log(string.Format("RENAME: {0}:{1}/{2}, as: {3}", item.Database.Name, item.Parent.Paths.Path, itemNameBeforeRename, item.Name)); } } } } /// <summary> /// Responds to Sitecore item sort order changed /// </summary> /// <param name="sender"></param> /// <param name="args"> /// Param index 0 contains the sorted Item, /// Param index 1 contains the Old sortorder value (string) /// </param> protected void OnItemSortOrderChanged(object sender, EventArgs args) { Assert.IsTrue(args != null, "args != null"); if (args != null &amp;&amp; _auditItemSortOrderChanged) { using (new SecurityDisabler()) { Item item = Event.ExtractParameter(args, 0) as Item; string oldSortOrder = Event.ExtractParameter(args, 1) as string; Assert.IsTrue(item != null, "item != null"); if (item != null &amp;&amp; ShouldAudit(item)) { Log(string.Format("SORT: {0}:{1}, new: {2}, old: {3}", item.Database.Name, item.Paths.Path, item.Appearance.Sortorder, oldSortOrder)); } } } } /// <summary> /// Responds to Sitecore item template changed /// </summary> /// <param name="sender"></param> /// <param name="args"> /// Param index 0 contains the ID of the item being changed, /// Param index 1 contains the Instance of the datamanager class handling the template /// </param> protected void OnItemTemplateChanged(object sender, EventArgs args) { Assert.IsTrue(args != null, "args != null"); if (args != null &amp;&amp; _auditItemDeleting) { using (new SecurityDisabler()) { Item item = Event.ExtractParameter(args, 0) as Item; Sitecore.Data.Templates.TemplateChangeList change = Event.ExtractParameter(args, 1) as Sitecore.Data.Templates.TemplateChangeList; Assert.IsTrue(item != null, "item != null"); if (item != null &amp;&amp; ShouldAudit(item) &amp;&amp; change.Target.ID != change.Source.ID) { Log(string.Format("TEMPLATE CHANGE: {0}:{1}, target: {2}, source: {3}", item.Database.Name, item.Paths.Path, change.Target.Name, change.Source.Name)); foreach (Sitecore.Data.Templates.TemplateChangeList.TemplateChange c in change.Changes) { if (c.Action == Sitecore.Data.Templates.TemplateChangeAction.DeleteField) Log(string.Format("** {0}: {1}", c.Action, c.SourceField.Name)); } } } } } } } The config <sitecore> <pipelines> <initialize> <processor type="Custom.Diagnostics.Audit, Sitecore.Foundation.Logging" /> </initialize> </pipelines> </sitecore> Sitecore.config change This change needs to be applied to the section of the sitecore.config file. <appender name="AuditLogFileAppender" type="log4net.Appender.SitecoreLogFileAppender, Sitecore.Logging"> <file value="$(dataFolder)/logs/audit.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> <logger name="Sitecore.Diagnostics.Auditing" additivity="false"> <level value="INFO" /> <appender-ref ref="AuditLogFileAppender" /> </logger>
Logging Changes in Sitecore 8.1 Made by Content Authors I would like to capture more log info from Sitecore Logging. Changes such as what exactly was edited, what text changes were added or removed. Which images were added and so on. Has anyone done anything like this already? I found an article http://info.exsquared.com/ex-squared-blog/logging-changes-in-sitecore-made-by-content-authors but it is not working properly. The AssemblyInfo.cs file is the problem I think. any help would be much appreciated.
Security is stored on the content items themselves so it's likely that when you deployed the workflow items through TDS to your QA environment, those items contain, in plain text, the names of the Security Roles that you configured on them in your DEV environment, even though the actual Security Roles haven't been created in your QA Core database. To see this, you can go to the workflow items in question, turn on Standard Fields and expand the Security section of fields. There, you should see the name of the Security Roles in question.
workflowState.Security.GetAccessRules() returns a Security Role that shouldn't exist I have code that gets the AccessRules for a workflow state. My local dev environment has a role called "sitecore\ABC Admin" this role only exists on my local environment. We have our workflow items in a TDS project and deployed out to the other environments. In QA when calling GetAccessRules an AccessRule of type AccountType.Role with an Account.Name of "sitecore\ABC Admin" is getting returned - causing us to have to add code that checks to see if the role exists first before continuing. So the question is - where do I find what AccessRules exist in Content Editor for a user so I can to try and remove this phantom Role?
To inject something via constructor or get types with Service Locator you need to register your services first. public class RegisterOoyalaServices : IocProcessor { public override void Process(IocArgs args) { args.ServiceCollection.AddTransient<IOoyalaRepository, OoyalaComponentRepository>(); } } <pipelines> <ioc> <processor type="NAMESPACE.RegisterOoyalaServices, NAMESPACE" /> </ioc> </pipelines> You will have to reference following DLLs: Sitecore.XA.Foundation.IoC Microsoft.Extensions.DependencyInjection Microsoft.Extensions.DependencyInjection.Abstractions
SXA custom component looking for parameterless constructor I am trying to create my first SXA compatible component, and I can't seem to get everything setup quite right. I decompiled the Maps component, and am using it as my guide. I understand that I need to use an MVC pattern, and so here's what I've got. Here's my controller: public class OoyalaController : StandardController { private readonly IOoyalaRepository _repository; public OoyalaController(IOoyalaRepository repository) { _repository = repository; } protected override object GetModel() { return _repository.GetModel(); } } Here's my Interface: public interface IOoyalaRepository : IModelRepository { } And here's my repository class: public class OoyalaComponentRepository: ModelRepository, IOoyalaRepository { public override IRenderingModelBase GetModel() { OoyalaComponentModel model = new OoyalaComponentModel(); FillBaseProperties(model); return model; } } Finally, here's my model class: public class OoyalaComponentModel : RenderingModelBase { public string MediaID { get; set; } } I've got my .cshtml looking like this: @using Sitecore.XA.Foundation.SitecoreExtensions.Extensions @model Components.Models.OoyalaComponentModel <div class="component simple-component @Model.CssClasses.Aggregate()"> <div class="component-content"> <h1>You are on @Model.MediaID page</h1> </div> </div> In my content editor view, I believe I have the new rendering added to the right category and setup in the same way that the Map component is setup, as you can see in this screenshot: I also setup the Parameters template to include the IComponentVariant and Styling base templates: I seem to be missing something, however, as whenever I try to add my component to the page, I get the following error: Exception: System.InvalidOperationException Message: An error occurred when trying to create a controller of type 'Components.Controllers.OoyalaController'. Make sure that the controller has a parameterless public constructor. Source: System.Web.Mvc at System.Web.Mvc.DefaultControllerFactory.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) at System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) at Sitecore.Mvc.Controllers.SitecoreControllerFactory.CreateController(RequestContext requestContext, String controllerName) Nested Exception Exception: System.MissingMethodException Message: No parameterless constructor defined for this object. Source: mscorlib at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean&amp; canBeCached, RuntimeMethodHandleInternal&amp; ctor, Boolean&amp; bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark&amp; stackMark) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Activator.CreateInstance(Type type) at System.Web.Mvc.DefaultControllerFactory.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) I understand that the system is looking for a parameterless constructor, however, the map component doesn't have a parameterless constructor. What do I have configured/coded incorrectly?
From the Sitecore Launch site. You can use the email address or the domain\username as inputs for for Tracker.Current.Session.Identify(domainUser); This will link the current contact with the sitecore user. SC 8.x public static void SetVisitTagsOnLogin(string domainUser, bool IsNewUser) { string name = Sitecore.Context.User.Profile.FullName; if (name == String.Empty) name = Sitecore.Context.User.LocalName; Tracker.Current.Contact.Tags.Add("Username", domainUser); Tracker.Current.Contact.Tags.Add("Full name", name); Tracker.Current.Contact.Identifiers.AuthenticationLevel = AuthenticationLevel.PasswordValidated; Tracker.Current.Session.Identify(domainUser); if (IsNewUser) { IContactPersonalInfo personalFacet = Tracker.Current.Contact.GetFacet<IContactPersonalInfo>("Personal"); personalFacet.FirstName = GetFirstName(name); personalFacet.Surname = GetSurName(name); IContactEmailAddresses addressesFacet = Tracker.Current.Contact.GetFacet<IContactEmailAddresses>("Emails"); IEmailAddress address; if (!addressesFacet.Entries.Contains("work_email")) { address = addressesFacet.Entries.Create("work_email"); address.SmtpAddress = GetEmailAddressFromUser(domainUser); addressesFacet.Preferred = "work_email"; } } } SC 9.x var contactReference = _contactIdentificationRepository.GetContactReference(); using (var client = _contactIdentificationRepository.CreateContext()) { // we can have 1 to many facets // PersonalInformation.DefaultFacetKey // EmailAddressList.DefaultFacetKey // Avatar.DefaultFacetKey // PhoneNumberList.DefaultFacetKey // AddressList.DefaultFacetKey // plus custom ones var facets = new List<string> { PersonalInformation.DefaultFacetKey }; // get the contact var contact = client.Get(contactReference, new ContactExpandOptions(facets.ToArray())); // pull the facet from the contact (if it exists) var facet = contact.GetFacet<PersonalInformation>(PersonalInformation.DefaultFacetKey); // if it exists, change it, else make a new one if (facet != null) { facet.FirstName = $"Jimmy"; facet.LastName = $"McSitecore"; // set the facet on the client connection client.SetFacet(contact, PersonalInformation.DefaultFacetKey, facet); } else { // make a new one var personalInfoFacet = new PersonalInformation() { FirstName = "Jimmy", LastName = "McSitecore" }; // set the facet on the client connection client.SetFacet(contact, PersonalInformation.DefaultFacetKey, personalInfoFacet); } if (contact != null) { // submit the changes to xConnect client.Submit(); // reset the contact _contactIdentificationRepository.Manager.RemoveFromSession(Analytics.Tracker.Current.Contact.ContactId); Analytics.Tracker.Current.Session.Contact = _contactIdentificationRepository.Manager.LoadContact(Analytics.Tracker.Current.Contact.ContactId); } } my contact repo using System.Linq; using Sitecore.Analytics; using Sitecore.Analytics.Model; using Sitecore.Analytics.Tracking; using Sitecore.Configuration; using Sitecore.XConnect; using Sitecore.XConnect.Client.Configuration; namespace Sitecore.Foundation.Accounts.Repositories { public class ContactIdentificationRepository { private readonly ContactManager contactManager; public ContactManager Manager => contactManager; public ContactIdentificationRepository() { contactManager = Factory.CreateObject("tracking/contactManager", true) as ContactManager; } public IdentifiedContactReference GetContactReference() { // get the contact id from the current contact var id = GetContactId(); // if the contact is new or has no identifiers var anon = Tracker.Current.Contact.IsNew || Tracker.Current.Contact.Identifiers.Count == 0; // if the user is anon, get the xD.Tracker identifier, else get the one we found return anon ? new IdentifiedContactReference(Sitecore.Analytics.XConnect.DataAccess.Constants.IdentifierSource, Tracker.Current.Contact.ContactId.ToString("N")) : new IdentifiedContactReference(id.Source, id.Identifier); } public Analytics.Model.Entities.ContactIdentifier GetContactId() { if (Tracker.Current?.Contact == null) { return null; } if (Tracker.Current.Contact.IsNew) { // write the contact to xConnect so we can work with it this.SaveContact(); } return Tracker.Current.Contact.Identifiers.FirstOrDefault(); } public void SaveContact() { // we need the contract to be saved to xConnect. It is only in session now Tracker.Current.Contact.ContactSaveMode = ContactSaveMode.AlwaysSave; this.contactManager.SaveContactToCollectionDb(Tracker.Current.Contact); } public IXdbContext CreateContext() { return SitecoreXConnectClientConfiguration.GetClient(); } } }
Bind current visitor with Sitecore contact We want to bind current visitor profile with Sitecore contact. We want to do whenever user enters his or her email id in newsletter form or contact us form or registration form. This is to create know experience profile. Please suggest.
I agree with the answer provided above except for the part that you need a Xamarin license. Xamarin is now free and is a built-in installation available for Visual Studio 2015 Community Edition (or you can also download for free Xamarin for Visual Studio 2013). Working with Xamarin and Sitecore might seem a bit tricky for the first time. You may find some useful information in this blog post: Getting started with Xamarin and Sitecore Mobile SDK.
Xamarin support for early version of Sitecore We are working on for creating mobile app for one of the client and we have started evaluating it. It is on sitecore 7.0. We ant to use Xamarin. Does Xamarin supports this version of Sitecore.
Once you log the user in, you can process some out of the box Sitecore facets or your custom ones. Setting the user's info in xDB [HttpPost] [AllowAnonymous] public ActionResult Login(LoginModel model, string returnUrl) { if (ModelState.IsValid) { Sitecore.Security.Domains.Domain domain = Sitecore.Context.Domain; string domainUser = domain.Name + @"\" + model.UserName; if (Sitecore.Security.Authentication.AuthenticationManager.Login(domainUser, model.Password, model.RememberMe)) { AnalyticsHelper.SetVisitTagsOnLogin(domainUser, false); return RedirectToLocal(returnUrl); } } // If we got this far, something failed, redisplay form ModelState.AddModelError("", "The user name or password provided is incorrect."); return View(model); } A helper function to assign the user's data to the xDB facets. public static void SetVisitTagsOnLogin(string domainUser, bool IsNewUser) { string name = Sitecore.Context.User.Profile.FullName; if (name == String.Empty) name = Sitecore.Context.User.LocalName; Tracker.Current.Contact.Tags.Add("Username", domainUser); Tracker.Current.Contact.Tags.Add("Full name", name); Tracker.Current.Contact.Identifiers.AuthenticationLevel = AuthenticationLevel.PasswordValidated; Tracker.Current.Session.Identify(domainUser); if (IsNewUser) { IContactPersonalInfo personalFacet = Tracker.Current.Contact.GetFacet<IContactPersonalInfo>("Personal"); personalFacet.FirstName = GetFirstName(name); personalFacet.Surname = GetSurName(name); IContactEmailAddresses addressesFacet = Tracker.Current.Contact.GetFacet<IContactEmailAddresses>("Emails"); IEmailAddress address; if (!addressesFacet.Entries.Contains("work_email")) { address = addressesFacet.Entries.Create("work_email"); address.SmtpAddress = GetEmailAddressFromUser(domainUser); addressesFacet.Preferred = "work_email"; } } } Getting the user's info out of xDB The benefit of xDB is that all the user's facet data is on there current contact object. Just call for the facet to get the data. var contact = Tracker.Current.Contact; var emailAddresses = contact.GetFacet<IContactEmailAddresses>("Personal"); You can find some more information about getting the facet data here. http://sitecore-community.github.io/docs/xDB/contact-facets/ As described on this page, https://doc.sitecore.net/sitecore_experience_platform/setting_up__maintaining/xdb/contacts/identifying_contacts. The domain user in the code above can be: A user login name A user ID in a security system An email address
How can I use xDB contact to login users? I'm tracking visitors information into my mongoDB and I can identify them as contacts (through the email). I'm now trying to have a login (with password) area where users can login and see some information. I'm not clear how can I do this? Can I still use my mongoDB Contact or is this different?
Here is an another example. What I am not happy that reflection and message collection are being used. But it can be as workaround for quick solution. Configuration: <sitecore> <commands> <command name="custom:CopyLatestVersionTo" type="Sitecore.CopyTo.CopyLatestVersionTo, Sitecore.CopyTo" /> </commands> <processors> <uiCopyItems> <processor mode="on" type="Sitecore.CopyTo.Pipelines.CopyLatestTo, Sitecore.CopyTo" method="OnlyLatestVersion" patch:after="processor[@type='Sitecore.Shell.Framework.Pipelines.CopyItems,Sitecore.Kernel'][@method='Execute']" /> </uiCopyItems> </processors> Command: [Serializable] public class CopyLatestVersionTo : Sitecore.Shell.Framework.Commands.CopyTo { public override void Execute(CommandContext context) { var args = new CopyItemsArgs(); var instance = Activator.CreateInstance(typeof(Sitecore.Shell.Framework.Items)); var methodInfos = new List<MethodInfo>(instance.GetType().GetMethods(BindingFlags.Static | BindingFlags.NonPublic)); var method = methodInfos.FirstOrDefault(m => m.Name == "Start" &amp;&amp; m.GetParameters().Length == 4); args.AddMessage("command:copylatest"); method.Invoke(instance, new object[] {"uiCopyItems", args, context.Items[0].Database, context.Items}); } } Processor: public class CopyLatestTo { protected virtual void OnlyLatestVersion(CopyItemsArgs args) { var pipelineMessages = args.GetMessages(PipelineMessageFilter.Informations); if (pipelineMessages != null &amp;&amp; pipelineMessages.Any(m=>m.Text == "command:copylatest")) { var copies = args.Copies; foreach (var copy in copies) { var currentVersion = copy.Versions.GetLatestVersion(); foreach (var itemVersion in copy.Versions.GetVersions(true)) { if (!itemVersion.Version.Number.Equals(currentVersion.Version.Number)) { itemVersion.Versions.RemoveVersion(); } } } } } } Menu Item: "/sitecore/content/Applications/Content Editor/Context Menues/Default/Copying/Copy Latest To" Result:
How to duplicate or copy item only with the latest language versions? Our customer had a request for possibility to copy or duplicate an item without a previous language versions. Only the latest versions have to be created. Check my solution on http://sitecore-masters.com/en/2016/11/28/duplicate-item-without-previous-versions. Do you know any other solution?
There is. Sitecore has open sourced a patch to fix this. The code is on github, you'll need to download it and build the patch against your version of Sitecore. You may need to adjust the code to work with different releases. For example, I had to install this on a 7.x instance and it required some code changes to build. https://github.com/andrew-at-sitecore/Sitecore.Support.391039 Basically what this does is wrap all the Solr stuff in checks to a monitor class, and logs errors if Solr is unavailable rather than throwing exceptions. This will work on CD servers if your code handles empty search results gracefully. It will not help the Sitecore backend, that will still break if Solr is down. I have a blog post about it here: http://www.chrissulham.com/keep-sitecore-online-when-solr-fails/
Gracefully handle Solr search connectivity issues We had an issue recently where the Solr search servers went down and it took the site down too. Is there a way to handle this gracefully and keep the site up but just return an error message when the user tries to use the site search or other functionality that requires Search? Sitecore seems to check connectivity to Solr pretty early on and bomb out if it can't connect to one or more indexes.
From what I understand, your content tree looks something like this: Sitecore |_Content |_Home | |_News | |_News1 Page |_SharedContent |_News |_News1 Content This can be a viable way to organise things, but I would only go this route if you really need to and get some real benefit from doing so i.e. if you have a multi-site solution and need to share those articles between the sites (in that case, you would still have some SEO considerations regarding duplicate content which would need to be addressed). You need to ask yourself: What is the actual benefit of splitting the news article content between the news pages and the news SharedContent items? Under this architecture, you have two basic options: Store a link to the pages within the SharedContent items. You could maybe auto-populate / auto-update this link from a save action of a specific template type, however you still have to contend with the scenario of having multiple pages linking to the same SharedContent item Perform some kind of query to determine the page items which link to your SharedContent items - this will be SLOW! My opinion is that neither of the above options are particularly nice and that you should try to keep things simple and structure your content as follows: Sitecore |_Content |_Home |_News |_News1 Page
Sitecore 8.0 Content Tree structure I'm working with news items. On a home page, I need to display a list of news items that link to news pages. My content tree looks like Home Page News News 1 Page Shared Content News News 1 Content With News 1 Page using News 1 Content as its Datasource etc. That's all fine but on my home page, I also have a news listing control which has Shared Content/News as its data source. That displays correctly but I then need to link to the actual page in News and I don't have that link in the Datasource and don't know what the URL is. I want to link from the news snippet on the home page to the news page related to that news content. I'm using View Renderings. So firstly does that tree look good to you? And secondly, how can I get a link to a news page from that news listing on the home page?
transpires that contrary to previous advise from sitecore support that you should be replicating the properties table, as otherwise the CM and CD servers have no knowledge of each others event queues. seems to me that by doing this you are potentially replicating the properties table before the event has actually been processed but i'm led to believe that the instancename ensures this will always work. i'm still have issues regarding wffm remote events firing, but at least i now know why my properties table was missing those rows
Missing EventQueue entry from Properties table? Context: The Properties database table contains rows beginning with EQSTAMP which contain the instance names of the CM and CD servers. In our master db we only have a reference to the CM server instance. In our web db we have references to the CM and both CD server instances. In our core db we only have a reference to the CM server instance. I am led to believe that remote events are only processed when the instance name does not match the instance name of the server that the event is being executed on, and also the WFFM relies on the eventqueue within the core db in order to transfer form submissions from the website to the CM WFFM database. So it would appear that I am missing rows from the properties table. If I remove rows from the properties table locally the appropriate rows are re-added straight away, but on higher environments (staging and production) these rows are not being added. I am replicating the core dbs between CM and CDs using merge replication. Questions: 1) is this the expected behaviour considering my local env is a single server and my higher envs are separate servers for CM and CDs? 2) why are the instance names not being added to the properties table in my staging &amp; production environments? I have noticed that user account changes are reflected across CM and CDs, but WFFM form submissions not being saved to the SQL db on production (although they are on staging).
Assuming that you are using FakeDB for your Unit Tests you can simply change settings on the fly. See example: using (Db fakeDb = new Db()) { fakeDb.Configuration.Settings["SettingName"] = "SettingValue"; } More info here.
Technique for changing Sitecore configuration for unit tests When we unit test we often need to change some Sitecore configuration for the tests. For example, we may have the following: <sitecore> <configuration> <someNode name="myService">http://myservice:1234/endpoint</someNode> <settings> <setting name="mySftp" value="sftp://mysftp:21/" /> </settings> </configuration> </sitecore> and we may need to change it to the following when running our unit tests: <sitecore> <configuration> <someNode name="myservice">http://test.myservice:1234/endpoint</someNode> <settings> <setting name="mySftp" value="sftp://test.mysftp:21/" /> </settings> </configuration> </sitecore> I had previously been handling these changes by using different build configurations with config transforms. The problem with this is that I prefer to run my unit tests across both DEBUG and RELEASE mode, since the optimizations when building in RELEASE mode (shouldn't but) can cause errors in some code. I could work around this by customizing my targets and making two build configurations for unit tests, unitdebug and unitrelease, but this seems kind of hacky and I'm sure there are better solutions out there. I'm wondering what techniques other people are using for handling these changes when running unit tests. Note: Partial answers are totally acceptable for this one. I expect that there may be different techniques for different kinds of settings. Getting a bunch of ideas together that I and others can pick and choose from will make a great reference for the community! Of course, I will accept the answer that works best in the most cases :)
Have you published Layouts and templates to web? Can you try publishing /Layouts &amp; /templates separately. When you don't have related layout items published to web database, page item's presentation details will not show in Sitecore Content Editor (UI tool) interfaces in web. But, when you check raw values of that field, you can see the reference values in the field. When you publish the Layout items, page item's presentation details will start to appear in content editor.
Layout Details Not Being Published I have an item with 6 controls in the layout details. When I publish, only 1 control in the layout details is being published. I want all the layout details controls to be published, but I cannot figure out why the other 5 controls are not being published to the web database. All of the layouts and templates have been verified to exist in the web database. I have tried publishing multiple times and a successful publish is always indicated. We are using Sitecore 7.5. Publish Settings: Master Database: Web Database (After Publish): Here is some of the logging information: 7436 16:56:54 INFO [Publishing]: Starting to process 1 publishing options 7436 16:56:54 INFO [PublishOptions]: root:{C0DBB99F-72DA-4B56-A0AF-9A7DE9BEC070}, language:en, targets:Internet, database:web, mode:SingleItem, smart:True children:True, related:True 7888 16:56:54 WARN DeepItemPublish detected. PublishContext was overridden with DisableDatabaseCaches=True. 7888 16:56:54 INFO Starting [Publishing] - ProcessQueue 7888 17:02:58 INFO Finished [Publishing] - ProcessQueue in 364401 ms 7888 17:02:58 INFO Publish Mode : SingleItem 7888 17:02:59 INFO Created : 0 7888 17:02:59 INFO Updated : 29 7888 17:02:59 INFO Deleted : 1 7888 17:02:59 INFO Skipped : 775318 4820 17:04:13 INFO [Publishing]: Starting to process 1 publishing options 4820 17:04:13 INFO [PublishOptions]: root:{5FF2C731-384D-4420-801C-CE7DD046AACC}, language:en, targets:Internet, database:web, mode:SingleItem, smart:False children:True, related:True 7412 17:04:13 WARN DeepItemPublish detected. PublishContext was overridden with DisableDatabaseCaches=True. 7412 17:04:13 INFO Starting [Publishing] - ProcessQueue 7412 17:05:28 INFO Finished [Publishing] - ProcessQueue in 74978 ms 7412 17:05:28 INFO Publish Mode : SingleItem 7412 17:05:28 INFO Created : 0 7412 17:05:28 INFO Updated : 794 7412 17:05:28 INFO Deleted : 0 7412 17:05:28 INFO Skipped : 0 Raw Values for Renderings on Master: <r xmlns:p="p" xmlns:s="s" p:p="1"> <d id="{FE5D7FDF-89C0-4D99-9AA3-B5FBD009C9F3}"> the default layout <r uid="{618896CE-55C4-44C4-B4DF-C6718361821E}"> not found <p:d /> </r> <r uid="{F87FA886-A693-49F2-B989-806830B9379B}" not found p:before="r[@uid='{CD25EEB7-729D-4EB2-9423-99EF7DEA7CE0}']" not found s:id="{75C72E54-0D18-4BED-877B-8BE79992D12D}" this is found Channel Partner Listing s:ph="Inner Content" /> </d> <d id="{207131FA-F6B2-4488-BCB3-3BF70100B9B8}"> app center placeholder <r uid="{9D07FE7B-AB06-496F-AF3B-F02D185E289C}"> not found <p:d /> </r> <r uid="{ED82E2E5-E7E0-4F43-A875-DA36D3DB9509}" not found p:before="r[@uid='{09539080-F041-4C45-95D3-99F2B070BE40}']" not found s:id="{043679EC-6A0E-4BE1-9CEB-2A09AFDC5844}" mobile channel partner listing s:ph="Inner Content" /> </d> </r>
Simon, I found an answer. There is an FXM variant of $(document).ready (more details here) So solution is to customize SearchBoxView and substitute existed inline js code with FXM-aware js code: <script type="text/javascript"> if (typeof (SCBeacon) != 'undefined' &amp;&amp; SCBeacon &amp;&amp; SCBeacon.push) { // Sitecore FXM SearchBoxView load on ready event SCBeacon.push(["ready", initCoveoSearchBox]); } else { // Sitecore SearchBoxView ioad Coveo.$(function () { initCoveoSearchBox(); }); } function initCoveoSearchBox() { // original inline js code } </script>
Sitecore FXM with Coveo, dynamic html does not seem to render Sitecore 8.1 (160302) I have a client using Sitecore FXM to export HTML/JS/CSS to an external site in order to preserve the same experience outside of Sitecore. The "experience" itself is mostly the header and footer, which contains site navigation and a Coveo for Sitecore Search Box component. The search box works well within Sitecore, but on the external site, the search box is not even appearing. I validated that: All the JS dependencies are loaded All the CSS is loaded The HTML is loaded What I realized is that not all the HTML is renderred, actually is seems like the Razor-inserted HTML is not done properly. By adding the HTML directly in the Chrome console, I managed to re-create my search box, but obviously, the JavaScript events were not attached to it, so the box was useless. Coveo will build an array of components when the page load, and then init these components in order for them to be usable. It seems like that init is never done in this case. Now here is where I am heading: Is it possible that FXM might not always respect the hierarchy of execution when exporting to an external website?
Copy the /sitecore/system/Settings/Rules/Definitions/Elements/System/Web Site Name Put where the current web site name [operatorid,StringOperator,,compares to] [Value,Tree,root=/sitecore/system/Settings/Rules/Definitions/Elements/System/Copy of Web Site Name/Sites, value] into the Text field of /sitecore/system/Settings/Rules/Definitions/Elements/System/Web Site Name Implement your custom condition which can resolve the item by ID because by default WebSiteNameCondition expects your site name as a string using Sitecore; using Sitecore.Diagnostics; using Sitecore.Rules; using Sitecore.Sites; namespace MyProject.SiteConditions { public class WebSiteNameCondition<T> : Sitecore.Rules.Conditions.SiteConditions.WebSiteNameCondition<T> where T : RuleContext { protected override bool Execute(T ruleContext) { Assert.ArgumentNotNull(ruleContext, "ruleContext"); if (string.IsNullOrEmpty(base.Value)) { return false; } var siteItem = Context.Database.GetItem(base.Value); if (siteItem == null) { return false; } var siteName = siteItem["YourSiteField"]; SiteContext site = Context.Site; if (site == null) { return false; } else { return this.Compare(site.Name, siteName); } } } } Put your implementation path to the Type field, in this case it is MyProject.SiteConditions.WebSiteNameCondition,MyProject Result You can select your website as an item in Rule Set Editor when you are using this newly created rule: I suggest you to also read the following article to understand what are these 4 parameters for - https://community.sitecore.net/technical_blogs/b/sitecore_what39s_new/posts/creating-custom-conditions-part-1
Customizing the Personalization Rules How can I change the "where the site name compares to value" personalization rule so that "value" is a list of Sites driven by my configuration? I have a website in multiple languages with multiple hostnames. Each hostname corresponds to a different country and different site definition within my configuration (but each site points to the same place in the content tree). I have named my sites after countries, so: mysite.com resolves to the "United States" site mysite.co.uk resolves to the "Great Britain" site mysite.ca resolves to the "Canada" site What I am looking for is a way to change the "where the current web site name compares to value" to allow for a Dropdown List of "United States", "Great Britain", and "Canada" rather than a raw text field.
It might be perfectly normal that the video does not show while you have Sitecore in edit mode. Sitecore manipulates the page to achieve the in-line editing experience and this might or might not be compatible with the video player in use. After adding your video module, save your changes. Then try switching to the more compatible "preview" mode and check your results. More info on basic editing experience here: Preview a webpage
Rendering Module not displaying video (Sitecore 8.2) On Edit mode, I want to add a video from Global reference. After adding the rendering module, and selecting the video, when the page reloads, the rendering module was added but it's not displaying the video. I'm new to Sitecore, please bear with me. Thanks in advance.
Every Sitecore MVP related questions can be sent to the MVP team: [email protected] Follow the updates of the review and selection process on our Twitter https://twitter.com/SitecoreMVP
What to do if I received the Sitecore MVP recommendations on my office email id and not on the email ID applied through? I have applied for Sitecore MVP through my Gmail account as I have most of accounts, including the Sitecore Developer Network, the rest of the community site and others link to my Gmail account. But some MVP has recommended me through my official email ID. So what should I do? Should I forward the recommendation confirmation email which I have received on my official ID to [email protected]. I can copy the Gmail ID also when I forward the recommendation confirmation email. Please suggest for best move forward.
While a very detailed question, there are still quite many "it depends" open ends. I'm going to make some assumptions based on experience, and give you my view. I'll start by shaking the box to try and do some outside thinking ;-) Shaking the box You don't really want to do page level personalisation on 100k scaling to 1m product pages. You want to do it on persona, brand and hotel meta data. Neither the CMS nor the PMS can do this without search technology Your url structure, something like /brand/hotels/europe/greece/rhodos/la-vida-loca is better suited as a search than a hierarchy. Why? because /brand/hotels/europe/greece/all-inclusive/rhodos/la-vida-loca The fourth option In your above 3, I say none of them really fits. When your product reaches the desired maturity in your PMS, I would ship it off to SOLR. SOLR scales and can handle your traffic load. You're going to need search technology anyway to serve the CMS needs for searching as well. And it can resolve your URL query at a speed that Sitecore could live with. Optionally you could sync in these products via the Data Exchange Framework, and then use Sitecore Content Search to build the SOLR index. But don't do this unless you have specific reason to. In many cases this approach is a little bit like crossing the river to get water. A more likely candidate, is to sync in surrounding meta data around products. That would be brand, region, country information. I would sync in these in their entirety. Use whatever url key is defined in the PMS and store it on the items you create. Finding relevant hotels then becomes a matter of constructing a query based on these url keys. Like q?brand:brand-urlkey-from-field and region:region-urlkey-from-field and so-on-and-so-forth. This query mechanic will also serve your need for pagination, filtering and facetting - something I assume you need but your question does not mention. In the above, you could also use Sitecore ContentSearch LINQ query searching if you must. What's left out In the above, I offer no solution for filtering out unavailable properties. Or not specifically. Since this information updates in near real-time, you should be looking at some form of distributed memory cache technology to keep this cached. Then inject the filter whenever you display search results. I would need more detail on how you have this data available today to offer up a better solution. I also don't mention the actual product page. This is where you need to tweak a bit. Let's assume your canonical url ends up like this: /brand/hotels/la-vida-loca-27122. If your product item was in Sitecore, it would be a matter for the url resolver code to parse the url into the component search query, find the matching Sitecore item (based on the response from SOLR) and set the Context.Item. If the products are not in Sitecore, little changes. Likely you would want different layout per brand and possibly per region and so on. Make this a problem for the Rules Engine. where brand is brand a and country is greece set product-page to /brand a/product page Closing thoughts Make current search query available as ISearchContext Use this to build basic Rules Engine conditions Make current product available as IContextProduct Use this to build basic Rules Engine conditions Use both of the above to achieve personalisation scenarios Abstract your search implementation Don't try too hard to put Sitecore at the center of the world in this setup. It doesn't naturally fit.
Integration with custom-built Product Management System I can use some advice on an interesting architectural challenge for an organization in the travel industry :-) Sorry for the long read... The situation: The company has multiple brands that are all migrating towards Sitecore Information on countries/regions/cities/accommodations/trips is stored in a custom developed Product Management System (PMS) The database contains 100k+ accommodations currently but is expected to grow over time (1 million is not unthinkable) They use the PMS to enrich information received from multiple third-party feeds. Think texts, (hotel) images, key/value pairs, properties and so on. The PMS contains brand-specific information as the accompanying content/images for label A can differ from label B for the same accommodation Not all accommodations/trips are available for all brands PMS data is stored in an MS SQL database The PMS offers an API that can be called to retrieve data I have done quite some research and have also read this article (What are some appropriate uses for Sitecore Data Providers?) extensively. Initially, the client had the plan to keep Sitecore 'dumb' in the sense that they planned to use wildcard pages in Sitecore for countries/regions/cities/accos that directly interact with the PMS API to retrieve the content. As you can imagine this could lead to a lot of inflexibility on the Sitecore end: No specific presentation details for individual pages, so workarounds are required for deviations from the generic wildcard presentation details (also for optimization/personalization) Sitecore Analytics is also a potential drawback. I'm not sure about the experience profile, but for one I know that the Path Analyzer does not handle wildcard items correctly SEO: this is very important for the client. Using wildcard items this should be taken care of in the PMS, which is currently not supported There are three high-level approaches here IMO, with potentially a lot of hybrid variants in between. Keep the wildcard setup, but take measures to counterfeit the inflexibility. Create custom rules that interact with the PMS API to support deviations/personalization on the generic presentation details; Implement a custom data provider Use the Data Exchange Framework to map/transform/synchronize data from PMS to Sitecore items Internally we have a discussion mainly between options 1 and 3. Option 1 would be the easiest to implement. But I'm questioning if this is a sound solution in the long run. Potentially you would have a single accommodation wildcard item with loads and loads of personalization rules. It seems unmanageable from my perspective. If we would choose option 3, other questions arise. How are we going to map PMS to Sitecore? As I said, the company has multiple brands. The approach I'm thinking about now is to create a specific Data Exchange Framework implementation for each of the brands. While highly similar, it allows to prepare the data in exactly the correct format for use within the brand websites. So I would extract only the data relevant for the specific brand, and transform and map it directly to the page structure required for the specific brand. As I mentioned, it would require to sync a lot of data. Other options we thought about: A hybrid solution where we would create the countries/regions/cities manually in Sitecore, and use a wildcard accommodation item below it. The idea is that most deviations from the generic presentation details would be on the country/region/city level and not so much on specific accommodation level. Use option 1, but create specific items for every personalization rule below the wildcard accommodation item. This would require some customizations, but ultimately you would have a list of deviations/personalization rules under the generic accommodation item. Easier to manage, since it would also become possible to use the publication mechanism and publish/unpublish dates I'd love to get some feedback from you guys. How would you handle this?
I don't think you can achieve this via Sitecore ContentSearch API. But Lucene/SOLR does have the ability for dynamic randomised sort fields. <types> ... <fieldType name="random" class="solr.RandomSortField" /> ... </types> <fields> ... <dynamicField name="random*" type="random" indexed="true" stored="false"/> ... </fields> The idea being, you then add sort=random_your-seed to the query, and will get search results back in random order. As long as the seed stays the same, your order will be the same (allowing for paging). When you then generate a new search, just generate a new seed key. References: https://lucene.apache.org/solr/6_3_0/solr-core/org/apache/solr/schema/RandomSortField.html https://stackoverflow.com/questions/25234102/solr-return-random-results-sort-by-random http://blog.tremend.com/2007/05/17/a-z-0-9-custom-sorting-in-lucene/
How to randomize search results I am using Sitecore.ContentSearch library (lucene index). How can I randomize search results before getting results? I have more than 10000 items so I do not want to upload all results to memory and after randomize collection. Also it should support paging.
If you need to add new fonts you can add them in the RTE Profile in the core database: Note that this is the Rich Text Full profile, by default Sitecore is configured to use the Rich Text Default profile: <setting name="HtmlEditor.DefaultProfile" value="/sitecore/system/Settings/Html Editor Profiles/Rich Text Default" /> However, I would recommend that you do not use font styles in RTE, it will make your life more tough in the long term and is not best practice. If the business decides to change the default font then you will have to mnaully go through content and change them. Instead use CSS styles and set the font to use in that stlye declaration. You can link a CSS Stylesheet to the RTE and add your custom styles in there so users can select them. Either update the default css files or link to a custom stylesheet and update the setting in config: <setting name="WebStylesheet" value="/default.css" /> The users will be able to select the styles in RTE then:
Sitecore RTE add new font style I'm going to do some customization with the Rich Text Editor in my sitecore instance I'd like to add another font style in it. Base on what I've read so far I should edit the toolsfile.xml. Reference below. http://docs.telerik.com/devtools/aspnet-ajax/controls/editor/functionality/toolbars/using-toolsfile.xml I've already added the font name in the file but I want to know how will it read the font that I added? Do I need to put the font file somewhere in my instance?
In my attempt to follow the Helix design principles as closely as possible, the issue of Feature-to-Feature module references has come up quite a bit and still remains a bit fuzzy to me. According to the Helix Documentation, these types of references appear to be permitted in some cases, but are generally discoraged. A templates class should never define constants for templates that are not created in the module itself. If a module needs to reference a template or field in another module, it should reference the Templates struct in that module ... The practice of referencing different fields across modules by their shared name – an equivalence to duck typing – is discouraged ... If modules need to share data, consider using design patterns such as providers or pipelines to allow one feature to inject content into another feature. Foundation Providers/Pipelines The examples of using providers or piplines are pretty limited. The only real example I could find in Habitat was in Feature.Search, which calls upon SearchServiceRepository from Foundation.Indexing, which in turn determines what fields are included in the serach as well as how to format results based on IndexContentProviderBase implementations within each feature. This is a rather complex approach that is probably overkill for something as simple as a rendering breadcrumbs for wildcard items or when fields from other Features are required, and this probably explains why Habitat has a //TODO for falling back to Title / DisplayName fields in Feature.Metadata. Following the Foundation.Indexing example in Habitat, you would register a provider or pipeline, from the feature layer, that returns a piece of formatted text when certain conditions are met. For example, this provider/pipeline could have an IsValid() method that determines that it should be used when the context item is a wildcard item (ex: Context.Item.Name == &quot;*&quot;) or when the context item is derived from a Blog template. Since it would be possible for multiple providers/pipelines to be considered valid, I perfer using pipeliens over providers, because you can control the order of how pipelines are executed more easily, and they lend themselves combining values from multiple features. Lastly, the Foundation module would be responsible for running the pipeline (or determining the correct provider), and it can be called from your Breadcrumb feature. &quot;Project&quot; Features The idea here is to move your Breadcrumb rendering and related business logic to the Project layer, thus making it a pseudo-feature that is project specific. In the project layer, it can safely make a reference to any Features it needs (in your case, Feature.Blog). Some may feel that this goes against the definitons of a Project and Feature module, however, for simple logic such as Breadcrumbs, it may be acceptable. Screw it, just make the reference At the end of the day, we are talking about a single reference, so you may determine that re-architecting your solution to avoid referencing a single field from another feature may be overkill. Hopefully there will be more examples around this issue and clearer definitions in the future so that these references can be avoided.
Helix, breadcrumbs and wildcards We have a (mvc) solution based on Helix principles that has a breadcrumb feature. So far, all worked fine and there were no dependencies to any other module. Now we added a new feature (blog) that has a few wildcards. The logic for the wildcards is in the feature as it should. But the breadcrumb for all the url's matching a wildcard is the same - which is logical and understandable but not what we want. The breadcrumb should be able to show the correct data, but only our blog feature knows what that is. Linking from breadcrumb to blog would be the worst idea ever, so that is no option. So I'm looking for ideas on how to solve this.. One possibility that crossed our minds was to create some sort of WildcardContext in the Foundation. The blog feature could add a processor that stores the necessary data in that context. The breadcrumb could read that data while rendering. Would this be a reasonable way to handle this? Or are there (better) alternatives?
You can make use of the Parameters field on the View/Controller Rendering templates to pass in some additional values and then use these in your View/Controller to then run whatever logic you need. You still need to create 3 Rendering definition Items in Sitecore, but they can all point to the same View/Controller, but with the different parameters updated. On the View Rendering/Controller Rendering, set the Parameters field as required, e.g.: Parameters: CssClass=special-highlighting&amp;ExtendedInfo=true Then in your code you can access these parameters: @using Glass.Mapper.Sc.Web.Mvc @using Sitecore @using Sitecore.Mvc.Presentation @model MyProject.Data.Interfaces.IGenericContent @{ RenderingParameters parameters = Sitecore.Mvc.Presentation.RenderingContext.CurrentOrNull.Rendering.Parameters; string cssClass = StringUtil.GetString((object) parameters["CssClass"], "default-class"); bool showExtendedInfo = MainUtil.GetBool(parameters["ExtendedInfo"], false); } <div class="row @cssClass"> <div class="large-12 columns"> <h2>@Html.Glass().Editable(Model, x => x.Title)</h2> @Html.Glass().Editable(Model, x => x.Text) @if (showExtendedInfo) { @Html.Glass().RenderImage(Model, x => x.Image) } </div> </div> (The above example is using Glass Mapper, but it is not a requirement.) The code is using Sitecore Helpers to set a default value if none has been set in the Parameters field. You can do something similar from your Controller as well. Since you have 3 different Rendering Item definitions, you can restrict which rendering can be used in specific placeholders using Allowed Control restrictions.
Change rendering parameters based on placeholder I have a rendering that can be placed in one of 3 placeholders. However, I need to make some changes to the rendering based on which placeholder it appears in. The changes aren't extensive enough to create 3 different renderings. I'm using Sitecore 8.2 w/ MVC.
I think that scripting this task is the way to go in your case. Note that the script below doesn't update all templates' standard values, but only for templates under User Defined. If that doesn't suit you, feel free to adjust the path. $templates = Get-ChildItem 'master:/sitecore/templates/User Defined' -Recurse | ? { $_.TemplateId -eq '{AB86861A-6030-46C5-B394-E8F99E8B87DB}' } foreach($template in $templates) { $standardValuesPath = "master:$($template.FullPath)/__Standard Values" if(Test-Path $standardValuesPath) { $standardValues = Get-Item $standardValuesPath } else { $standardValues = New-Item -Path $standardValuesPath -Type $template.ID $template.'__Standard values' = $standardValues.ID } $standardValues.'__Enable item fallback' = $true }
How to Enable Item-level language fallback on all templates in Sitecore 8.x Presently I'm working on Sitecore 8.1 Update-1. We have enabled Item-level language fallback on shell and website as suggested on Configure language fallback - Sitecore Documentation. It seems after this we need to go to each template and enable the Item-level language fallback. It involves generating __Standard Values if its not there and then manually change the flag for item fallback [screenshot below]. I have found this Sitecore PowerShell script on this blog post which switches the Item-level fallback flag but here I will also require to generate __Standard Values on template. (Get-Item master: -Query "/sitecore/templates//*[@@name='__Standard Values']")| ForEach-Object { $_.Editing.BeginEdit() $_.Fields["__Enable item fallback"].Value = "1"; $_.Editing.EndEdit() } I'm trying on optimizing this process since same process has to be followed on multiple environments. How one can go for this with minimum impact/steps?
Upon further research I found that the problem is not in the value of parameter (Item vs Version). The code in VersionPublishingRestricted class is perfectly okay. It first checks if there are warnings on item level, and if there aren't any then it goes on to check the version level. In my opinion, one other pipeline (Sitecore.Pipelines.GetContentEditorWarnings.ItemPublishingRestricted) should be displaying warnings on items whose ancestors are not publishable. But, that pipeline looks only at that particular item and doesn't look up the tree, so it looks like in Sitecore 8.2 they have given up on those warnings. My answer to this problem is creating a custom pipeline processor that handles the situation where item itself is publishable but one of its ancestors is not. Here's the code: using System; using Sitecore.Data.Items; using Sitecore.Publishing.Explanations; using Sitecore.Publishing.PublishingInformation; using System.Linq; using Sitecore.Pipelines.GetContentEditorWarnings; namespace ABC.Sitecore.Website.Pipelines.GetContentEditorWarnings { public class ItemPublishingRestrictedOnAncestor { public void Process(GetContentEditorWarningsArgs args) { Item obj = args.Item; if (obj == null || PublishingInformationBuilder.GetPublishingInformation(obj, PublishingInformationLevel.Item).OfType<Error>().Any<Error>()) { // A call to PublishingInformationBuilder.GetPublishingInformation is needed because that is the area covered by standard ItemPublishingRestricted processor. // So, if that processor will display a warning that the item is not publishable then we don't have to go on and do our processing. return; } DateTime utcNow = DateTime.UtcNow; // IsPublishable with second parameter "true" will go up the tree and check if all ancestors of this item are publishable. if (!obj.Publishing.IsPublishable(utcNow, true)) args.Add("This item will not be published because \"Publishable\" option is disabled on one of parent items.", string.Empty); } } } And the config file (e.g. App_Config\Include\ItemPublishingRestrictedOnAncestorPipeline.config): <?xml version="1.0"?> <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <pipelines> <getContentEditorWarnings> <processor type="ABC.Sitecore.Website.Pipelines.GetContentEditorWarnings.ItemPublishingRestrictedOnAncestor, ABC.Sitecore.Website" /> </getContentEditorWarnings> </pipelines> </sitecore> </configuration>
Not publishable warning on descendant items We're on Sitecore 8.2. We have recently moved from Sitecore 6.6 to 8.2. In Sitecore 6.6, if the parent item is marked as "Never publish" I get a warning in Content Editor on that item saying "This item will never be published because its "Publishable" option is disabled.". I also get a warning on all of its descendants, saying "If you publish now, the selected version will not be visible on the Web site. No other version will be published.". Descendant item does not have "Never publish" marked, but I'm still getting a warning because one of its ascendants up the tree has "Never publish" marked. And that's fine, I really like that feature. However, in Sitecore 8.2 I'm getting the warning only on the parent item. There is no warning on its descendants. In Sitecore 6.6 I found that Sitecore.Pipelines.GetContentEditorWarnings.VersionPublishingRestricted is responsible for generating that message and I can see that at one point it calls obj.Publishing.IsPublishable(now, true);. The second parameter "true" causes that function to check if ancestors are publishable too, which is a desired functionality. But when I look at VersionPublishingRestricted pipeline in Sitecore 8.2 I see it's very different and can't really be compared directly to 6.6 code. Sitecore 8.2 processor looks like this: namespace Sitecore.Pipelines.GetContentEditorWarnings { public class VersionPublishingRestricted { public void Process(GetContentEditorWarningsArgs args) { Assert.ArgumentNotNull((object) args, "args"); Item obj = args.Item; if (obj == null || PublishingInformationBuilder.GetPublishingInformation(obj, PublishingInformationLevel.Item).OfType<Sitecore.Publishing.Explanations.Error>().Any<Sitecore.Publishing.Explanations.Error>() || obj.Versions.GetVersions(false).Length == 0) return; Sitecore.Publishing.Explanations.Error[] array = PublishingInformationBuilder.GetPublishingInformation(obj, PublishingInformationLevel.Version).OfType<Sitecore.Publishing.Explanations.Error>().ToArray<Sitecore.Publishing.Explanations.Error>(); Sitecore.Publishing.Explanations.Error error1 = ((IEnumerable<Sitecore.Publishing.Explanations.Error>) array).FirstOrDefault<Sitecore.Publishing.Explanations.Error>(); if (error1 == null) return; GetContentEditorWarningsArgs.ContentEditorWarning warning = args.Add(); warning.Title = error1.Message; warning.Text = error1.Remarks; VersionNotInFinalWorkflowStepError error2 = error1 as VersionNotInFinalWorkflowStepError; bool flag = false; if (error2 == null) { flag = true; error2 = array.OfType<VersionNotInFinalWorkflowStepError>().FirstOrDefault<VersionNotInFinalWorkflowStepError>(); } if (error2 == null) return; if (flag &amp;&amp; error2.Remarks != null &amp;&amp; (warning.Text != null &amp;&amp; warning.Text.IndexOf(error2.Remarks, StringComparison.InvariantCultureIgnoreCase) < 0)) { GetContentEditorWarningsArgs.ContentEditorWarning contentEditorWarning = warning; string str = contentEditorWarning.Text + " " + error2.Remarks; contentEditorWarning.Text = str; } this.AddOptions(warning, error2); } private void AddOptions(GetContentEditorWarningsArgs.ContentEditorWarning warning, VersionNotInFinalWorkflowStepError error) { foreach (string header in (IEnumerable<string>) error.TargetsList.OrderBy<string, string>((Func<string, string>) (x => x), (IComparer<string>) StringComparer.InvariantCultureIgnoreCase)) warning.AddOption(header); } } } I can see it's calling PublishingInformationBuilder.GetPublishingInformation two times. First it calls it inside IF, to see if there are any errors at all, and the second time it calls it to fetch the array of errors. The difference is that the first time it's sending PublishingInformationLevel.Item as parameter value, and the second time it's sending PublishingInformationLevel.Version. When I go to the source of PublishingInformationBuilder.GetPublishingInformation I can see that if it's called for the Version then it actually has a code for checking ancestors (it calls version.Publishing.IsPublishable(utcNow, true);), and if it's called for the Item then it doesn't do that. So, I suspect that this might be a bug, that PublishingInformationBuilder.GetPublishingInformation should be called with PublishingInformationLevel.Version both times in this pipeline processor. My next step will be to copy that standard processor into my own processor and try to fix the bug, but I just wanted to first see if anyone here has encountered this and perhaps already has a fix for it.
I don't see a reason to use the Contact Manager—it works with the Shared Session and only then with the Collection Database. Just using the Contact Repository should be enough in your case, as it reads and writes data directly from the Collection DB. public void SetContactData(string username) { LeaseOwner leaseOwner = new LeaseOwner("YOUR_WORKER_NAME", LeaseOwnerType.OutOfRequestWorker); ContactRepositoryBase contactRepository = Factory.CreateObject("contactRepository", true) as ContactRepositoryBase; // Attempt to obtain an exclusive lock on an existing contact in xDB. LockAttemptResult<Contact> lockResult = contactRepository.TryLoadContact(username, leaseOwner, TimeSpan.FromMinutes(1)); Contact contact = null; if (lockResult.Status == LockAttemptStatus.AlreadyLocked) { // Another worker or a live web session has an exclusive lock on the contact. // You can't use this contact right now. It's up to you what to do in this case. /* ... */ } else if (lockResult.Status == LockAttemptStatus.DatabaseUnavailable) { // Database is down. Try to handle this gracefully. /* ... */ } else if (lockResult.Status == LockAttemptStatus.NotFound) { // A contact with the given identifier doesn't exist. // Just create a new contact object. contact = contactRepository.CreateContact(Guid.NewGuid()); // Identify it. contact.Identifiers.Identifier = username; // And make it known. contact.Identifiers.IdentificationLevel = Sitecore.Analytics.Model.ContactIdentificationLevel.Known; } else { // We successfull locked an existing contact. contact = lockResult.Object; } // Set some contact facets: /* ... */ // Save the contact and release the lock. if (contact != null) { var options = new ContactSaveOptions(release: true, owner: leaseOwner); contactRepository.SaveContact(contact, options); } } Note that there are some edge cases that you should decide yourself how to handle. I left comments in the code above.
How to create or update list of contacts in xdb? What I am trying to do is: get or create a contact in xDB by identifier update its facets save the contact to xdb (not to session) I am running Sitecore 8.2 and I am using this extended contact repository https://briancaos.wordpress.com/2015/10/09/sitecore-contacts-create-and-save-contacts-directly-to-and-from-xdb-mongodb/ Trying to debug.. after this code Contact createdContact = CreateContact(userName, contactRepository); contactManager.FlushContactToXdb(createdContact); when calling Contact contact = contactRepository.LoadContactReadOnly(userName); the contact is always null. Also nothing flushes to mongoDB. methods contactManager.FlushToXdb(contact) or contactManager.SaveAndReleaseContactToXdb(contact) simply don't flush anything. What can be wrong? I can confirm that this code worked fine on Sitecore 8.1 update 2
This answer is for Lucene, but as Solr is based un Lucene I'm expecting to have very similar result on it Like: This one does a fuzzy search. It gets the top terms most similar to the term you introduced and then gives you the documents containing these terms. The similarity can be adjusted. It is based on the Damerau-Levenshtein (optimal string alignment) algorithm. This is is a heavy operation, but it safe to be executed. It's translated to: fieldname:value~0.5 (The number represent how similar the terms are, from 0 to 1) Matches: It expects a regular expresion instead of a term to match documents. If you use "plain text" it performs like "equals". MatchWildcard: It looks for terms containing the referenced text, then it creates a query for any of the terms found. I discourage this method as it usually triggers a "too many clauses" exception. Let's say it translate each word found in the whole index for that field into o field == word 1 or filed==word2, etc. By default Lucene only support 1024 clauses. It can be modified in the config file, but it will affect performance. By default, I recomend the like search to return more related result and with a safe execution than this one. The query is translated to field:*text*. Contains: It performs a matchwildcard StartsWith/EndsWith: It's like the matchwildcard but only at the beginning or end of the term: The query is translated to field:*value / field:value*As terms are index alphabetically based on each character from start to end, "starts with" performs much better as it can identify the terms easily within the index while "Ends with" forces Lucene to transverse the whole term set to identify those "matching terms". Equals: This is the basic search and is term based. It will return only documents with the whole "word". The query is translated to: field:value
In the ContentSearch Linq API what is the difference between the different string matching methods? The Sitecore ContentSearch Linq API provides several methods that can be used to search against string fields in different ways: Like Matches MatchWildcard Contains StartsWith/EndsWith From the doc site I have been able to get a vague sense of the purpose for each and I have successfully used some of these in the past, but I have not found a clear comparison anywhere. When should I use each of these methods? Is there a significant difference in performance between any of them? Is there any notable difference in how they behave with different search providers?
To ensure that new images are served, and not old ones from cache, you "cache bust" the images to include a revision parameter. Create a new class, inheriting from the old one and append the revision or the modified date: using Sitecore.Data.Items; using Sitecore.Diagnostics; using Sitecore.Resources.Media; namespace MyProject.CMS.Custom.Media { public class MediaProvider: Sitecore.Resources.Media.MediaProvider { public override string GetMediaUrl(MediaItem item) { Assert.ArgumentNotNull((object)item, "item"); return this.GetMediaUrl(item, MediaUrlOptions.Empty); } public override string GetMediaUrl(MediaItem item, MediaUrlOptions options) { Assert.ArgumentNotNull((object) item, "item"); Assert.ArgumentNotNull((object) options, "options"); string mediaURL = base.GetMediaUrl(item, options); mediaURL = Sitecore.Web.WebUtil.AddQueryString(mediaURL, new string[] {"revision", ((Item)item).Statistics.Revision }); //OR mediaURL = Sitecore.Web.WebUtil.AddQueryString(mediaURL, new string[] {"modified", ((Item)item).Statistics.Updated.ToString("yyyyMMddHHmmss") }); return mediaURL; } } } Update the config to point to your new class. <mediaLibrary> <mediaProvider> <patch:attribute name="type">MyProject.CMS.Custom.Media.MediaProvider, MyProject.CMS.Custom</patch:attribute> </mediaProvider> </mediaLibrary> As @Gatogordo mentions in his answer, you should leave DisableBrowserCaching=true especially if you have dynamic pages which should always be served from the server. Make sure you have the cache settings configured on the controls in Sitecore so server side caching is optimal. The MediaResponse.Cacheability will depend on whether you are using any content delivery networks, but generally public is a fairly safe configuration for optimal caching downstream. Combined with the code above, any updates to media should be reflected to the user without any issues.
MediaResponse.Cacheability and DisableBrowserCaching To achieve better performance of website, I have browsed some of the web sites and observed that by updating following settings in Sitecore.config we will achieve this. By doing following changes, will there any effect in website, effect means: even after uploading new images, old images will display on website from cache like that? Please help in this.. <setting name="DisableBrowserCaching" value="false"/> <!-- Initially it will be true --> <setting name="MediaResponse.Cacheability" value="public"/> <!-- Initially it will be private --> Adding Etags in web.config - <httpProtocol> <customHeaders> <remove name="cacheControlHeader" /> <add name="ETag" value="&amp;quot;&amp;quot;" /> </customHeaders> </httpProtocol>
The combination you described should be entirely possible. I encountered the same problem when implementing an FXM solution that triggered goals in Sitecore 8.2. Essentially there is a bug with the Rule OutcomeWasRegisteredDuringPastOrCurrentInteractionCondition The solution in this ticket mentions the fix in details for Sitecore 8.1 through to initial release of Sitecore 9. You can find a github C# example here. Once you implement the rule (with the fix) in C# you must edit the Sitecore item to point to the C# class you implemented. /sitecore/system/Settings/Rules/Definitions/Elements/Visit/Goal was triggered during a past or current interaction My solution also made an additional fix so that when the rule is executed if the Sitecore.Current.Session.Interaction is null it will use Tracker.Current.Contact instead to execute the rule. It does this via LoadHistorycalData and KeyBehaviourCache.
Goal combinations not working in Sitecore I'm trying to show personalized banners on an external site using Sitecore FXM. The ext. site has 3 pages - Home, Services &amp; Feedback. The banner is to be shown on Home page. Conditions: If user has visited Home page for the first time - Show banner1 If user has visited Services and Feedback pages - Show banner2 Things I have performed in sitecore: Created 2 page filters - services &amp; feedback. Created 2 respective goals - visited services &amp; visited feedback. These do not have any rules. Just plain goals. Assigned goal to respective page filter using Manage FXM functions. Personalization rules for the banner rendering: Rule 1: (show banner2 if true) where visited services is triggered in past or current interaction and the elapsed days is less than or equal to 30 and the interactions is greater than or equal to 0. and where visited feedback is triggered in past or current interaction and the elapsed days is less than or equal to 30 and the interactions is greater than or equal to 0. Default: (show banner1 if Rule1 is false) Output: In the ext. site, it always renders banner1. But if for rule 1 , if I just apply one condition (visited services), and then from home page, visit services page and back to home, it shows banner 2. Where am i going wrong. Will multiple goals in a condition not work. Is there any other way. It would be much easier writing a code in a controller rendering, but did not find any helpful information about how we can track if a user has achieved a goal, using code. I'm a beginner and like to stay away from decompiling yet. Using Sitecore 8.2
You need to implement strict OO design principles in order to isolate the different problems. If you create the necessary “hooks”, you can later expand on the functionality. First, you know you need something like a BaseUserSearchProfile that can be feed to your search implementation, even though you don’t know the exact content you can still model this behavior. Secondly, you could create an “Anonymous” user in Sitecore, that you automatically log in via your own login pipeline, when a user visits – you extent the user with the BaseUserSearchProfile to emulate the final setup. This means, that your code is ready to be expanded with profiles when you know what to react to – and the known search features can be implemented - it would be the same for all visitors, until login page is developed.
Functionalities to develop in Sitecore page We are in the starting stage of the project. The requirement is to develop the different functionalities in parallel. Few of the basic modules are Login Search View details etc. Now the problem is, client is not finalized the requirement on the Login, so they want us to start with the Search functionalities. As per the design, during login, profile will be set in the sitecore(using profile provider) and some of the profile values needs to be used in the Search functionality. As customer asked us to start with Search, these profiles will not be available in the sitecore. We are having hard time thinking how we will be able to implement this. Also, customer wants have that functionality before implementing the Login. Can anyone please en-light us on the approach that we have to taken. If we cannot deliver in that way we can go back and tell them. For that i need some strong points.
You can use item versions and publishing restrictions. With publishing restrictions you can set a time frame(start and end) for when and item version is active
Schedule Items to display in Rendering Datasource So I have a Rendering, it takes a data source, but there is a requirement to schedule a specific data source item to show up for that rendering between a given time frame. Is that possible within Sitecore? I know you could use the personalization rules engine to achieve something similar, but it's not as intuitive as I would like. Is there any other options?
You need to configure the hostnames in the portal (or via PowerShell) first. This will involve a DNS validation step so you will need access to your DNS provider as well. You only need hostnames in the Sitecore Config if your system needs to differentiate site content between several domain names. If it's just the one, you only need to configure the Azure website. PS Azure Website-grade PaaS is only officially supported from 8.2.1 Be careful when running multiple instances as there are Sitecore components that use the file system for storage and Azure PaaS had a shared filesystem across instances.
Hostname bindings for IIS in Sitecore Azure PaaS For Sitecore Azure (up to 8.1) how are the hostnames configured for Azure PaaS CD environments? Is this something which happens automatically based on settings found in Sitecore.config/Web.config?
The value of the checkbox is set on a per user basis and stored against their profile (which means it is remembered across sessions and browsers/computers). Force Field Validation to be Enabled To force this checkbox to be enabled, you can set it against the user profile when they log in. using Sitecore.Diagnostics; using Sitecore.Pipelines.LoggedIn; using Sitecore.Security.Accounts; using Sitecore.Web.UI.HtmlControls; namespace MyProject.CMS.Pipelines.LoggedIn { public class UserLoggedIn { public void Process(LoggedInArgs args) { User user = User.FromName(args.Username, true); Assert.IsNotNull(user, "user"); Registry.SetValue("/Current_User/Page Editor/Capability/FieldsValidation", "on"); // Sitecore.ExperienceEditor.Constants.CheckboxTickedRegistryValue can also be used // as a constant to "on" but you'll need to add a reference to the DLL } } } Then patch this into the loggedin pipeline: <sitecore> <processors> <loggedin> <processor mode="on" type="MyProject.CMS.Pipelines.LoggedIn.UserLoggedIn, MyProject.CMS" /> </loggedin> </processors> </sitecore> Force Checkbox to be Disabled Edit the JS file located in /sitecore/shell/client/Sitecore/ExperienceEditor/Commands/EnableFieldsValidation.js and update the canExecute function to return false: canExecute: function (context) { return false; }, The checkbox should now appear checked and not changeable. You may have to force refresh the browser cache to pick up the updated JS file.
Set Default Value of Ribbon Checkbox I recently discovered a checkbox on the "View" ribbon of the Experience Editor in Sitecore 8.1. This checkbox is used to display validation errors, but it is not checked by default. How would I go about enforcing the following: The checkbox is checked by default The checkbox cannot be unchecked (my thinking is to just deny the read/write permission for this button. I just need to make sure it's checked first).
Admittedly I'm not entirely sure what you're aiming for, but some general points that may be relevant: Administration within a sitecore security domain. If you want to allow each domain to administer itself without being able to interact with other domain roles, you may need them to be separate. If using locally managed domains, An admin of a domain can manage users within that domain only and assign roles from that domain. They can't see roles or users from other domains. Global roles Global roles are useful when you want an a role that is visible to all security domains. They are defined in \App_Config\Security\GlobalRoles.config. If you are carefully limiting roles that can be assigned within a domain, something you may want to do is to remove the default global roles so that only the roles you create within a domain are visible. I know that I can assign roles from different domains to a user, but are there any negatives of doing this? If using locally managed domains I think only a real admin can do this, unless the roles are defined as Global Roles. If you want to safely delegate role assignments to user admins, then you either need to make the global roles or use roles within each domain.
How to best use Roles and Domains with Multi-site SSO Background We have an upcoming multi-site project, in which our client would like us to implement a "restricted" SSO wherein the users of mainsite.com that have been given access to employees.mainsite.com will only have to log into one of the two sites to be logged into both. Note that all users must first become members of mainsite.com before they can be given access to employees.mainsite.com. Most of the SSO has been worked out, and I am planning to use the same domain for users of both sites. Since all users would be created on mainsite.com first, I would simply use a security Role on the employees domain to allow access to the employees.mainsite.com. Question I know that I can assign roles from different domains to a user, but are there any negatives of doing this? Also, if a user with a given role is meant to have access to a site with a different security domain, are there any special security or configuration concerns that I should be aware of?
You can add stuff here: /sitecore/content/Applications/Content Editor/Context Menues/Default and seeing the path I would assume it is called a "Context Menu". After your command and screenshot: you'll need to go here in the core database: /sitecore/content/Applications/Content Editor/Gutters Apparently they are just called "Gutters". All existing ones have that name also in their namespace.
Where can I customize the content tree gutter flyout/context menu? When you right-click in the left gutter of the Content Tree in the Content Editor, a really handy context menu appears with some "command shortcuts" (for lack of a better term). Does anyone know where in the core database the "buttons" for this context menu are controlled? Bonus points to anyone who can also tell me the real name for this thing, because I can't seem to find it anywhere.
You can use the Domain Manager within Sitecore to create new security domains. From the Sitecore Desktop: Start > Security Tools > Domain Manager From there, you can setup your Sitecore Roles specifing your new domains, then assign users to the Domain Role.
How to create multiple Sitecore Security Domain We want to create multiple Sitecore security domains for different groups and their users. Can you advice as how to achieve this?
I see two valid approaches for this. Either Inject "fake results" that correspond to ads and add an underscore template to match those results, either using a server-side preprocessing or client-side PreprocessResults Client-side, using a simple underscore trick that does not mess with the results at all. Here is a quick example I came up with for the second scenario: <script class="result-template" type="text/underscore"> <div class="coveo-result-frame"> {{ if(index % 4 == 0) { }} <div class="coveo-result-row my-ad-row"> Here is my AD </div> {{ } }} ... // Your normal result template </div> </script> I then added this style here to make it look like a real result: .my-ad-row { padding: 0px 0px 20px 0px; border-bottom: 1px solid #BCC3CA; } Here is what it looks like:
Coveo pin items between results Using Coveo UI's SearchView.cshtml, Is there a way in Coveo to pin external items into results list in certain order? Basically I am trying to insert ads between search results list. I have n no. of ads that need to go between every 4 non-ad result item. Any pointers on the best approach to this? Update: I am trying to use CoveoProcessParsedRestResponseArgs to insert ads into the ResultsRespnse object. The challenge I see is, it does not give me the search result page or firstResultIndex in the response to accurately insert ads on subsequent pages. Is there any other pipeline processor that I need to use?
I already had the same issue and following how you I solved it: Navigate to the following file path: ..\Website\Views\Form\EditorTemplates\FormModel.cshtml Update the following lines: if (Model.SuccessSubmit) { @Html.Raw(!string.IsNullOrEmpty(Model.SuccessMessage) ? Model.SuccessMessage : Translate.Text("Default success message.")) //@Html.Encode(!string.IsNullOrEmpty(Model.SuccessMessage) ? Model.SuccessMessage : Translate.Text("Default success message.")) return; }
Confirmation message in WFFM in Sitecore We are using Web Form for Marketers in Sitecore 7.2 with MVC. We are using one field of the form to show thank you message. <p> Thanks for Submission </p> <p> You have successfully subscribed to our news letter</p> But it shows a message like follows <div class=&quot;wfm-thank-you&quot;> <p>Thanks For Submission</p> <p>You have successfully subscribed to our newsletter</p> <p> It shows HTML tags with a message. Anu suggestion will be helpful.
Try this. Add references: Sitecore.DataExchange.Local,Sitecore.Services.Core,Sitecore.Services.Infrastructure, Sitecore.Services.Infrastructure.Sitecore. Create a custom repository class based on InProcItemModelRepository. public class CustomRepository : InProcItemModelRepository { public override Guid Create(string itemName, Guid templateId, Guid parentId, string language) { var parentItem = base.Get(parentId); if (parentItem == null) { return Guid.Empty; } var path = parentItem[ItemModel.ItemPath].ToString(); // var itemModel = new ItemModel(); itemModel[ItemModel.ItemName] = itemName; itemModel[ItemModel.TemplateID] = templateId.ToString(); var handler = base.HandlerProvider.GetHandler<CreateItemHandler>(); var command = new CreateItemCommand { ItemModel = itemModel, Path = path, Language = language }; var response = handler.Handle(command) as CreateItemResponse; return response.ItemId; } public override bool Update(Guid id, ItemModel itemModel, string language, int version) { var handler = base.HandlerProvider.GetHandler<UpdateItemHandler>(); var command = new UpdateItemCommand { Id = id, Database = base.DatabaseName, ItemModel = itemModel, Language = language, Version = version.ToString() }; handler.Handle(command); return true; } } Add you config. You need replace repository with your custom. <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <dataExchange> <itemModelRepository type="Custom.DataExchange.CustomRepository, Custom.DataExchange", patch:instead="processor[@type='Sitecore.DataExchange.Local.Repositories.InProcItemModelRepository, Sitecore.DataExchange.Local']"> <databaseName>master</databaseName> </itemModelRepository> </dataExchange> </sitecore> </configuration> Example: var repo = (CustomRepository)DataExchange.Context.ItemModelRepository; var templateId = new Guid("{A0691A54-6175-4C10-9E10-9A1FA0134517}"); var parentId = new Guid("{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}"); var itemId = repo.Create("My Product", templateId, parentId, "de"); repo.Update(itemId, new ItemModel() { { "ProductName", "My Product Name" } }, "de", 1);
How to add sitecore items with different language version by using Data Exchange framework I have a requirement where I need t convert the data in to sitecore items. Each data has its own language content. so I want to move the data from source to sitecore as shown in the below create sitecore items with language versions update those items frequently Any reference or code sample to insert the sitecore items with language versions?
You need to inherit from Controller, not SitecoreController. SitecoreController is Sitecore's own controller (duh, hehe) used for Sitecore's View Rendering components - but is not the one you are meant to inherit from for your own Controller Rendering components. See also: How To Make Sitecore Use a MVC Controller, Controller Renderings Explained
Error with controller rendering - "does not implement IController" Using Sitecore 8.2 I have multiple MVC projects in a VS Solution. For each project, I remove the RouteConfig.cs, but for one, I forgot and clicked on publish. (I'm not sure if thats the reason for the error). Now the page thows this error - The controller for path '/en/home' was not found or does not implement IController. I removed the RouteConfig.cs and published again but no luck. Also, none of the MVC projects have Global.asax included. I also tried giving the full path in controller rendering. Controller: Sitecore.Feature.Teasers.Controllers.TeasersController, Sitecore.Feature.Teasers Controller Action: RenderTeaser TeasersController.cs namespace Sitecore.Feature.Teasers.Controllers { public class TeasersController : SitecoreController { // GET: Teasers public ActionResult RenderTeaser() { IEnumerable<Item> teasers = GetTeasers(); return View("~/Views/Teasers/Teasers.cshtml", teasers); } } } How can I fix this. Thank you.
In Sitecore configuration you can find <controlSources> section. It contains all the namespaces Sitecore parses when it looks for content:ClassName in a field definition (like Date in your example). That's why Sitecore finds Sitecore.Web.UI.WebControls.Date class and uses it for the DateTime field. One good example of how this can be extended is in Sitecore.Buckets.config: <controlSources> <source mode="on" prefix="contentExtension" namespace="Sitecore.Buckets.FieldTypes" assembly="Sitecore.Buckets" /> <source mode="on" namespace="Sitecore.Buckets.Controls" assembly="Sitecore.Buckets"/> </controlSources> prefix="contentExtension" part says that field definition will have another prefix instead of the default content. So if you check Multlilist with Search field, you will see there contentExtension:BucketList value of the Control field.
Template field type - Control I have created a custom field type and it's working good. Here is the screenshot of how its looks in core database. All i filled in for template field type Template is Assembly and Class fields. Here is the screenshot of sitecore's default date field type. Like you see the difference, i am not using "Control" field for my custom field type and sitecore default field is not using Assembly and Class fields. So, my questions are what's the use of "Control" Field? How sitecore default date field working with out "Assembly" and "Class" fields?
The only place I can see page events for SC8 is in the Fact_Conversions table. There is a field GoalId that has a foreign key to the PageEventDefinitions table. All the triggered page events should be stored in there. Remember that 2 things have to happen for it to get there. First the data must be written to MongoDb once the users session ends. Also the aggregation service needs to run to aggregate all the Mongo data into the reporting DB.
How can I create a custom Page Events report in Sitecore 8? I wanted to create a report on particular page events. In Sitecore 7.2 we had a PageEvents table; in Sitecore 8 xDB, this table seems to be missing from the Reporting DB. I checked the Interactions collections in MongoDB, and each interaction has a page associated and every page has various page events. As specified in documentation, reporting should come from the Reporting DB. Are we missing the PageEvents table in Reporting DB?
Just recently had a conversation about the same issue on a Sitecore 8.0-4 instance of xDB Cloud 1.0. The client was having issues with latency when mongoDB became unavailable and I was confused on why as the only time their instance was calling into mongoDB was on initial login. Login seemed to be fine but the application was very slow when mongoDb was unavailable. Since the only time the application should be communicating with mongoDB was on initial Contact Identification and on Session End, my assumption was performance shouldn't impact current session tracking. After speaking with Sitecore, they have released a KB Article explaining potential causes to the Content Delivery Server if mongoDB becomes unavailable. Some recommendations are Update mongoDB to 3.0 and use WiredTiger storage engine for performance improvements. "May want to verify this with Sitecore but I think xDB Cloud 2.0 is configured with this architecture. Decrease the mongoDB Connection Timeout's, ex. connectTimeoutMS=2000&amp;socketTimeoutMS=2000. To make this change for xDB Cloud 1.0, you need the following patch: Sitecore.Support.155426. For xDB Cloud 2.0 you shouldn't need the patch, just change the connection string to something other than default. This is the link to the article for more indepth explaination of how Sitecore communicates with MongoDB: https://kb.sitecore.net/articles/930657
Gracefully Handle xDB Cloud 2.0 Connectivity Issues - Controlling connection timeout Similar to the situation described in this post regarding Solr, we recently had an issue in which our connection attempts to the xDB Cloud 2.0 service were adding hundreds of megabytes of 504 errors to the logs, crippling the site with timeout errors all over the place and effectively taking the site down until an app pool recycle was manually performed. I am currently discussing the issue with Sitecore support, in order to ensure that nothing on our end caused this, but this seems highly unlikely since the issue occurred on both CD servers at the same time. In either case, I would like to know if there is a way to ensure that the site remains stable in the event of xDB timeout errors. At this point, my only real guess at how this could be done is to control the amount of time between connection attempts. Does anyone know if this could be done or any other (perhaps better) ways of doing this? Version info: Sitecore 8.1u2, xDB Cloud 2.0
The error was fixed by adding a green check box for the "Workflow State Write" permission for each of the Writable workflow steps.
Lock and Edit - Object reference not set to an instance of an object When I click on "Lock and Edit" I am getting the following error: Object reference not set to an instance of an object. [NullReferenceException: Object reference not set to an instance of an object.] Sitecore.Shell.Framework.Commands.CheckOut.Execute(CommandContext context) +297 Sitecore.Shell.Framework.Dispatcher.Dispatch(Message message, CommandContext context) +209 Sitecore.Shell.Applications.ContentManager.ContentEditorForm.HandleMessage(Message message) +1713 Sitecore.Shell.Framework.Commands.MessageCommand.Execute(CommandContext context) +152 Sitecore.Web.UI.Sheer.ClientPage.OnPreRender(EventArgs e) +547 Sitecore.Shell.Applications.ContentManager.ContentEditorPage.OnPreRender(EventArgs e) +25 System.Web.UI.Control.PreRenderRecursiveInternal() +113 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4297
I think you have run into a Known Issue with Sitecore. With 8.0 update 6 and 7, 8.1 update 1, and 8.2, there is an issue that prevents pages with rules from being saved in the Experience Editor. There is a workaround, where you can edit and save the rules in the Presentation > Details section, or remove all of your rules before saving. Here is a link to the documentation. Hope this was of help!
Error saving search page after adding filter rule to tab I am setting up a search page, but I'm getting an error when hitting save on the tab component, after adding a filtering rule. If I remove the rule, it saves fine. The rule is simple. just filter by a particular template type: When saving the page in experience editor (not when clicking OK to the dialog) I see: Looking at the Sitecore log, I can see the following: 27008 16:28:37 ERROR After parsing a value an unexpected character was encountered: {. Path 'scLayout', line 2, position 14. Exception: Newtonsoft.Json.JsonReaderException Message: After parsing a value an unexpected character was encountered: {. Path 'scLayout', line 2, position 14. Source: Newtonsoft.Json at Newtonsoft.Json.JsonTextReader.ParsePostValue() at Newtonsoft.Json.JsonTextReader.ReadInternal() at Newtonsoft.Json.JsonTextReader.Read() at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) at Sitecore.ExperienceEditor.Speak.Server.Requests.PipelineProcessorRequest`1.Process(RequestArgs requestArgs) So it seems like something in the rule cannot be parsed as JSON?
I would use a different field for your computed field, so it's easier to boost. if this is not possible, you'll have to use some tricks, as you can't distinguish the values coming from a different field. The trick: Add a token to your value so you can identify and boost it Assuming that for some reason you need the original value of your taxonomy, add a duplicated value to your value with a special token, then boost the search for that term: Let's say that your computer field now returns &quot;taxonomy1&quot;; modify your code to return &quot;taxonomy1|mytokentaxonomy1&quot; On your search, add an &quot;or&quot; with the &quot;extra&quot; value. var queryPredicate = PredicateBuilder.True<SearchResult>(); queryPredicate = queryPredicate.And(i => i.YourField.Equals(&quot;taxonomy1&quot;) || i.YourField.Equals(&quot;mytokentaxonomy1&quot;).Boost(50)); This way, you are sure that the value you are generating with your computed field is boosted. If you don't need the original value, you can just use the special value.
Boosting a computed index field in _content I have created a computed index field for our custom Lucene search index, and I have noticed that the contents do not get automatically added to the "_content" field in Lucene. I would like to be able to search "_content" and find results that match any field including my computed index field. I've read that I can add my computed field as part of "_content" just by naming it _content in the config: <fields hint="raw:AddComputedIndexField"> <field fieldName="_content">Project.Domain.Search.ComputedFields.PageTaxonomies, Project.Domain</field> </fields> I would like to boost any search results where the search terms are found in PageTaxonomies. But where can I apply the boost for this field if the field has the same name as _content? Any help appreciated!
Up until Sitecore 7.2, it was possible to use Oracle instead of SQL Server as a fully supported and alternative database. You can find more details in the Sitecore Compatibility Matrix. The databases were included as part of the regular zip of the webroot which could be download from https://sdn.sitecore.net/default.aspx. Oracle is not supported in Sitecore 8.0 or 8.1, but it is supported again in 8.2 when run in CMS only mode. In this case, Core Databases (master, web, core) are available as a separate download. If you intend to use Oracle for the Core db, please download the following file and check the installation guide for instructions on how to install and configure Oracle. My guess if your confusion is around the wording on the download page, between Sitecore.Core database and "Core databases required to run Sitecore". Additionally, if you check a default installation of Sitecore 8.2 and \App_Config\ConnectionStringsOracle.config file then you will find core, master and web connectionstrings specified. If your question is "Why would anyone want to use Oracle instead of SQL Server" in general, then this is the wrong place and would be entirely opinion based.
Why would I want to use Oracle for the Core DBs? For a long time, Sitecore has included support for using Oracle for the Core DB and to be honest I pretty much ignored it and just assumed that Sitecore supports Oracle simply for cross-platform compatibility. I am no longer satisfied with my unfounded answer, since I cannot find any corroborating (or dissenting) information online, and would like to find out if anyone actually knows of a reason why I would want to use Oracle for the Core DBs?
Yes you can. You can simply use a reference to the rendering. Be aware that you will also need to pass a datasource reference with the rendering for the options. So: 1- Create a parameters item which you will use as a datasource, the template of these items is in the template/coveomodule folder. 2- Pass the refference of the rendering and your datasource item in your code. Here is an example for the search box in a cshtml header: <!-- The resources first --> @Html.Sitecore().Rendering("{id-of-the-search-box-resources}") <!-- Then the search box item --> @Html.Sitecore().Rendering("{id-of-the-search-box-view-rendering}", new { DataSource = "{parameters-item-of-the-search-box-view}" })
Coveo initialize components via code Currently all Coveo UI components are initialized through Experience Editor. Setting their appropriate properties. Is there a way to initialize them through code? Example CoveoSortFieldView.cshtml and CoveoFacetView.cshtml I would like to reference them in code and load a perticular facet instead of going through EE. Using Coveo for Sitecore 4.
I feel like you may be switched around in your thinking. The display name field is used to when you view the item in sitecore you are able to have it look better compared to the actual item name. If you want to have urls created to look a certain way, it would be best to use the item name when you create the item to be the url you want and then fill out the display name so it looks better in the content tree. You can edit the display name using the tab on the content editor.
Is it possible to move "Display name" out of standard fields? I want to configure my Link Manager to utilize the Display Name field when generating URLs, like so: <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <linkManager> <providers> <add name="sitecore"> <patch:attribute name="useDisplayName">true</patch:attribute> </add> </providers> </linkManager> </sitecore> </configuration> However, that Display Name field is down in the standard fields and hard to manage from an authoring point of view. I'd like to move it up higher in my page templates. Is this possible? Alternatively, can I configure the link manager to use my own custom field instead?
When working with stringCollection fields, you can declare them in the model simply as string. When you apply any filtering logic to such a field, that logic will be treated as .Any(), meaning that the filter needs to apply to at least one string in the collection. This is in a way similar to how tokenized fields work. Define your field in the model like this: [IndexField("aliases")] public string Aliases { get; set; } And then filter like this: predicate = predicate.And(r => r.Aliases.Matches(pattern));
How to query for regEx matches in any value in a stringCollection field? I have a computed field with returnType="stringCollection", which I am using via a search result model that looks something like this: public class MySearchResultItem : SearchResultItem { // ...other properties... [IndexField("aliases")] public string[] Aliases {get; set;} } My search code needs to find results that have aliases beginning with a given letter (or any digit if the input is #). Here's what it looks like now: var pattern = (letter == "#" ? "[0-9]" : letter) + ".*"; var predicate = PredicateBuilder.True<MySearchResultItem>(); // ...other clauses... predicate = predicate.And(r => r.Aliases.Any(a => a.Matches(pattern)); var results = context.GetQueryable<MySearchResult>().Where(predicate).ToList(); Originally, I had the Aliases property as an IEnumberable<string>, but I got an error that said it must be an array. After changing it to an array, I get an exception like so: [ArgumentException: Static method requires null instance, non-static method requires non-null instance. Parameter name: instance] System.Linq.Expressions.Expression.ValidateStaticOrInstanceMethod(Expression instance, MethodInfo method) +5862475 System.Linq.Expressions.Expression.Call(Expression instance, MethodInfo method, IEnumerable`1 arguments) +69 Sitecore.ContentSearch.Linq.Parsing.ExpressionParser.VisitLinqEnumerableAnyMethod(MethodCallExpression methodCall) +573 Sitecore.ContentSearch.Linq.Parsing.ExpressionParser.Visit(Expression expression) +186 ... System.Linq.Enumerable.ToList(IEnumerable`1 source) +70 ... my code ... Am I doing something wrong, or is this kind of query just not supported by the API? If this isn't supported, is there another way to get there? Changing it from Matches to StartsWith(letter) gets rid of the error, but I would need to add 10 StartsWith clauses for the digit case and apparently StartsWith isn't "safe" to begin with.
Goal registration heavily relies on the current session. I am not aware of a good way to properly register a goal outside of actual session, page, and request being available. To enroll a contact into a specific state in an engagement plan, you can try using this API: using Sitecore.Analytics.Automation; // ... bool success = AutomationContactManager.AddContact( contactId, automationStateId, new Dictionary<string, object>()); This method will return false in the following cases: The contact with given ID does not exist; The database is unavailable; The contact is locked by another process; The contact is already in the given state; The given automation state does not exist; An exception occurs (it will be logged). To check if a contact is already enrolled in a certain plan, you can use the following code: Contact contact = ... var manager = AutomationStateManager.Create(contact); bool isInPlan = manager.IsInEngagementPlan(planId);
How to trigger a goal programmatically out of web request? When I am importing contacts (within a scheduled job, which is our of request) I want to check few business conditions and if contact matches the condition, I want to trigger a goal for the contact. The goal will execute rule action on enrolling the contact in the engagement flow. Is that possible and how to do that?
Disclaimer: I work with Indra and helped him solve the problem. Adding the answer with other issues that were resolved. Dheeraj answer was right to the question. But unfortunately it opened up a new issue called key not found exception using Glass Mappper. This was because the model properties and item fields were not matching. After ignoring the properties to AutoMap, faced another issue. This time it is with the Glass.Mapper.Sc.Start.Config file. The namespace mentioned for the App_Start method was not pointing to the project namespace. So, corrected it and everything started working properly.
The model item passed into the dictionary is of type 'Sitecore.Mvc.Presentation.RenderingModel', but it requires model another model in project In a sitecore mvc project created a .cshtml as mainlayout with the following code in it: @using Sitecore.Mvc @using Sitecore.Mvc.Presentation @inherits Glass.Mapper.Sc.Web.Mvc.GlassView<project.MVC.Models.Shared.IPageBase> @{ Layout = null; } <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width" /> <title>SampleLayout</title> </head> <body> <div> <h1>Hello World</h1> </div> </body> </html> I assigned this as mainlayout to one of the item in Sitecore and previewed it. Following is the error displayed: The model item passed into the dictionary is of type 'Sitecore.Mvc.Presentation.RenderingModel', but this dictionary requires a model item of type 'Project.MVC.Models.Shared.IPageBase'.
You are probably running the site in integrated mode. This means you don't need the /configuration/system.web part, which is for classic mode. If it is not there, you can ignore that step.
Patching security vulnerability SC2016-002-136135 for versions 7.2 and above I am trying to patch my sitecore instance by following the sitecore knowledge base article https://kb.sitecore.net/articles/039942 I am on sitecore 8.1 update 3 and could not able to do below step as i cannot find that in web.config file? Edit the web.config file and locate this line within the '/configuration/system.web/httpHandlers' node <add verb="*" path="sitecore_icon.ashx" type="Sitecore.Resources.IconRequestHandler, Sitecore.Kernel" /> Any suggestions are appreciated.
There are two ways to get Sitecore on Azure deployed in Azure PaaS. Using custom built ARM Templates (See blogs suggested by Dmytro in Question comments) Installing from Azure Marketplace (the focus of this answer) Installing Sitecore 8.2 Update-1 Azure PaaS from Marketplace The easiest and fastest method for getting Sitecore 8.2 Update-1 up and running in Azure PaaS is to install it from the Azure Marketplace. Doing a search on the Azure Marketplace for sitecore will reveal the Sitecore option. Press Next and then fill out the handful of variables (usernames, instance names, passwords, etc.) Provide a Sitecore license. (Required. Can be client or partner license) Setup takes about 25 minutes to complete Azure deployment. Once Deployment is Complete Once the Azure Deployment is complete, a series of items in the Resource Group will be created for you: 1 Content Delivery WebApp (Including the App Service) 1 Content Management WebApp (Including the App Service) 1 Instance of Azure Search WebApp Out of the "box", Sitecore on Azure PaaS comes preconfigured with Azure Search as the default search index mechanism. SOLR can be used instead through configuration change if you'd like to use SOLR instead. Lucene is NOT available as an indexing option when using Azure WebApps. 1 Instance of Redis Cache WebApp This is used for Session Management 2 Instances of Azure SQL Server (PaaS) One for CM Role, and One for CD Role CM Role SQL Server contains Master and Core CD Role SQL Server contains Web Application Insights for the Solution Things to Know xDB is disabled by default in the Sitecore on Azure PaaS WebApp deployment for Sitecore 8.2. Update-1. If you want to use xDB, you must bring your own MongoDB, either through using a Virtual Machine added to the resource group, ObjectRocket, or some other hosted MongoDB solution. xDB Cloud Support is not currently supported (as of the time of this answer). Slated for Q1/Q2 2017 release. Sitecore Product Module Support coming soon. Currently SxA, ExM, PxM, and xDB Cloud are not supported on Azure WebApp Azure Marketplace deployment. Most modules will be updated sometime in the 2017 timeframe. If you need to use any one of these modules, you will need to use Azure IaaS VM or Cloud Services deployment until PaaS support is released. The old Azure Module, affectionately known as Sitecore Azure has been discontinued as of Sitecore 8.2 and will not be supported. Using custom ARM Templates to deploy a custom solution or the Azure Marketplace to deploy is the way going forward to have Sitecore on Azure PaaS. Available Sitecore Configurations Currently, only xM1 is available through Azure Marketplace as of the release of Sitecore 8.2 Update-1. Sitecore has stated that support for xM1-5 and xP1-5 through the Marketplace will be coming in Q1/Q2 of 2017.
How to install Sitecore 8.2u1 on Azure PaaS On http://dev.sitecore.net Sitecore has released the Sitecore 8.2 Update-1 version. This now supports Azure PaaS. However, I can not find an installation guide for an Azure PaaS setup. Anybody know if this is available? Also, when I download the "WebDeploy package for XP0 / Single Instance configuration", this doesn't seem to be the same as a 'normal' webdeploy package I can create from Visual Studio. The content of the files do not have not the same structure. Is this a 'special' webdeploy package?
If you find that something like this is happening and the <sites> configuration seems valid, consider, as I eventually did, that all sites are pointing to the same server. When I pinged the working sites, I saw that they all had the same IP but the site throwing the 404 was pointing to a different IP, and therefore a different server altogether; one that did not have the Sitecore login folder as TRNKTMS alluded to.
Accessing Sitecore Login from each site in a multi-site setup fails (404 page not found) for only one site We have a multi-site instance of Sitecore 8.2 and we have patched the <sites> section to include each site. This all seems fine and every site can be accessed by its unique domain/subdomain. Curiously, one of the sites will resolve fine (it's home page), but when we try to access Sitecore, instead of loading the login page, we get a 404 page. Here's the config line for a site that works - Sitecore login page is reachable Note I only changed the hostnames to generic values (e.g site1 and oursite.com): <site patch:after="*[@name='modules_website']" name="site1_authoring" targetHostName="authoring.site1.oursite.com" hostName="authoring.site1.oursite.com" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" startItem="/Sites/site1" database="web" enableAnalytics="false" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="100MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="5MB" filteredItemsCacheSize="2MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" forceSSL="false" /> And here's the config line for the site that does not work - CANNOT access Sitecore login page Note I only changed the hostnames to generic values (e.g site2 and oursite.com): <site patch:after="*[@name='modules_website']" name="site2_authoring" targetHostName="authoring.site2.oursite.com" hostName="authoring.site2.oursite.com" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/Sites/site2" startItem="/Home" database="web" domain="extranet" enableAnalytics="false" allowDebug="true" cacheHtml="true" htmlCacheSize="100MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="5MB" filteredItemsCacheSize="2MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" forceSSL="false" /> When trying to access the Sitecore login on the second site via: http://authoring.site2.oursite.com/Sitecore/login, we get the following error: http://authoring.site2.oursite.com/error/pagenotfound?item=&amp;user=sitecore%5cAnonymous&amp;site=login I am not seeing anything significant in the site config definitions?
Modifying raw security values Open the Content Editor Locate the item that represents the template field On the View tab in the Ribbon, make sure the following checkboxes are checked: Standard fields Raw values Go to the Security section Insert the following text into the Security field: ar|sitecore\Everyone|pe|-field:write| Save the item. This will make the field read-only for all Sitecore users except the administrators. This is because Sitecore administrators can always edit all fields, regardless of security. Note: if you want this to apply to users in all domains, use the following value: ar|Everyone|pe|-field:write|pd|-field:write| Using the Security Editor You can also deny access to this field via the Security Editor UI. Just make sure that the "Field Write" column is shown by checking it in the Columns dialog in the Security Editor.
Make text field readonly Is there any easier way of creating read-only fields for all users except admin, not by setting permissions on every user or by creating a role and assigning it to every user/group?
Thanks to Hishaam Namooya who gave me the idea to the solution in his comment. Instead of creating the new ticket in the new version. I will make every version responsible for its own ticket cookie creation. The .aspxauth cookie is already shared between the 2 sitecore instances of different version. So I can check the user from there and call the code to create the ticket for the user. As a modification to the cross domain solution for sitecore ticket cookie in the Global.asax here. protected void Application_EndRequest(object sender, EventArgs e) { var authCookie = HttpContext.Current.Response.Cookies["sitecore_userticket"]; if (!Request.IsAuthenticated || authCookie == null) { // when checking response cookies, cookie is created if not exists, so delete now HttpContext.Current.Response.Cookies.Remove("sitecore_userticket"); return; } //we don't need to make it cross domain as it will be different for every instance //due to version differences. //create the ticket cookie. Every Sitecore instance will generate it the way it expects. authCookie.Value = TicketManager.CreateTicket(HttpContext.Current.User.Identity.Name, string.Empty); } This code must be in both sitecore instances Global.asax files
sitecore_userticket cookie generated differently across Sitecore versions I am implementing a Single sign on solution for a client. It is required if a user is logged in for one of the two sitecore sites, he/she will be logged in for the other. The first instance is 6.5.0 (rev. 121009) the second is 8.1 (rev. 160519). They share the same domain so they can share the cookies. I made the configuration of membership, roles,profile point to the same db. The issue I am having right now is Sitecore 8.1 depends on another cookie called sitecore_userticket that is generated differently in 6.5. I was able to share the sitecore_userticket cookie across subdomains using this solution https://community.sitecore.net/developers/f/8/t/1241 but the problem that the cookie content is different across the versions remains So currently if a user is authenticated first in Sitecore 8.1, he is authenticated in 6.5, while if he is authenticated first in sitecore 6.5, he is not authenticated in 8.1. Is there any code I can use in Sitecore 6.5 to generate the expected cookie for Sitecore 8.1?
What you are looking for is most likely IFieldNameTranslator. You need a SitecoreHelper to get an instance for a specific index. Since the pipeline can be run without a context, you have to validate whether the CurrentContextItem is null before trying to convert it in an indexable. The following code should work for your use case: ISitecoreHelper sitecoreHelper = new SitecoreHelper(); IFieldHelper translator = new FieldHelper(); if (p_Args.CurrentContextItem != null) { bool usePrefix = false; IIndexable indexable = p_Args.CurrentContextItem.ToIndexable(); ISearchIndex index = m_SitecoreHelper.GetSearchIndex(indexable); IFieldNameTranslator translator = m_SitecoreHelper.GetFieldNameTranslator(index); string translatedField = translator.ToCoveoFieldName(indexable, "field", usePrefix); // Use that translated field here }
Using ToCoveoFieldName in backend Is there a way to get Coveo equivalent field name helper such as ToCoveoFieldName in CoveoProcessParsedRestResponseArgs pipeline code? Basically I am trying to see if a property of SearchResult item is of certain value and based on it create a new property. var db = NewStuff(); foreach (SearchResult result in response.Results) { result["isNew"] = "201612" == result.Raw["fyearandmonth11031"].ToString(); } The field fyearandmonth11031 needs to be translated from Sitecore field (YearAndMonth) to a Coveo field name.
The system index from <search> node was marked Obsolete in config (SC8.1.3) and completely removed in Sitecore 8.2 Initial Release. <search> <!-- Obsolete: the API that uses this section is obsolete. Please, use Sitecore.ContentSearch to configure your indexes. --> <configuration type="Sitecore.Search.SearchConfiguration, Sitecore.Kernel" singleInstance="true"> <indexes hint="list:AddIndex"> <index id="system" type="Sitecore.Search.Index, Sitecore.Kernel"> ... This index relates to the "Quick Search Index" and it has therefore also been removed from Control Panel > Database > Rebuild search indexes and from Sitecore.config. See this previous question if you want to find details on the difference between the indexes. EDIT Following the clarification in the question from @HarshBaid, the documentation for the upgrade guide is incorrect and as @Gatogordo's comment points out it is registered as a bug. You should still rebuild the indexes for the Master and Core databases from Control Panel > Indexing > Indexing Manager.
How do I rebuild the Quick Search Index in Sitecore 8.2? I've upgraded my solution from sitecore 8.1 Update 1 to Sitecore 8.2 initial release. After finishing the upgrade, and configuration changes, I opened the launchpad to rebuild Quick Search Index, I couldn't find this option in the launchpad under the database section. Any idea what might be the issue? This step is mentioned in Post-Upgrade steps in section 1.3.4 of Sitecore 8.2 Upgrade Guide.
Slow approach You could load all previous visits using this code: IEnumerable<IInteractionData> visits = Tracker.Current.Contact.LoadHistorycalData(visitsToLoad); Then you could check every page of every visit and see if the goal was triggered. This would not perform well though. Fast approach You should use the Key Behavior Cache which contains (a configurable amount of) goals, events, campaigns etc. that have been triggered by contacts, even in previous visits. Guid goalId = // your goal ID KeyBehaviorCache cache = Sitecore.Analytics.Tracker.Current.Contact.GetKeyBehaviorCache(); bool goalTriggered = cache.Goals.Any(_ => _.Id == goalId); Keep in mind that the Key Behavior Cache contains a limited number of entries. So you should make sure it's tuned for your needs. See this documentation page for more information: The Key Behavior Cache settings, pipelines, and methods
How to check if a Goal with specific ID has been ever registered for the contact? I need to know if the goal was ever registered on the contact in its any visit on any interaction. How can I do that?
TL/DR; There is no difference Long version: This is the code that gets executed when you use the Delete Language option from the control panel: protected void Delete() { Job job = Context.Job; Assert.IsNotNull((object) job, "Job is null"); Database database = Factory.GetDatabase(this._databaseName); Assert.IsNotNull((object) database, "Database"); try { foreach (Language language in this._languages) { ID languageItemId = LanguageManager.GetLanguageItemId(language, database); Item obj = database.GetItem(languageItemId); Assert.IsNotNull((object) obj, "Item is null: /sitecore/system/languages/{0}", (object) language.Name); if (Settings.RecycleBinActive) { Log.Audit((object) this, "Recycle Language: {0}", new string[1]{ language.Name }); obj.Recycle(); } else { Log.Audit((object) this, "Delete Language: {0}", new string[1]{ language.Name }); obj.Delete(); } } } catch (Exception ex) { job.Status.Failed = true; job.Status.Messages.Add(ex.ToString()); } job.Status.State = JobState.Finished; } } As you can see, ultimately it does the same thing as removing the language item would. There is some extra logging around it, and it has a nice form for you to select the language to delete first. The code is not run within any disablers so all the same item:deleted events and item:deleting events would run in the same way.
Adding/deleting languages from control panel Is it adding/deleting a language from control panel is same as adding/deleting in content editor /sitecore/system/Languages?
I may be a bit late to the party here, but I've just experienced a similar problem. On my development Sitecore 8.0 instance, a collection of things went wrong: As described above, the "Indexing" section of the Control Panel vanished. I started to get loads of odd "Null Reference" exceptions in the logs referring to aspects of analytics aggregation processing we had customised in the past. While I could see all my indexes in the output of ShowConfig.aspx, the only index which appeared to work was "Quick search index" - everything else returned an "index not found" error if I tried to use it in code. And that lead to odd log errors from Sitecore code saying it could not find indexes either, such as "Social messages index could not be determined for master database. Messages root path: /sitecore/social/Messages. Please check indexes configuration." After a lot of banging my head on the table, and diffing config files, I found a difference between the old and new states: The setting BucketConfiguration.ItemBucketsEnabled in the Sitecore.Buckets.config file was set to false. Returning that to true fixed all the problems I was seeing.
Indexing section is disappeared from control panel I am trying to rebuild the search indexes through index manager, as an admin user. I am working on a Sitecore 8.0 instance from another developer, and I am not super familiar with Sitecore, myself. I tried following the instructions below to rebuild the indexes: Log in to the Sitecore Desktop. Open the Control Panel. Click Indexing and then click Indexing Manager. In the wizard select the indexes you want to rebuild The problem is that I am not able to see the "Indexing" section in control panel. Can anyone help me out?
Using the "Magic" Mark mentioned it works. However, to get the ItemId and the Source into the dialog, use the last answer as described in this article: https://stackoverflow.com/questions/8148279/how-to-get-a-reference-to-the-currently-edited-item-when-inside-a-custom-field-i. The full class looks now like this: using Sitecore.Diagnostics; using Sitecore.Shell.Applications.ContentEditor; namespace My.Feature.ImageCropper.FieldTypes { using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Web.UI; [ExcludeFromCodeCoverage] public class ImageCropperField : Text, IContentField { #region Reflection public string ItemId { get { return base.GetViewStateString("ItemId"); } set { Assert.ArgumentNotNullOrEmpty(value, "value"); base.SetViewStateString("ItemId", value); } } public string Source { get { return base.GetViewStateString("Source"); } set { Assert.ArgumentNotNullOrEmpty(value, "value"); base.SetViewStateString("Source", value); } } #endregion #region IContentfield implementation public string GetValue() { return Value; } public void SetValue(string value) { Value = value; } #endregion #region Text base class overrides protected override void Render(HtmlTextWriter output) { Assert.ArgumentNotNull(output, nameof(output)); base.Render(output); } #endregion #region Message handler public override void HandleMessage(Sitecore.Web.UI.Sheer.Message message) { if (message["id"] != ID || string.IsNullOrWhiteSpace(message.Name)) return; switch (message.Name) { case "imagecropper:cropImage": Sitecore.Context.ClientPage.Start(this, "CropImage"); return; case "imagecropper:resetImage": Sitecore.Context.ClientPage.Start(this, "ResetImage"); return; } if (Value.Length > 0) SetModified(); Value = string.Empty; } protected void CropImage(Sitecore.Web.UI.Sheer.ClientPipelineArgs args) { if (args.IsPostBack) { if (args.HasResult &amp;&amp; Value.Equals(args.Result) == false) { SetModified(); SetValue(args.Result); } } else { string url = Sitecore.UIUtil.GetUri("control:ImageCropperDialog"); string v = GetValue(); string i = this.ItemId; string s = this.Source; if (!string.IsNullOrEmpty(i)) { url = $"{url}&amp;itemid={i}&amp;{s}&amp;{v}"; if (!string.IsNullOrEmpty(s)) { url = $"{url}&amp;{s}"; if (!string.IsNullOrEmpty(v)) { url = $"{url}&amp;{v}"; } Sitecore.Web.UI.Sheer.SheerResponse.ShowModalDialog(url, "800", "600", "", true, "800", "600", false); args.WaitForPostBack(); } else { Sitecore.Web.UI.Sheer.SheerResponse.Alert("The options for cropping the image are not set properly"); } } else { Sitecore.Web.UI.Sheer.SheerResponse.Alert("A reference to the item could not be set"); } } } protected void ResetImage(Sitecore.Web.UI.Sheer.ClientPipelineArgs args) { SetValue(string.Empty); SetModified(); } #endregion } }
Custom field with (sheer) dialog. How to get data from other fields in the item I have a custom field with two menu items, of which one of them opens a (sheer) dialog. But I need the value from other fields of the item in my dialog. However, I cannot find any reference to the original item. There is only some reference FIELD123456, which I cannot connect to an item or field. Anyone a clue? Edit: This is the code of custom Field Type using SC = Sitecore; using SC_Diagnostics = Sitecore.Diagnostics; using SC_Web = Sitecore.Web; using SC_Shell_Applications_ContentEditor = Sitecore.Shell.Applications.ContentEditor; namespace My.Feature.ImageCropper.FieldTypes { using System.Diagnostics.CodeAnalysis; using System.Web.UI; using System.Web.UI.WebControls; [ExcludeFromCodeCoverage] public class ImageCropperField : SC_Shell_Shell_Applications_ContentEditor.Text, SC_Shell_Applications_ContentEditor.IContentField { protected override void Render(HtmlTextWriter output) { //cannot find any reference to item in base :-(( SC_Diagnostics.Assert.ArgumentNotNull(output, nameof(output)); base.Render(output); } public string GetValue() {return Value; } public void SetValue(string value) { Value = value; } public override void HandleMessage(SC_Web.UI.Sheer.Message message) { //cannot find any reference to item in this or message :-(( if (message["id"] != ID || string.IsNullOrWhiteSpace(message.Name)) return; switch (message.Name) { case "imagecropper:cropImage": SC.Context.ClientPage.Start(this, "CropImage"); return; case "imagecropper:resetImage": SC.Context.ClientPage.Start(this, "ResetImage"); return; } if (Value.Length > 0) SetModified(); Value = string.Empty; } protected void CropImage(SC_Web.UI.Sheer.ClientPipelineArgs args) { //cannot find any reference to item in this or args :-(( if (args.IsPostBack) { if (args.HasResult &amp;&amp; Value.Equals(args.Result) == false) { SetModified(); SetValue(args.Result); } } else { //show popup var url = SC.UIUtil.GetUri("control:ImageCropperDialog"); var value = GetValue(); if (!string.IsNullOrEmpty(value)) { url = $"{url}&amp;{value}"; } SC_Web.UI.Sheer.SheerResponse.ShowModalDialog(url, "800", "600", "", true, "800", "600", false); args.WaitForPostBack(); } } protected void ResetImage(SC_Web.UI.Sheer.ClientPipelineArgs args) { SetValue(string.Empty); SetModified(); } } } As you can see, the field inherits from Text and IContentField. All properties and methods are returning values to the control itself, the Home item (based on query string) or the Content Manager item in the core database (which is the context. I tried them all including: this.GetContentItemFromQueryString() this.GetContextItem(); this.GetItem(); this.GetItemFromQueryString(); this.TemplateControl.ID; this.UniqueID; The this.ItemId property is not present. So.... is there another way to get the ID of the item where this field is used in?
Explanation The following view is used for the Text Area: webroot\Views\Form\EditorTemplates\MultipleLineTextField.cshtml. As I can see here it uses the Sitecore.Forms.Mvc.ViewModels.Fields.MultipleLineTextField model which is inherited from Sitecore.Forms.Mvc.ViewModels.Fields.SingleLineTextField. This SingleLineTextField class has a property MaxLength with the DefaultValue(256). public class SingleLineTextField : ValuedFieldViewModel<string> { [DefaultValue(256)] public int MaxLength { get; set; } [DefaultValue(0)] public int MinLength { get; set; } [DynamicStringLength(&quot;MinLength&quot;, &quot;MaxLength&quot;, ErrorMessage = &quot;The field {0} must be a string with a minimum length of {1} and a maximum length of {2}.&quot;)] [DataType(DataType.Text)] public override string Value { get; set; } public override void Initialize() { if (this.MaxLength != 0) return; this.MaxLength = 256; } } That means you have to create your own model which does not have this MaxLength property. Solution Let's create your own model without maxlength. using System.ComponentModel; using System.ComponentModel.DataAnnotations; using Sitecore.Forms.Mvc.Validators; using Sitecore.Forms.Mvc.ViewModels; namespace MyProject.Forms.Mvc.ViewModels.Fields { public class MultipleLineTextFieldWithoutMax : ValuedFieldViewModel<string> { public int Rows { get; set; } public int Columns { get; set; } public override string ResultParameters { get { return &quot;multipleline&quot;; } } [DefaultValue(0)] public int MinLength { get; set; } [DynamicStringLength(&quot;MinLength&quot;, &quot;MaxLength&quot;, ErrorMessage = &quot;The field {0} must be a string with a minimum length of {1}.&quot;)] [DataType(DataType.MultilineText)] public override string Value { get; set; } public MultipleLineTextFieldWithoutMax() { this.Rows = 4; this.Columns = 1; } } } Copy the webroot\Views\Form\EditorTemplates\MultipleLineTextField.cshtml view, let's call it MultipleLineTextFieldWithoutMax.cshtml @using Sitecore.Forms.Mvc.Html @model MyProject.Forms.Mvc.ViewModels.Fields.MultipleLineTextFieldWithoutMax @using (Html.BeginField()) { @Html.TextAreaFor(x => Model.Value, Model.Rows, Model.Columns, new { @class = &quot;form-control&quot;}) } Copy the /sitecore/system/Modules/Web Forms for Marketers/Settings/Field Types/Simple Types/Multiple-Line Text and use your new model there Be careful whenever you do an update because it can be changed! The WFFM version in this solution is 8.1 rev 151217
WFFM unlimited text area input field? Text area should not restrict to input unlimited character. But even i set empty in maximum length property of multiple text field, it took data-val-length-max="10000"? Can any one help asap to fix this?
Would it be an option to change the field type to a TreeList, allowing you to use the parameterized datasource syntax? This way you can set the datasource to "About Pages" and use the ExcludeItemsForDisplay to filter out the "Content Folder" items (and their children). Note that you must use the template name in this syntax, not the id. So in the end something like this: Datasource=/sitecore/content/.../About Pages&amp;ExcludeTemplatesForDisplay=ContentFolderTemplate This would achieve what you want from the source point of view, but it will allow your editors to select more than one item. If that is an issue you could add validation on the field - a regex like ^({[^}]+}|?){0,1}$ should limit it to 0 or 1 selected item (guid). Might not be the perfect solution as it changes the behavior for your editors but it is an option without custom code.
Using Sitecore fast:query to grab all items under a specified page excluding items in a specific folder I'm using the following query as a Source for my Droplink field: query:fast:/sitecore/content/Home/AboutPages//*[@@templateid!='{41BF6376-A2D4-4CF1-80C5-223067C84811}'] My intention is for this query to grab all of the pages directly under AboutPages but exclude everything in Content folders on all levels (These content folders have a template ID of {41BF6376-A2D4-4CF1-80C5-223067C84811}). Is there a way to restrict this query to all page items aside from items located within Content folders? As of now, I'm not grabbing the Content folders themselves but I am grabbing all of the child items under these folders which I do not want to include. Edit: As an additional note, I cannot simply grab all pages under AboutPages by template ID because the pages themselves may have different templates. Edit 2: As a quick example I could have the following page structure: About Pages Page 1 (Template ID = "{53BC28A6-0A7D-4CDD-A53E-7AB78A20B5AF}") Content Folder Accordion Page 2 (Template ID = "{81C65AE0-5BBB-4A99-BC7F-BCA463AFEE06}") Page 3 (Template ID = "{881959CF-3617-4D36-9389-0DB2CA382F9A}") Content Folder Carousel Content Folder I need the query to return Page 1, Page 2, and Page 3 while excluding items in the content folder (Accordion, Carousel). My best guess for how to do this now is to find the template IDs of all possible pages and include those in the query but I was hoping for a more elegant solution.
EXM requires an email to be associated with the contact. The contact has to be an xDB contact. Starting from EXM 3.1, Sitecore users are no longer supported. By default the contact should look something like this: { "_id" : LUUID("84ad2c30-71b9-a445-a424-a597867876b8"), "Identifiers" : { "IdentificationLevel" : 2, "Identifier" : "[email protected]" }, "Tags" : { "Entries" : { "ContactLists" : { "Values" : { "0" : { "Value" : "{D4DFC0A6-071E-46D8-B32A-2858D9FCFD7C}", "DateTime" : ISODate("2016-12-08T11:32:59.787Z") } } } } }, "Personal" : { "FirstName" : "FirstName", "Surname" : "Surname" }, "Emails" : { "Preferred" : "Preferred", "Entries" : { "Preferred" : { "SmtpAddress" : "[email protected]" } } }, "Lease" : null, "System" : { "VisitCount" : 2, "Value" : 0 } } Notice the Emails facet. By default the Preferred email of this facet is used. This is loaded in the AssignEmailProperties pipeline processor of the getXdbContactRecipient pipeline. The error message you're seeing in the log file is logged specifically when this processor hasn't loaded the email. It is possible to change how the email is retrieved, but in your case the problem is most likely that there's no email address associated at all, and not that you've got it stored in a different facet.
Triggered email not sent to few people ClientApi does not send email to a few email ids and sends to a few randomly on email signup. Could the opt-out list play any role here? We are on Sitecore8.1 Also the Sitecore.EmailExperience.ContentManagement.Config has <setting name="StandardMessages.DefaultGlobalOptOutList" value="/sitecore/system/List Manager/All Lists/E-mail Campaign Manager/System/Common Global Opt-out" /> I don't see any records on this list. How am I supposed to know if people that unsubscribe made an entry in an opt-out list? And if yes if they subscribe again they will never receive an email since they are in the opt-out list. Where do I check records in an opt-out list? Also, I see Error in Exm Log: 19012 10:19:51 INFO Registered email: [email protected] 15688 10:19:51 DEBUG Message 'US DTC 64UJR Newsletter Signup Email': Recipient is skipped. **No email address was associated with recipient 'xdb:ca19b013-255b-4ec7-a0ae-4586fe3496ec'.** ManagedPoolThread #7 10:19:51 INFO Dispatch Message (US DTC 64UJR Newsletter Signup Email): Started Message Id: {218AE469-3025-4AE3-AB07-C9E52BD68403} Message Path: /sitecore/content/Home/Email Campaign/Messages/Triggered Emails/Triggered Emails 2016/US DTC 64UJR Newsletter Signup Email Included Recipient Lists: Excluded Recipient Lists: Is the value shown a contact Id? Also when I checked the MongoDB Collection contacts, the id seems to be encrypted but I queried using email id and that had an entry. _id: "E7AZylslx06grkWG/jSW7A==" System: {"VisitCount":0,"Value":0} Identifiers: Identifier: "[email protected]" Not sure why this error is occurring.
I know you have already found the exact solution for your particular case. Still, I'm going to list the steps I normally take when troubleshooting data saving issues in xDB. Hopefully, this can help others in the future. Ensure the analytics connection string is set up properly in the ConnectionStrings.config. Make sure that you have a valid xDB license. You can see the list of available licenses in the Control Panel > Administration > Installed licenses. "Sitecore.xDB.base" should be present there. Make sure that xDB and its tracking subsystem are enabled. The settings Xdb.Enabled and Xdb.Tracking.Enabled should be set to true when you open this page: /sitecore/admin/ShowConfig.aspx. The configuration file Sitecore.Analytics.Tracking.Database.config should be enabled. Enable tracking on your site definition by setting enableTracking to true for your site in the <sites> section. Try making several page requests instead of just one before letting the session expire. Ensure that all of your layout pages contain the VisitorIdentification control in the <head> section. In MVC layouts, use @Html.Sitecore().VisitorIdentification(); in ASP.NET WebForms layouts, use <sc:VisitorIdentification runat="server" />. Try disabling robot detection by setting both Analytics.Robots.IgnoreRobots and Analytics.AutoDetectBots to false. The original values for these settings are located in the Sitecore.Analytics.Tracking.config. If interactions are saved after this, it means your visitors were recognized as robots. If nothing helps, go through the steps listed in the article Troubleshooting xDB data issues.
No contact created in MongoDB when session is closed 8.2 update 0. I have changed session to be 1 minute instead of the default 20 minutes. When I log into the site, in incognito, surf around and close the browser. No contact is ever created in the Mongo analytics database. When I look in the logs, there is nothing before or after the profile is created to identify any issues. I have installed a profile viewer and can verify that a profile is being created and has custom facets. I just can get it to write the contact to Mongo when the session is closed. I have tried several different browers on and off server.
As dnstommy mentions in the comments, you should be able to find your data folder on the showconfig page. The Data folder is now (by default at least) under the webroot/App_Data folder. I'm not sure when the Application Insights wouldn't be enough for the log files, but if you want to query the log files in more detail, on the Application Insights there's an 'Analytics' button as well. That will open a new window where you can write a query such as: traces | where severityLevel == 3 That particular query will get you all entries in your log files that are logged as ERROR. I've created a blog post which mentions some other cool things we can do with Application Insights and Sitecore's performance stats as well here.
Sitecore 8.2 Update 1 folder and files gone missing Noticed that after standing up 8.2 updates 1 on Web App, the following folders and files are not there anymore. Folder: Media Cache Submit Queue MediaIndexing Files: Log files are missing ( I'm aware that log details appear on app insight, but is it possible to dump the log files on to azure blob storage?) Curious to understand how Sitecore has tackled the Web App single file share issue.
It is expected behavior. If you are changing workflow, it actually means editing the item. So for Reviewer role you need to have 'workflowCommand:execute' access right for appropriate workflow state; 'item:write' to be able changing the workflow which in fact actually editing the item. You may try restricting access for Reviewer role to buttons, which allow items editing. you may try restricting Read access rights to the following items with subitems (core database): /sitecore/content/Applications/Content Editor/Context Menues /sitecore/content/Applications/Content Editor/Ribbons/Ribbons/Default/Home /sitecore/content/Applications/Content Editor/Ribbons/Ribbons/Default/Publish /sitecore/content/Applications/Content Editor/Ribbons/Ribbons/Default/Versions /sitecore/content/Applications/Content Editor/Ribbons/Ribbons/Default/Configure /sitecore/content/Applications/Content Editor/Ribbons/Ribbons/Default/Presentation /sitecore/content/Applications/Content Editor/Ribbons/Ribbons/Default/Security /sitecore/content/Applications/Content Editor/Ribbons/Ribbons/Default/My /sitecore/content/Applications/Content Editor/Ribbons/Ribbons/Default/Developer /sitecore/content/Applications/Content Editor/Ribbons/Chunks/Write /sitecore/content/Applications/Content Editor/Ribbons/Chunks/Proofing /sitecore/content/Applications/Content Editor/Ribbons/Chunks/Locks /sitecore/content/Applications/Content Editor/Ribbons/Chunks/Schedule /sitecore/content/Applications/Content Editor/Menues/Versions /sitecore/system/Settings/Workflow/Check in Additionally, you may try controlling Ribbon buttons visibility via the pipeline in the web.config file.
Need to create Workflow Approver Role without write access right We need to create workflow Approver Role without write access right. We are trying to setup the roles for workflow. This has four states. Designer State - First or draft State Reviewer State - Intermediate State Publish State - Intermediate State Approved - Final with auto publish state We have created three custom roles. Designer - This will create and edit item and send it for review. Reviewer- This will approve and send the item to publisher or reject to designer. This user is only for approving but not for anything purpose (e.g. editing, creating etc.). Publisher- Can publish the item as well as create/edit item or send it to next state. Now problem is that this does not show the items in workbox for reviewer role user without write access for editor. What can we do for reviewer role?
This is a known issue in Sitecore 8 (as of Update-6) and Sitecore 8.1 (initial release). Making changes and clicking save will result in an error on the page: and an error in the log: 54740 09:13:53 ERROR Bad JSON escape sequence: \a. Path 'r.d.r[22].rls.ruleset.rule[0].conditions.condition.@value', line 156, position 44. This has to do with using rules which contain a "\" character in a condition's value. Here is the workaround from Sitecore: Open the \Website\sitecore\shell\client\Sitecore\ExperienceEditor\Commands\Save.js file. Replace the following line in the execute: function (context) function: context.currentContext.scLayout = Sitecore.ExperienceEditor.Web.encodeHtml(window.parent.document.getElementById("scLayout").value); with this line: context.currentContext.scLayout = Sitecore.ExperienceEditor.Web.encodeHtml(window.parent.document.getElementById("scLayout").value.replace(/\\/g, '\\\\')); For 8.1, the fix is slightly different, replacing: context.currentContext.scLayout = ExperienceEditor.Web.encodeHtml(window.parent.document.getElementById("scLayout").value); with this line: context.currentContext.scLayout = ExperienceEditor.Web.encodeHtml(window.parent.document.getElementById("scLayout").value.replace(/\\/g, '\\\\')); Save these changes and close the file. Clear your browser cache. To track the future status of this Sitecore bug, please use the reference number 55394. More information about Sitecore public reference numbers can be found here. The source : https://help.activecommerce.com/hc/en-us/articles/206474105--An-error-occurred-Bad-JSON-escape-sequence-in-Sitecore-8-x-Experience-Editor-Error
"Bad JSON escape sequence" errors logged when opening a page in Preview mode I have an issue while previewing particular items. I am seeing the following error in the log files: 668 08:30:06 ERROR Bad JSON escape sequence: \A. Path 'ribbonUrl', line 1, position 290. Exception: Newtonsoft.Json.JsonReaderException Message: Bad JSON escape sequence: \A. Path 'ribbonUrl', line 1, position 290. Source: Newtonsoft.Json at Newtonsoft.Json.JsonTextReader.ReadStringIntoBuffer(Char quote) at Newtonsoft.Json.JsonTextReader.ParseString(Char quote) at Newtonsoft.Json.JsonTextReader.ParseValue() at Newtonsoft.Json.JsonTextReader.ReadInternal() at Newtonsoft.Json.JsonTextReader.Read() at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) at Sitecore.ExperienceEditor.Speak.Server.Requests.PipelineProcessorRequest`1.Process(RequestArgs requestArgs) We are using Sitecore 8.1 Update 1.
TL;DR You are not using DropTree but DropLink. I don't think you can set null value for DropLink type. It has always some value (clearing it on client side input won't change anything) Read more because there is a solution for that Why Mandatory is not working Mandatory field should work fine anyway. The reason your value for $item variable is never null/empty is fact that you are assigning default value at the beginning $item = Get-Item master:\content\home Change it to $item = $null in your initial implementation and you will see that validation with Mandatory parameter work, though this field will not be DropLink anymore, it is SingleLineText now (I am not sure, maybe we should report this to SPE team?). How to solve the problem Default field used in you case is DropLink. We have to declare that we want to use DropTree explicitly. Steps: Add Additional parameter editor="DropTree" to your item variable Switch Root parameter name to Source From now on you can set empty value for your item selector. Complete example: In this example you can see how to use Mandatory parameter and -Validator switch at the same time. $item = Get-Item "master:\content\home" $item = $null $result = Read-Variable -Parameters ` @{ Name = "token"; Value = "Token"; Title = "Value to be replaced"; Tooltip = "Value to be replaced"; Placeholder = "Inform what text you want to replace"; Mandatory = $true }, @{ Name = "replaceWith"; Value = "Replace With"; Title = "New value"; Tooltip = "New Value"; Placeholder = "Inform the new value"; Mandatory = $true },` @{ Name = "item"; editor="DropTree";Title = "Select the root item. It will apply to all it's descendants"; Root = "/sitecore/content/"; Mandatory = $true } ` -Description "This Dialog shows less editors, it doesn't need tabs as there is less of the edited variables" ` -Title "Initialise various variable types (without tabs)" -Width 500 -Height 480 ` -OkButtonName "Proceed" -CancelButtonName "Abort" ` -Validator { $itemVariable = $variables.item.Value if ($itemVariable.ID -eq "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}") { $variables.item.Error = "Please select different root item" } } Summary Validator feature is available for SPE 4.2+ Links More info about Validator: https://gist.github.com/AdamNaj/37ad58e1a9350604e4815ca586acf39e ReadVariable documentation: https://sitecorepowershell.gitbooks.io/sitecore-powershell-extensions/content/appendix/commands/Read-Variable.html
Mandatory fields with SPE I'm building a Sitecore powershell script where I'm using Read-Variable to read a few fields. I have added the Mandatory=$true on all of them and it only works for single-line fields but not for droptree ones. Anyone know how I can make it mandatory? Here is my script: $item = Get-Item master:\content\home $result = Read-Variable -Parameters ` @{ Name = "token"; Value="Token"; Title="Value to be replaced"; Tooltip="Value to be replaced"; Placeholder="Inform what text you want to replace"; Mandatory=$true}, @{ Name = "replaceWith"; Value="Replace With"; Title="New value"; Tooltip="New Value"; Placeholder="Inform the new value"; Mandatory=$true}, @{ Name = "item"; Title="Select the root item. It will apply to all it's descendants"; Root="/sitecore/content/"; Mandatory=$true} ` -Description "This Dialog shows less editors, it doesn't need tabs as there is less of the edited variables" ` -Title "Initialise various variable types (without tabs)" -Width 500 -Height 480 -OkButtonName "Proceed" -CancelButtonName "Abort"
This is really an opinion based answer, but the only advantage I see is the ability to have different presentation per language variant on the standard values of the template. This could have potential side effects tho, it would not always be obvious that each language variant had different presentation and I think this would be a rare case and could probably be handled better with personalization rule on the shared layout. I would probably make it a rule to not use the final layout on the standard values of a template.
Template standard values final layout Which purposes can be reached by using final layout in template standard values? What are advantages and disadvantages to use final layout in template standard values?
You can do this on the SOLR configuration site. To setup stemming in SOLR you just need to set the tokenizer and analyzer for the field. For example. Say you have a field in your template called Body Text - rather than use the dynamic SOLR field, you can add this to your schema.xml. <field name="body_text" type="text_stem" indexed="true" stored="true" multiValued="true"/> Now we just need to define the field type in the schema and set the tokenizer and filter: <fieldType name="text_stem"> <analyzer> <tokenizer class="solr.WhitespaceTokenizerFactory"/> <filter class="solr.SnowballPorterFilterFactory"/> </analyzer> </fieldType> What do these do: solr.WhitespaceTokenizerFactory - this will break up the sentences into words using whitespace as the delimeter solr.SnowballPorterFilterFactory - will apply a stemming algorithm to each work or token. There are a number of stemming algorithms, this example uses the Snowball Porter one. For more examples look at Keyword Stemming and Lemmatisation with SOLR
Solr search with stemming We are running Sitecore 8.0 and Solr 4.10.3. I'm trying to get text search working where if I search for play, player and plays are also returned in the search results. I can't find reference on how to achieve this. The current search that I have configured just does a straight text lookup and only returns results with play. Do I need to create a analyzer in Solr with one of the stemming algorithms to achieve this? I'm using the contains function to run the text search in Sitecore search api.
The [Unknown page] entries may appear due to following reasons: Items may have been deleted which were already tracked. Pages are opened and tracked which are not Sitecore items e.g. You created a test.aspx page in root folder and open it, This page does not have a corresponding item in Sitecore and will show as Unknown. You can check URLs and Names of these pages in "Page URLs" section in Behavior tab.
Experience Analytics Entry/Exit pages display [unknown page] Can anyone shed some light on why I am seeing numerous entries for [unknown page] in the Experience Analytics -> Behavior -> Pages -> Entry pages/Exit Pages reports? I need to track down what is causing so many [unknown page] entries in the reports and I'm not sure where to start.
A lot of changes was made to the EXM UI between 3.2 and 3.3. Your problem is that the Validation.js was moved from the /sitecore/shell/client/Applications/ECM/EmailCampaign.Client‌​/Component/ folder to the /sitecore/shell/client/Applications/ECM/EmailCampaign.Client/Component/Validation folder. These changes should have been automatically applied during the upgrade (I'm looking at the 3.2 -> 3.3 upgrade package right now, and the definitions are correct), so for some reason your upgrade didn't make all of the changes. You can pretty easily fix this problem by removing the old Validation.js and adding the new Validation.js, but I'd be vary of doing that without fully understanding what other (if any) changes have not been applied. I suggest creating a clean EXM 3.3 install and diff'ing with your upgrade installation, looking for any differences.
How can I fix EXM 3.3 upgrade causing message view to fail and be mostly blank? We are working on upgrading to EXM 3.3 from 3.2. On my local sandbox, after performing the upgrade, everything appears to be good except for the fact that when I go to view a message from the manager screen, the page that loads is mostly blank displaying only the Back arrow button, empty drop down, language drop down, Save button and the Email campaign info label and table. All of the javascript and css files referenced by the /root/sitecore/client/Applications/ECM/Pages/Messages/Subscription?id=[guid]&amp;sc_speakcontentlang=en appear to load correctly, however, I do see this error in the javascript console: GlobalValidationService.js:2 Uncaught TypeError: Validation.create is not a function(…)(anonymous function) @ GlobalValidationService.js:2execCb @ require.js:1650check @ require.js:866(anonymous function) @ require.js:1113(anonymous function) @ require.js:132(anonymous function) @ require.js:1156each @ require.js:57emit @ require.js:1155check @ require.js:917enable @ require.js:1143init @ require.js:774callGetModule @ require.js:1170completeLoad @ require.js:1544onScriptLoad @ require.js:1671 We have checked the log files and have not been able to find anything pertaining to this issue. Environment Details: Sitecore 8.1 (rev. 160519) Additional Notes: When a new Sitecore instance is installed with EXM 3.3, it works until we sync and publish our Sitecore content and our Visual Studio project. However, deleting our custom assets (js, css files) doesn't appear to affect any change. This problem appears to affect both pre-existing e-mails AND e-mails created after the upgrade. UPDATE: After the suggestions, I have tried copying all of the files in /sitecore and /sitecore_modules out of the package and into the site and it does not fix the problem.
For future reference - below is the response from sitecore support. I have created an Info Request to our Product team regarding this behavior. The Product team has confirmed that the current behavior in Sitecore is by design according to this article:https://doc.sitecore.net/sitecore_experience_platform/developing/developing_with_sitecore/versioned_layouts/versioned_layouts Let me explain why this behavior is by design. When you enable ‘Raw value’ you can see that __Renderings field is the same in different languages, as this field is really shared. But when you open Presentation>Details>Shared Layout you can see that ‘Shared Layout’ is different in different languages. This happens because ‘Shared Layout’ is a dynamic field and created by the following scheme: Standard Values Shared + Standard Values Final. Also, you can look at the following Release Notes and the article, which describes the order of applying the versioned layouts. https://dev.sitecore.net/Downloads/Sitecore%20Experience%20Platform/8%200/Sitecore%20Experience%20Platform%208%200/Release%20Notes. https://doc.sitecore.net/sitecore_experience_platform/developing/developing_with_sitecore/versioned_layouts/versioned_layouts As I understand directly the name ‘Shared Layout’ is confusing you. According to this, I have registered the wish that renames ‘Shared Layout’ to ‘Default Layout’. To track the future status of this wish, please use the reference number 141479. More information about public reference numbers can be found here: https://kb.sitecore.net/articles/853187 So this means we can actually have different shared layout for different languages if we set final layout in standard values.
Shared layout has different values in different languages This is the behaviour in sitecore8.2 As shared Layout is a shared field i thought the value of shared layout will be same for all item languages and versions. But i found its not if we set different final layout in the __standardValues. All i have changed in Danish language is moving "Sample Rendering" to the middle. I feel its better to demonstrate with a video. Video Link: http://www.screencast.com/t/Iye0s1eN Is this the expected behaviour, if yes how can shared field can have different values? Update: Raw values of Renderings field on both English and Danish are same. Its just happening only on the UI looks like.
If you want to enable language fallback. Yes, below configuration needs to be set. It can be set in Sitecore.LanguageFallback.config or on <site> nodes in Sitecore.config. Both are same. But its recommended using patch files for any modifications. <sites> <site name="shell"> <patch:attribute name="enableItemLanguageFallback">true</patch:attribute> <patch:attribute name="enableFieldLanguageFallback">true</patch:attribute> </site> <site name="website"> <patch:attribute name="enableItemLanguageFallback">true</patch:attribute> <patch:attribute name="enableFieldLanguageFallback">true</patch:attribute> </site> </sites> if you have site 2 you need to add: <site name="site2"> <patch:attribute name="enableItemLanguageFallback">true</patch:attribute> <patch:attribute name="enableFieldLanguageFallback">true</patch:attribute> </site> Here is the official sitecore documentation on language-fallback: https://doc.sitecore.net/sitecore_experience_platform/setting_up__maintaining/language_fallback/language_fallback
Language fallback configure In my local sitecore, I am implementing language fallback in Multisite Manager (I have multiple sites in an instance). I have added enableItemLanguageFallback attribute for one site node in multisite Manager. I am able to achieve fallback successfully for that particular site. I haven't changed anything on Sitecore.LanguageFallback.config file. However, when I implemented same for higher environment, i am not able to achieve above. My question is, whether enabling fallback in Sitecore.LanguageFallback.config is required or not?
Editing item fields First of all, yes, the way you're using BeginEdit() and EndEdit() is okay. Checking the returned value of EndEdit() doesn't make much sense though. This method always returns true if at least one field of the item has been modified. There is a better way to update fields. Sitecore PowerShell Extensions generate properties for all item fields. You use them like this: $item.'Field Name With Spaces' = 'some value' $item.AnotherField = 'some other value' Internally, SPE will take care of putting the item in and out of the editing mode. So using these properties will make your code much more concise. Here's how the code should look in your case: Get-ChildItem $path -Recurse -Language $Lang | % { $_.'__Enable item fallback' = $true } Enabling item-level language fallback The way you approached enabling language fallback on all items will work... until you create new items and forget to enable the fallback for those items. There are better approaches. Enable language fallback on all templates You can set the __Enable item fallback field on the Standard Values for all of your item templates: $templates = Get-ChildItem 'master:/sitecore/templates/User Defined' -Recurse | ? { $_.TemplateId -eq '{AB86861A-6030-46C5-B394-E8F99E8B87DB}' } foreach($template in $templates) { $standardValuesPath = "master:$($template.FullPath)/__Standard Values" if(Test-Path $standardValuesPath) { $standardValues = Get-Item $standardValuesPath } else { $standardValues = New-Item -Path $standardValuesPath -Type $template.ID $template.'__Standard values' = $standardValues.ID } $standardValues.'__Enable item fallback' = $true } This will ensure that language fallback is enabled both for existing items and for all new items you may create in the future. Note that the script above will create a __Standard values item if it doesn't exist in a template. Enable language fallback on the root template If all of your content templates inherit from the same base template, it is enough to manually set the "Enable language fallback" checkbox on the Standard Values item of that template. This value will be inherited by Standard Values of all descendant templates, and hence, by all items of those templates.
EndEdit() and boolean response I am trying to enable item level language fallback to all items in my website. The below code snippet is taken for editing an standard field and checking whether the field got edited or not. $Lang = "en"; $path = "master:\content\Sites\TEST"; [int]$count1 = 0; Get-ChildItem $path -recurse -Language $Lang | ForEach-Object { $field = $_.Fields["__Enable Item Fallback"]; if ($field -ne $null) { $_.Editing.BeginEdit() $field.Value = "1"; if ($_.Editing.EndEdit()) { $count1++; } } } Write-Host $count1 "items modified" -f Red; When I see console,Editing.EndEdit() always returns a boolean value. Is that a correct way to use Editing.EndEdit() along with if?
Rather than disable the HTML cache for that page, why not use the Vary by Query String option on your query-string-dependent renderings? I wrote an article that should help get you started, but the below should cover the basic overview of what you would be doing. The 'Vary by' Cache Options Sitecore includes support for varying HTML Cached copies of a rendering and/or rendering instance by numerous parameters, including the current value of the request query string. You can find these options in the &quot;Caching&quot; settings field section, along with the Cacheable option that tells Sitecore that it should cache your rendering, in the first place. Note that like the Cacheable checkbox, you can specify these options either on the rendering item itself (applies globally) or on a specific control in Presentation Details (applies only for that instance). Checking one or more of these options on a rendering that you have specified as &quot;Cacheable&quot; tells Sitecore that it should modify the rendering or rendering instance's (depending on whether you set it on the rendering item or on the control in the presentation details, respectively) cache key based on the options that you selected. This allows you to cache renderings with varied display based on datasource, query string, user authentication state, etc. The following table lists and describes all of the OOTB 'Vary by' options that are available to you: The 'Vary by Query String' Option One of the options that you have available to you is the Vary by Query String option. This option will cache a separate copy of the rendering for each unique combination (order doesn't matter) of query string parameters (keys and values) that are supplied in the request. For example, if I set an instance of RenderingA on page http://domain.com/mypage to be Cacheable and to Vary by Query String then the following will hold true: Request: http://domain.com/mypage?hello=world + added copy of RenderingA to cache Request: http://domain.com/mypage + added copy of RenderingA to cache Request: http://domain.com/mypage?hello=foo + added copy of RenderingA to cache Request: http://domain.com/mypage?bar=baz + added copy of RenderingA to cache Request: http://domain.com/mypage?bar=baz&amp;hello=world + added copy of RenderingA to cache Request: http://domain.com/mypage?hello=world&amp;bar=baz = read RenderingA from cache Request: http://domain.com/mypage = read RenderingA from cache Request: http://domain.com/mypage?hello=world = read RenderingA from cache Which Renderings to Set 'Vary by' Options for Try not to abuse these options too much, in that you should avoid using them in situations where they aren't relevant. You don't want to cache more copies of your renderings than you need, or else that defeats the purpose. In the case of varying your caching by query string, just like with front-end files and browser caching even a meaningless extra query string parameter will cause an extra copy of the rendering to be cached. You shouldn't be setting your 'Vary by' options for all renderings but rather just the rendering(s) that your options apply to. For example, if you are caching your header and your header is the same on every page but the display of Rendering A changes based on the query string parameters then you should just be using your 'Vary by Query String' option on Rendering A. Since the header never changes, there is no point in caching multiple copies of it. In your case, if you only have one rendering that changes its output based on the query-string, then that should be the only rendering that you set Vary by Query String for, if you want to have the most optimal performance. Where to set Your 'Vary by' Options You can set your 'Vary by' options on either the rendering item itself or in the presentation details of the specific page item. The difference is that setting the 'Vary by' options on the rendering item will set the cache key for all instances of that rendering to vary by your settings (in this case the query string). In contrast, setting your 'Vary by' options on the control in the presentation details of the specific page item will set it only for that one instance of the control and will not affect any other instances of that control. In case you are having trouble to find where these options can be set in Presentation Details, the following screenshot may be able to help: More information: Blog post I wrote for getting started with HTML Caching Another blog post on the subject that I used as a reference when writing my post and which helped me get started with HTML Caching too
How to Disable Cache for One Page I have a detail page that takes a query-string argument called CID and uses that CID to get a record from a SQL database. The sitecore/site/cacheHtml attribute is set to true. We want to keep caching enabled for the other pages in the site, but after I load this detail page once, it does not matter what CID I send to it, it always loads the first one that was sent. If I clear the cache using sitecore/admin/cache.aspx, it will load a new page. But, then that new page is cached. I am using Sitecore 7.5 right now. We will be upgrading to 8.1 in a month or so. This question has been asked here: https://stackoverflow.com/questions/6263747/disable-sitecores-html-cache-for-one-item But, this group gets a lot more traffic and I thought it would be useful to ask here.
Sitecore has several rules available for setting up personalization based on geo information (e.g. City, Country, Region, ...). You can read all about it here on the doc site. With those rules and the personalization functionality to hide components this is possible. Make sure to read this thread as well though.
Specific Rules to exclude Geo Locations We are working on personalize the content based on Geo location. We have requirement not to show specific content for some locations. Are there any rules or any other ways available to exclude any specific location for some content(e.g. Country, State, City etc.)?
Looks like this is sitecore's normal behaviour. Here is the nice article which solves your issue. http://www.doodle.co.uk/blogs/2015/03/03/restricting-access-to-sitecore-media-items summary: Setting up <setting name="Authentication.SaveRawUrl" value="true" /> creating a new media Request handler that inherits from MediaRequestHandler updating web.config to say sitecore use the new request handler rather than the sitecore's default one.
No returnUrl property for secured media links I've got authentication set up on certain pages of my website, with anonymous access denied. For regular items/pages, this works like regular forms authentication as you'd expect - click a link or go to the page, you're sent to the login page with a returnUrl query string to send you back where you started after. This doesn't appear to be the case for media items, though. If I add a link to a similarly-protected media item in a rich text editor, for example, and I click the link, I'm taken to the login page as expected, but no returnUrl property is added on. Is this normal behavior in Sitecore, or can it be altered to provide the returnUrl for media items? This is Sitecore 8.1 Update 2, if that comes into play as a later fix.
Mechanics of the Contact Manager You are using the ContactManager class. Underneath, it uses two storage types: ContactRepository which works with the Collection database; SharedSessionStateManager which works with the Shared Session. When you call .TryLoadContact(contactId), the contact is locked in the Collection DB and loaded into the Shared Session. It is then also locked in the Shared Session so that your current thread can work with the contact exclusively. Next time you call .TryLoadContact(contactId), the contact will be locked and loaded from the Shared Session without querying the Collection DB (where it is already locked to the current web cluster). When you call .SaveAndReleaseContact(contact), the contact is released in the Shared Session, so other threads and members of the web cluster can use it. It is not released in the Collection DB though - it remains locked until the Shared Session expires. The correct way to release a contact If you want the contact to be unlocked in the Collection DB (via the underlying Contact Repository), the method you should call instead is: contactManager.SaveAndReleaseContactToXdb(contact.ContactID); This method will remove the contact from the Shared Session, then save and unlock it in the Collection Database. Note that a call to this method will force the SaveAndReleaseContact to be called first. The overrides of TryLoadContact contactManager.TryLoadContact(Guid contactId); contactManager.TryLoadContact(Guid contactId, bool exclusive); contactManager.TryLoadContact(Guid contactId, int lockDurationMinutes); The above three methods all end up calling this method: contactManager.TryLoadContact(Guid contactId, int lockDurationMinutes, bool exclusive); exclusive The exclusive argument defaults to true if unspecified. This argument defines whether to lock the contact in the Shared Session exclusively. If it's set to true, that means you intend to change the contact. This means that other threads will have to wait before they can get the contact from the Shared Session. Note that, using the above methods, the contact will always be locked in the Collection DB. If you want to read a contact from the Collection DB without obtaining an exclusive lock, you should use another method: contactManager.LoadContactReadOnly(Guid contactId); lockDurationMinutes This argument defaults to (roughly) the length of the current private (ASP.NET) session + 1 minute. It determines for how many minutes the contact should stay locked in the Collection DB.
Contact locking options I am trying to update the contact facet properties using next code (trimmed example)... var contactManager = Factory.CreateObject("tracking/contactManager", true) as ContactManager; Contact contact = null; var lockResult = contactManager.TryLoadContact(contactId); switch (lockResult.Status) { case LockAttemptStatus.Success: contact = lockResult.Object; contact.ContactSaveMode = ContactSaveMode.AlwaysSave; default: contact = null; } if (contact != null) { // update contact properties. contactManager.SaveAndReleaseContact(contact); } While I am doing this, the contact is in active engagement flow. After I updated the contact and the method contactManager.SaveAndReleaseContact(contact) was called, I am trying to execute a trigger in the engagement flow for this contact. And it does not work because the contact is still locked. I can see log message: ERROR Sitecore.Analytics.Automation.AutomationContactManager: Cannot obtain lock on contact: 64dec422-f08d-4932-8369-7313d60b530f. Status: AlreadyLocked So the question is.. how to make sure the contact is successfully released? I can also see there are overloads for TryLoadContact method: contactManager.TryLoadContact(Guid contactId); contactManager.TryLoadContact(Guid contactId, bool exclusive); contactManager.TryLoadContact(Guid contactId, int lockDurationMinutes); contactManager.TryLoadContact(Guid contactId, int lockDurationMinutes, bool exclusive); Does anyone know what the bool exclusive means and the int lockDurationMinutes? that int lockDurationMinutes - will it release the lock once the specified minutes passed? how and when we can use the bool exclusive option? Is there a way to release the contact on demand?
Solution HashingUtils.ProtectAssetUrl(string url) and HashingUtils.GetAssetUrlHash(string url) take the full URL path into account when generating the hash. So there are no adjustments in the algorithm that you need to make. Just use this code: string imageUrl = // get the URL imageUrl = HashingUtils.ProtectAssetUrl(imageUrl); This is all you need to generate a URL with an added hash value. Proof Here's the (reformatted) source code of HashingUtils.GetAssetUrlHash(): public static string GetAssetUrlHash(string url) { url = url.ToLowerInvariant(); UrlString urlString = new UrlString(url); if (!HashingUtils.Proxy.IsMediaUrl(url)) { return string.Empty; } Uri result; string urlPath = (Uri.TryCreate(url, UriKind.Absolute, out result) ? result.LocalPath : urlString.Path).TrimStart('/'); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(string.Format("{0}?", urlPath)); for (int i = 0; i < MediaManager.Config.RequestProtection.QueryParametersToProtect.Count; i++) { stringBuilder.Append( string.Format( "{0}={1}", MediaManager.Config.RequestProtection.QueryParametersToProtect[i], urlString.Parameters[MediaManager.Config.RequestProtection.QueryParametersToProtect[i]])); if (i < MediaManager.Config.RequestProtection.QueryParametersToProtect.Count - 1) { stringBuilder.Append("&amp;"); } } return HashingUtils.ComputeHash(stringBuilder.ToString()); } As you can see, the URL path is used when creating the hash. It's appended to the stringBuilder: stringBuilder.Append(string.Format("{0}?", urlPath)); The urlPath here will be equal to /images/{22EB368A-4AD3-48C8-B1EB-1BC14DE0F7BF}-200-100.jpg in your example.
Change the logic of hashing the images I would like to change the logic of the image hashing. Because our width and height parameters directly in the url. As I checked the HashingUtils class it does not look to easy to change without any risk because it can be used any other assemblies and I already found 3 places where it is used in the Sitecore.Kernel assembly. The problem is that the default implementation only deal with querystring parameters. For example the url should like this: /images/{22EB368A-4AD3-48C8-B1EB-1BC14DE0F7BF}-200-100.jpg?hash=AE8EB10933E68E98C9C65324F9CDF0FA2D3AEBAA And I would like to generate the hash from the part of the url. In this case from 200 and 100. I already implemented a custom MediaProvider which is resolving the media item by ID, width and height. Actually the resolving done by a composite key [ID]-[width]-[height].
Marketing definitions, such as campaigns, are stored and retrieved by using repositories, which may use different storage types. There are three repository types that are shipped with Sitecore: item repositories—these work with definition items directly in the content tree. The default database used is master. rdb repositories use the Reporting database. The reason for this is that some server roles (like the Processing role) 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. I believe that your server is currently misconfigured to use rdb repositories for everything. The default repository for reading data on a CM server should be item, not rdb. Deploying marketing definitions from RDB to RDB wouldn't even make sense. Which is why you're seeing the error. Since the default repositories are item, your configuration must have been patched to change it to rdb. You can easily verify that by opening /sitecore/admin/ShowConfig.aspx and finding the following node under sitecore/marketingDefinitions: <sc.variable name="marketingDefinitions.repository" value="rdb" /> This node will also contain a patch:source attribute saying which .config file patched it. There are several OOTB patch files that may have changed this variable: Sitecore.MarketingProcessingRole.config.disabled Sitecore.MarketingReportingRole.config.disabled Sitecore.Xdb.Remote.Server.config.disabled If any of these files are not disabled, disable them. This will switch the variable marketingDefinitions.repository back to using item as its value. To prevent configuration mistakes in the future, make sure to follow the server role documentation to the letter: https://doc.sitecore.net/sitecore_experience_platform/81/setting_up__maintaining/xdb/configuring_servers/configuring_servers
Deploy Marketing Definitions Error "Rdb Taxonomy repositories do not support data export" I have a site that has been upgraded from 7.5 to 8.1 and currently I'm on production deployment. I used a new SQL reporting database and MongoDB collections. I noticed that the campaigns hadn't been records if I accessed the Sitecore Analytics and checked the reports related to campaigns I can't see any data, In addition, the personalization rules based on campaigns are not working too. I tried to redeploy marketing definitions from the control panel and I got the following error in log files: ManagedPoolThread #11 2016:12:09 08:19:52 ERROR Exception Exception: System.Reflection.TargetInvocationException Message: Exception has been thrown by the target of an invocation. Source: mscorlib at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) at Sitecore.Jobs.JobRunner.RunMethod(JobArgs args) at (Object , Object[] ) at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) at Sitecore.Jobs.Job.ThreadEntry(Object state) Nested Exception Exception: System.NotImplementedException Message: Rdb Taxonomy repositories do not support data export. Source: Sitecore.Analytics at Sitecore.Analytics.Reporting.DefinitionData.Taxonomy.RdbTaxonomyRepository.GetAll(ID rootId) at Sitecore.Analytics.Reporting.DefinitionData.Taxonomy.Deployment.DeployManager.DeployAsync(ID rootId) at Sitecore.Analytics.Reporting.DefinitionData.Taxonomy.Deployment.DeployManager.Deploy(ID rootId) Any ideas?
My problem is not solved, but technically I figured out the answer to my question, which was how to view what is registered by Glass. In GlassMapperSc.cs, which comes with Glass MApper, you can view the GlassContext and peruse the TypeConfigurations property to view what is registered.
Glass Mapper Get Children Derived From Type I am trying to create an an extension method to get all children of a derived type. This would be an extension method on my base glass item. But it returns null. Here is my method: I register my types for preload like this: var attributes = new AttributeConfigurationLoader("DD.Domain"); return new IConfigurationLoader[]{ attributes }; My base glass item has a Children property like this: [SitecoreType(AutoMap = true)] public partial interface IBaseGlassItem : ISitecoreItem { [SitecoreChildren(InferType = true)] IEnumerable<IBaseGlassItem> Children { get; } } public partial interface ISitecoreItem { [SitecoreId] ID ID { get; set; } [SitecoreInfo(SitecoreInfoType.TemplateId)] ID TemplateID { get; set; } } Then I try to get some items: public static IEnumerable<TChild> GetChildrenDerivedFrom<TChild>(this IBaseGlassItem item, ID templateId) where TChild : class, IBaseGlassItem { var children = item.Children.Where(c => c.IsDerived(templateId)).OfType<TChild>(); return children; } And here is my type that I am actually trying to get: [SitecoreType(AutoMap = true, TemplateId = PromotionOrEventDetailsFieldsConstants.TemplateIdString)] public interface IPromotionOrEventDetailFields : IBaseGlassItem { [SitecoreField] Image Image { get; set; } [SitecoreField] string HoverText { get; set; } [SitecoreField] string ShortTitle { get; set; } [SitecoreField] string Caption { get; set; } [SitecoreField] Item ColorTheme { get; set; } } But this never works because the .OfType<Tchild> ends up returning null because it thinks the children are of type IBaseGlassItem. I suspect that maybe my types are not registered but how can I confirm this? UPDATE I figured out how to view what Glass Mapper has registered, and that is not the problem. My item is registered.
Latest released version was WeBlog 2.4 which supports Sitecore 7.0, 7.2, 7.5, 8.0 Versions for 8.1 and 8.2 were not released yet, Once we release it you will find packages here: Marketplace: https://marketplace.sitecore.net/Modules/W/WeBlog.aspx?sc_lang=en Github repository: https://github.com/WeTeam/WeBlog/releases We are currently testing release packages and everything looks promising. We need to close all these issues before the release. Cannot say anything more regarding ETA. Our plan is to support every version starting from Sitecore 7.2. Some packages might appear earlier than the other. The highest priority have versions 8.1 and 8.2
Weblog Module for Sitecore 8.2 initial release I have recently upgraded to Sitecore 8.2 initial release from Sitecore 8.1 Update 2. I was looking for an upgrade for the Weblog module for sitecore 8.2 as there are lots of changes happened and the weblog doesn't work anymore. Any idea if there is an upgrade or a new weblog module i can use. Thanks,
Is using a single, reused context a good approach? Yes. It is the recommended approach. Are there any pitfalls? Yes. New documents added to your indexes will not show, until you re-open a new Search Context. So you may need to tie in your SearchContext to index update events. Are there any good code examples of doing this, possibly with a dependency injection framework handling a singleton. Because of the pitfalls, setting this up in a DI Singleton is probably not a good idea. For an on-source reference and explanation, see Sitecore 7 Patterns for Global Search Context Reuse
Singleton search context for search api Typical usage of search api uses a using statement to dispose of the search context. using (var context = ContentSearchManager.GetIndex(_indexName).CreateSearchContext()) { var hits = context.GetQueryable<SearchResult>(); return hits; } This runs into a problem with hits.result or lucene reader being disposed before it can be used by the calling method. This may be more likely if creating a search service rather than calling this (for example) within an MVC controller. Often this disposal problem is addressed by calling ToList() creating an IEnumerable<SearchResult> and returning that instead. return hits.ToList() By doing this, we loose hits.GetResults() and the properties within - Hits, TotalSearchResults and Facets An alternative approach mentioned is to use a single search context that is not disposed and instead reused across the application. Question Is using a single, reused context a good approach? Are there any pitfalls? Are there any good code examples of doing this, possibly with a dependency injection framework handling a singleton.
Your field is configured TOKENIZED, change it to UNTOKENIZED so that the values are not split when stored in the index. <field fieldName="tagsfacet" indexType="UNTOKENIZED" ...> ....
Display custom bucket tags by name instead of GUID Sitecore 8.1 I created several custom tags in my TagRepository folder that work great, but when I look at them in a bucket they display as GUIDs. After some research, I implemented a computed index field that displays the tags as their actual text. However, the problem I am running into is the fact that the computed index field delimits spaces as separate tags (for example "Evening MBA" gets rendered as "Evening" and "MBA" separately). Supposedly a Lucene analyzer should be able to fix this but it doesn't seem to work and I'm not seeing any relevant errors in my Sitecore logs. My included config: <?xml version="1.0" encoding="utf-8" ?> <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <contentSearch> <indexConfigurations> <defaultLuceneIndexConfiguration> <fields hint="raw:AddComputedIndexField"> <field fieldName="tagsfacet" storageType="yes" indexType="untokenized" returnType="string">WSB.CMS.Utilities.ComputedIndexFields, WSB.CMS.Utilities</field> </fields> <fieldMap> <fieldNames hint="raw:AddFieldByFieldName"> <field fieldName="tagsfacet" storageType="YES" indexType="TOKENIZED" vectorType="NO" boost="1f" type="System.String" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider"> <Analyzer type="Sitecore.ContentSearch.LuceneProvider.Analyzers.LowerCaseKeywordAnalyzer, Sitecore.ContentSearch.LuceneProvider" /> </field> </fieldNames> </fieldMap> </defaultLuceneIndexConfiguration> </indexConfigurations> </contentSearch> </sitecore> </configuration> My Computed Index Field: class ComputedIndexFields : IComputedIndexField { public string FieldName { get; set; } public string ReturnType { get; set; } private static readonly ID Semantics = new ID("{A14F1B0C-4384-49EC-8790-28A440F3670C}"); public object ComputeFieldValue(IIndexable indexable) { var indexableItem = indexable as SitecoreIndexableItem; return indexableItem == null ? null : indexableItem.Item.GetMultiListValues(Semantics).Select(tag => tag.DisplayName).ToList(); } } public static class HelperMethods { public static IEnumerable<Item> GetMultiListValues(this Item item, ID fieldId) { return (new MultilistField(item.Fields[fieldId])).GetItems(); } }
We ran into the same issue on our CM server (Sitecore 8.1 Update 3, robot detection disabled) and found we had to do the following as detailed on a different documentation page https://doc.sitecore.net/sitecore_experience_platform/setting_up__maintaining/xdb/configuring_servers/disable_robot_detection_on_a_content_management_server Change: <configuration> <system.webServer> <modules> <add type="Sitecore.Analytics.RobotDetection.Media.MediaRequestSessionModule, Sitecore.Analytics.RobotDetection" name="MediaRequestSessionModule" /> </modules> </system.webServer> </configuration> to <configuration> <system.webServer> <modules> <add type="Sitecore.Analytics.Media.MediaRequestSessionModule, Sitecore.Analytics" name="MediaRequestSessionModule" /> </modules> </system.webServer> </configuration>
Media Request Analytics Failed I got the following error in the log files of my upgraded site: 2628 2016:12:09 13:07:13 ERROR Media request analytics failed Exception: System.InvalidOperationException Message: Tracker.Current.Session.Interaction is not initialized Source: Sitecore.Kernel at Sitecore.Diagnostics.Assert.IsNotNull(Object value, String message) at Sitecore.Analytics.Media.MediaRequestEventHandler.OnMediaRequest(Object sender, EventArgs args) Any ideas what is the cause of this?
Your problem is that the default settings i.e. the manager root has not been created. Go to the EXM dashboard, click the Default Settings button and enter the details. The settings are explained here. When creating the manager root, a Global Opt-Out list is created. This list does not exist in your environment, which is why you're seeing the error.
EXM error: Empty strings are not allowed. Parameter name: listId On a clean install of Sitecore 8.2.1 with EXM 3.4 installed, we're receiving a message of "A serious error occurred please contact the administrator" when attempting to add an Included List in the Recipients section of a new Email Experience Manager campaign. In the EXM log we see this: 6988 10:58:45 ERROR Empty strings are not allowed. Parameter name: listId Exception: System.ArgumentException Message: Empty strings are not allowed. Parameter name: listId Source: Sitecore.Kernel at Sitecore.Diagnostics.Assert.ArgumentNotNullOrEmpty(String argument, String argumentName) at Sitecore.ListManagement.ListManager'2.FindById(String listId) at Sitecore.Modules.EmailCampaign.RecipientManager.GetGlobalOptOutRecipients() at Sitecore.Modules.EmailCampaign.RecipientManager.GetTargetRecipientCountFromGlobalOptOutList() at Sitecore.Modules.EmailCampaign.Core.MessageStateInfo.get_NumSubscribersFromGlobalOptOutList() at Sitecore.EmailCampaign.Server.Services.MessageInfoService.GetRecipientsFromGlobalOptOutList(MessageStateInfo info) at System.Linq.Enumerable.WhereSelectListIterator'2.MoveNext() at System.Linq.Enumerable.WhereSelectEnumerableIterator'2.MoveNext() at System.Collections.Generic.List'1..ctor(IEnumerable'1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable'1 source) at Sitecore.EmailCampaign.Server.Controllers.MessageInfo.MessageInfoController.MessageInfo(MessageInfoContext data)
Saying "I'm not ready for PaaS" is like saying "I'm not ready to get my electricity from a hole in the wall, we want to see all the Tesla coils actually generating the electricity so we can be sure it's real electricity. We need to control how often the coils are cleaned." Azure PaaS is just IIS without all the Windows bits accessible. If you're making a website, why do you care about the O/S hosting the web server? The world has been using PaaS web servers in the form of cPanel for an eon from every small hosting shop anywhere. This is not cutting edge stuff. The good news is that you can build your site with almost no consideration for PaaS or Iaas (remember PaaS is just someone else's computer) as they are really just both IIS in the end. There are a few platform considerations you need to make if you plan to scale your environment, though. When you need to go to 2 instances, you need to treat it like 2 servers behind a load balancer with a shared file system (can you guess why? 'cause that's what it is). In this setup Solr is better than Lucene, Redis/Mongo session is better than InProc. The remaining considerations (like the Sitecore "data" folder handling) should be managed through the platform itself. I haven't had a close look at 8.2.1 yet but I'm reliably informed the last few bit that caused complications have been re-engineered to cope properly. Either way, adding the {COMPUTERNAME} into file system paths will usually suffice to keep instances from tripping over each other. I'd suggest running your CM on a single instance though, unless you have very heavy publishing needs. Don't forget that you can attach a debugger to a PaaS IIS just like you can with a VM. What else does the VM really give you that you can't give up? There's so many good reasons to go Paas: Automatic backups Multiple deployment slots Fast scaling No more Windows updates No O/S "hardening" Minimal attack surface No more infrastructure to configure and maintain NICs Firewalls / Network security groups Virtual networks Disks &amp; disk space management Swap space Memory management What's not to like?
Migrating to Azure PaaS We are planning to build a site from scratch on Sitecore 8.2 update 1 and are struggling to decide between Azure PaaS and IaaS. While we are excited about PaaS, we feel organization wise, we are not ready to dive into PaaS just yet. Assuming there is an opportunity to move to PaaS in future, is the path to developing Sitecore sites same for both IaaS and PaaS? How easy or difficult would it be to move an existing site written in 8.2 update 1 non-Azure to Azure PaaS? Any architecture guidelines we need to follow so that future PaaS migration is possible?
You need to register Address as your IAddress implementation in Sitecore configuration. You can see how it is done in Sitecore.Analytics.Model.config. Basically, you'd have a patch file along the lines of: <?xml version="1.0" encoding="utf-8"?> <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <model> <elements> <element interface="SomeNamespace.IAddress, SomeAssembly" implementation="SomeNamespace.Address, SomeAssembly" /> </elements> </model> </sitecore> </configuration>
How to add a custom xDB facet to an IElementCollection facet I am implementing custom xDB facets in Sitecore 8.1-3. I have a facet called "Marketing Data". Most of the elements of "Marketing Data" are simple strings. I also have an element called "Shipping Addresses" that is a list of "Address" elements. It is unclear to me how to add a new element to the list. I see that the IElementCollection class has a Create method, but no Add method. My Marketing Data facet interface looks like this public interface IMarketingData : IFacet { string Organization { get; set; } string Industries { get; set; } string ProductTypes { get; set; } IElementCollection<IAddress> ShippingAddresses { get; } } The implementation of Marketing Data looks like this [Serializable] public class MarketingData : Facet, IMarketingData { private const string ORGANIZATION = "Organization"; private const string INDUSTRIES = "Industries"; private const string SHIPPINGADDRESSES = "ShippingAddresses"; private const string PRODUCTTYPES = "ProductTypes"; public string Organization { get { return GetAttribute<string>(ORGANIZATION); } set { SetAttribute(ORGANIZATION, value); } } public string Industries { get { return GetAttribute<string>(INDUSTRIES); } set { SetAttribute(INDUSTRIES, value); } } public IElementCollection<IAddress> ShippingAddresses { get { return GetCollection<IAddress>(SHIPPINGADDRESSES); } } public string ProductTypes { get { return GetAttribute<string>(PRODUCTTYPES); } set { SetAttribute(PRODUCTTYPES, value); } } public MarketingData() { EnsureAttribute<string>(ORGANIZATION); EnsureAttribute<string>(INDUSTRIES); EnsureCollection<IAddress>(SHIPPINGADDRESSES); EnsureAttribute<string>(PRODUCTTYPES); } } The interface for my address facet looks like this public interface IAddress : IElement { Guid Id { get; set; } string Company { get; set; } string Address1 { get; set; } string Address2 { get; set; } string City { get; set; } string Country { get; set; } string State { get; set; } string PostalCode { get; set; } } Then I have code where I want to add a new address to an existing contact. It looks like this ...code to get a contact from xDB and put it in lockedContact variable... var marketingInfo = lockedContact.GetFacet<IMarketingData>("Marketing Data"); marketingInfo.Organization = txtOrganization.Text; marketingInfo.Industries = txtIndustries.Text; marketingInfo.ProductTypes = txtProductTypes.Text; var newAddress = marketingInfo.ShippingAddresses.Create(); //Fails here newAddress.Address1 = txtAddress1.Text; newAddress.Address2 = txtAddress2.Text; newAddress.City = txtCity.Text; newAddress.State = txtState.Text; newAddress.Country = txtCountry.Text; newAddress.PostalCode = txtPostalCode.Text; newAddress.Company = txtCompany.Text; Am I using the Create method correctly? It doesn't seem like there is any way to pass an object in to the Create method so I am unsure how I would set the different address properties.
Here's how I solved the problem. First, I created a helper method GetSiteContext that returns a SiteContext object based on a URL. This helper method iterates through all configured sites and tries to match them to the host name of the URL. If no site matches, the context of the website is returned. public static SiteContext GetSiteContext(Uri requestUrl) { Assert.ArgumentNotNull(requestUrl, "requestUrl"); string requestHostName = requestUrl.Host; foreach (SiteInfo siteInfo in Factory.GetSiteInfoList()) { if (IsMatch(requestHostName, siteInfo.HostName) || IsMatch(requestHostName, siteInfo.TargetHostName)) { return new SiteContext(siteInfo); } } return SiteContext.GetSite("website"); } private static bool IsMatch(string input, string wildcardPattern) { if (string.IsNullOrWhiteSpace(input) || string.IsNullOrWhiteSpace(wildcardPattern)) { return false; } string regexPattern = WildcardToRegex(wildcardPattern); return Regex.IsMatch(input, regexPattern, RegexOptions.IgnoreCase); } You can see a usage example below. In this code, I am obtaining a site context based on the current request URL. var siteContext = GetSiteContext(HttpContext.Current.Request.Url); Item item; if (siteContext != null) { item = DatabaseProvider.MasterDatabase.GetItem(siteContext.RootPath + siteContext.StartItem); } Articles that helped me in resolving the issue: https://reasoncodeexample.com/2014/10/24/resolving-the-sitecontext-by-url/ https://briancaos.wordpress.com/2016/05/30/sitecore-get-host-name-from-a-different-context/ http://firebreaksice.com/sitecore-context-site-resolution/ https://soen.ghost.io/sitecore-sitecontext-and-contextdatabase-oh-my/ https://ctor.io/correctly-switching-sitecore-contextes/
Unable to get the correct `rootPath` from Sitecore.Context.Site In my code, I'm trying to access the root path for the current site. Let's say I'm accessing my website http://mywebsite. Here is the site definition: <site patch:before="site[@name='website']" name="SomeSite" hostName="mywebsite" rootPath="/sitecore/content/Somesite" startItem="/home" database="master" loginPage="/login" ... /> When I try to get the root path, all methods I've tried return /sitecore/content. What I want to get is /sitecore/content/Somesite, which is what I've specified on the site definition. I tried the following: Sitecore.Context.Site.RootPath foreach(var site in Sitecore.Configuration.Factory.GetSiteInfoList()) Sitecore.Context.Site.ContentStartPath (which returns null) Is there something I'm missing, like passing the current hostname or something that can pick the complete root path?
You have dlls that are old and new in your bin directory. Back up your bin folder of your current site. Then open the Sitecore zip file for 8.2 rev 161115. Copy all the dlls from the bin folder in the zip into your bin folder and test. How the dlls got there You should check your deployments for this site to make sure that old dlls are not coming from development. Also use Sitecore's nuget for your references in Visual studio. This will help keep them are the right and specific versions. If you have custom caching code written, you will need to update it to the new code. https://breaksitecoreblog.wordpress.com/2016/09/06/sitecore-8-2-cache-changes/ Changes in 8.2 Taken from this post (Sitecore.Caching.CustomCache changes with 8.2) The CacheManager has now been abstracted to a BaseCacheManager, in line with many of the other Dependency Injection changes in 8.2. The Cache class has been abstracted to an ICache, allowing for other cache implementations in the future (e.g. Redis). Statics on the Cache class for finding/creating a cache are no longer present -- you must utilize the CacheManager. The base cache implementation can now estimate object sizes itself, and all size arguments have been eliminated from the Add overloads on the cache. So above in your question, you can simply eliminate your third argument. The event handler it is looking for in your compiler error is an optional callback for when the object is removed from the cache. If you really want to handle the size calculation yourself, there is the an ICacheSizeCalculationStrategy, which is set on a property of Cache<T>, but the setter appears to be private at this time. You would need to provide your own ICache implementation. But this really is overkill -- in most production deployments you'll be disabling cache size limitations anyway.
Sitecore 8.2 Update 1 error: Method not found: Sitecore.Caching.CustomCache.get_InnerCache() After installing Sitecore and adding my existing working project, I am getting an error when I select the site Home item from the Content Editor. The stack trace is as below: Method not found: 'Sitecore.Caching.Cache Sitecore.Caching.CustomCache.get_InnerCache()'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.MissingMethodException: Method not found: 'Sitecore.Caching.Cache Sitecore.Caching.CustomCache.get_InnerCache()'. Stack Trace: [MissingMethodException: Method not found: 'Sitecore.Caching.Cache Sitecore.Caching.CustomCache.get_InnerCache()'.] Sitecore.Social.MessagePosting.Cache.MessagesByContainerCache.ContainsKey(MessagesByContainerCacheKey key) +0 Sitecore.Social.MessageBusinessManager.SearchMessagesByContainer(String container) +131 Sitecore.Social.MessageBusinessManager.GetMessagesCount(String container) +16 Sitecore.Social.Client.MessagePosting.Commands.SocialCenter.RunGetHeader(CommandContext context, String header) +342 Sitecore.Web.UI.WebControls.Ribbons.Ribbon.FillParamsFromCommand(CommandContext commandContext, RibbonCommandParams ribbonCommandParams) +94 Sitecore.Web.UI.WebControls.Ribbons.Ribbon.GetCommandParameters(Item controlItem, CommandContext commandContext) +79 Sitecore.Web.UI.WebControls.Ribbons.Ribbon.RenderLargeButton(HtmlTextWriter output, Item button, CommandContext commandContext) +78 Sitecore.Web.UI.WebControls.Ribbons.Ribbon.RenderButton(HtmlTextWriter output, Item button, CommandContext commandContext) +440 Sitecore.Web.UI.WebControls.Ribbons.Ribbon.RenderChunk(HtmlTextWriter output, Item chunk, CommandContext commandContext) +343 Sitecore.Web.UI.WebControls.Ribbons.Ribbon.RenderChunk(HtmlTextWriter output, Item chunk, CommandContext commandContext, Boolean isContextual, String id) +244 Sitecore.Web.UI.WebControls.Ribbons.Ribbon.RenderChunk(HtmlTextWriter output, Item chunk, CommandContext commandContext, Boolean isContextual) +161 Sitecore.Web.UI.WebControls.Ribbons.Ribbon.RenderChunks(HtmlTextWriter output, Item strip, CommandContext commandContext, Boolean isContextual) +449 Sitecore.Web.UI.WebControls.Ribbons.Ribbon.RenderStrips(HtmlTextWriter output, Item ribbon, Boolean isContextual, ListString visibleStripList) +1807 Sitecore.Web.UI.WebControls.Ribbons.Ribbon.RenderStrips(HtmlTextWriter output, Item defaultRibbon, Item contextualRibbon, ListString visibleStripList) +162 Sitecore.Web.UI.WebControls.Ribbons.Ribbon.Render(HtmlTextWriter output) +800 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +80 Sitecore.Web.HtmlUtil.RenderControl(Control ctl) +80 Sitecore.Shell.Applications.ContentManager.ContentEditorForm.UpdateRibbon(Item folder, Boolean isCurrentItemChanged, Boolean showEditor) +502 Sitecore.Shell.Applications.ContentManager.ContentEditorForm.Update() +600 Sitecore.Shell.Applications.ContentManager.ContentEditorForm.OnPreRendered(EventArgs e) +172 [TargetInvocationException: Exception has been thrown by the target of an invocation.] System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0 System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +128 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +146 Sitecore.Reflection.ReflectionUtil.InvokeMethod(MethodInfo method, Object[] parameters, Object obj) +89 Sitecore.Shell.Applications.ContentManager.ContentEditorPage.OnPreRender(EventArgs e) +143 System.Web.UI.Control.PreRenderRecursiveInternal() +107 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +7675
Here's a list of services that xDB Cloud officially provides: xDB Cloud - Service Catalog and Policies As you can see, there's nothing about importing data to the cloud. Only an export option: xDB Set export | Customers can obtain an export/backup of their collectionsDB data Having personally spoken with xDB Cloud technicians, I understand that they may in some cases restore your MongoDB backup for you, but that is not something they normally do. So you'll need to contact your regional sales department and/or Sitecore Support to see if this will be possible. Note that if you have any xDB-related customizations in your solution, they will not be supported in xDB cloud. This concerns custom segments, facets, etc. that you may have been using on premise.
Migrating xDB data to cloud We have our xDB setup on one of our server and we are now migrating to xDB cloud. We have just taken xDB cloud subscription. Can you please suggest the tool to migrate the content?