output
stringlengths 34
25.7k
| instruction
stringlengths 81
31k
| input
stringclasses 1
value |
---|---|---|
It seems that Sitecore cannot resolve a custom namespace (it maybe be used on layout or rendering view)
First, make sure that dll with Trallcore type (is it a type?) is present in your bin folder.
Next
Please check whether your Views folder (folder where a view where this particular view with Tralcore (using Tralcore) reference is used) contains the web.config with missing namespace.
or
If you are not using your own web.config, please make sure you provide a full namespace to the Trallcore type (is it a type?)
For example.
Assuming you are using type Item.
using Item might not be enough (if there is no namespace in a web.config)
and you have to write something like this (in your View's code)
using Sitecore.Data.Item
|
The type or namespace name of solution could not be found
I have a fresh installation of Sitecore 8.2 MVC 4.6.1. There is a custom item called Home and it has a layout. When previewing this item, it gives this compilation error.
Why is it reading from a temp file. How can i fix this.
Default.cshtml
@using Sitecore.Mvc
@using Sitecore.Mvc.Analytics.Extensions
@using Sitecore.Mvc.Presentation
@model RenderingModel
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div class="container">
@Html.Sitecore().Placeholder("page-content")
</div>
</body>
</html>
| |
You can use <patch:delete /> to achieve this. It will look like:
<sitecore>
<contentSearch>
<configuration>
<indexes>
<index id="xxxxx">
<strategies hint="list:AddStrategy">
<patch:delete />
</strategies>
<strategies hint="list:AddStrategy">
<strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/manual" />
</strategies>
</index>
</indexes>
</configuration>
</contentSearch>
</sitecore>
|
Patching to remove index update strategies
While configuring cd instance on SOLR one has to remove index update strategies and set to manual from index definitions on cd server.
Can we do that using sitecore patching?
| |
I believe the problem is the hash (#) signs instead of quotes (') around values.
This is a sample query from the Item Web API documentation:
/sitecore/content/Home/*[@Title='Welcome to Sitecore']
Documentation link (old, but I could not find any more recent):
https://sdn.sitecore.net/upload/sdn5/modules/sitecore%20item%20web%20api/sitecore_item_web_api_developer_guide_sc65-66-usletter.pdf
Hash (#) signs are used to escape item names in the path and field names when they contain protected characters and words:
/sitecore/content/Home/#our-products#/*[@#category-type#='something']
See e.g. these links for more details on the query syntax:
https://community.sitecore.net/technical_blogs/b/sitecorejohn_blog/posts/sitecore-query-cheat-sheet
https://sdn.sitecore.net/Reference/Using%20Sitecore%20Query/Sitecore%20Query%20Syntax.aspx
|
How to use Sitecore Item Web Api and query for a Sitecore item with a particular value in the field?
I am trying to query for a Sitecore item where a particular field has a particular value but am not successfull in doing so.
I am trying to do http://sc8/-/item/v1/?query=/sitecore/content/Home/*[@Title=#Welcome to Sitecore#]
The response I am getting is
{
"statusCode": 400,
"error": {
"message": "Bad Sitecore query (/sitecore/content/Home/*[@Title)."
}
}
Can any one correct me please?
| |
To me this makes sense as a default behavior for Glass (as seen here)... if an item is loaded in a language, traversing other content off that item should be in the same language.
This is why Glass Maps and delegates are great, imho, because you can easily override these behaviors or otherwise introduce your own mapping logic.
For example, assuming that Config is your configuration (in English) and ConfigReference is the type you want to retrieve from the Config Reference field (in the context language):
public class ConfigGlassMap : SitecoreGlassMap<Config>
{
public override void Configure()
{
Map(config =>
{
config.Delegate(x => x.ConfigReference).GetValue(context =>
context.Service.GetItem<ConfigReference>(Guid.Parse(context.Item["Config Reference"]), Sitecore.Context.Language));
});
}
}
|
Load referenced item in context language with Glass Mapper
I have a multi-language website running Sitecore 8.1 and using Glass Mapper 4.2.1. The content is translated in all needed languages, but the configuration item exist only in English.
When I now have the Sitecore.Context.Language to German and load a configuration item, Glass Mapper is loading this in English. That's ok and wished, as this item is not existing in German. Within this configuration item I have a property to a referenced item that exists in English, German and French. Unfortunately Glass Mapper now loads this item in English, as the configuration item is loaded in English instead of using the Sitecore.Context.Language. Is there a possibility to load the referenced item directly in the Sitecore.Context.Language?
Best regards,
Thomas
| |
Yes, there is. Adding another computed index field with the same field name will actually append the value of your computed index field to the end of the existing value of the field with the same name.
Often times, developers leverage this behavior in order to add to the indexed text content on an item, which is stored in the _content field. By adding a custom computed index field that is also named _content, developers are able to add to the existing field value without replacing what is currently there.
While I know that you said that the order doesn't matter, I would also like to mention that the order of the "content" indexed in the field value will be the same as the order in which the "content" was added to the field.
|
Appending index fields in Lucene
Does anyone know if it is possible to append a Lucene computed index field's value? Say that there is a computed index field that stores a list of ids based on some generic logic. Then there is an edge case where some more ids would need to be added. The problem is that I can't inherit or override the original computed index field with the one for the edge case, the two computed field classes are in unrelated assemblies. The order in which the ids (regular or edge case) are populated into the field doesn't matter.
Thanks!
| |
It might be possible to achieve this with a little hackery (if you can stomach it)...
Unfortunately, as you correctly identified, the RuleFactory is static, and therefore you can't replace it directly. However, in the version of Sitecore you're using, it appears that the private Cache field in the RuleFactory static class acts as a gateway for accessing all rules in the system. This in turn uses an underlying Sitecore Cache named 'rules'.
So, what you might be able to do is create a new processor in the <initialize> pipeline to replace the 'rules' Cache in Sitecore with your own implementation. Every time an item (RuleList<T>) is added to the cache, you should simply wrap it in a custom RulesList<T> implementation.
The purpose of this wrapper RulesList<T> implementation would be to override the virtual Run() method, which should allow you to keep track of a thread-local stack for each time a rule is used, allowing you to create a heuristic algorithm for detecting cycles.
Regarding the heuristic model: I don't think you'll be able to deterministically detect a cycle in a rule chain, simply because doing so would require you to solve the Halting Problem, so simply counting the depth of the current stack (and bailing at a certain number) may be your only option.
Of course, in Sitecore 8.2, replacing the RuleFactory is trivial :)
|
Capture Rules Engine Stack Overflows
It is possible within the rules engine to create a scenario where a set of rules cause an infinite loop. Take for example the following rule that has a When Condition to itself:
This example is very simple but when you have some very complex rules then this loop isn't obvious to the Content Editor or Developer (e.g. the loop could be caused by 4 or 5 chained rules).
This loop causes a Stack Overflow exception which brings the entire server down.
Has anyone written anything to detect these loops or found another way to solve this?
Unfortunately looking at the RuleFactory class it is static so can't be replaced. I was hoping to maybe use something like the RuleStack class but the RuleStack is not global to all rules, a new one is created when the WhenCondition is called.
Any ideas? We are using Sitecore 8.1 U3.
| |
I have checked through the decompiled source and apparently those events are quite decoupled from each other.
For your particular case I would recommend you to introduce some kind of a flag field (e.g. IsCopy) on the template and use the item:copying/copied event to set that flag to true on the copy item. After that you can easily check that field value in the item:created event.
The solution is quite dirty, but to me it sounds like the easiest way of implementing the requirement.
|
Is there a way to find out what caused an `item:created` event?
I wrote a custom item:created event handler that creates an item of template B whenever an item of template A is created. It works well, except for the cases when the parent folder is being duplicated—then I don't want a new B item created, as there will be a duplicated B item anyway.
In my item:created handler, is it possible to find out whether the item is being created "from scratch", or if it's being copied/duplicated from an existing item?
| |
GetPlaceholderRenderings pipeline will be executed for each placeholder on the page so you will be able to process each nested placeholder and a make decision about available renderings.
Your Process method accepts GetPlaceholderRenderingsArgs type as an argument.
GetPlaceholderRenderingsArgs type contains:
PlaceholderRenderings - list of Rendering items.
PlaceholderKey - current placeholder path
PlaceholderKey returns a placeholder path (not single placeholder key), so you can check whether your currently processed placeholder is nested under content/right-sidebar.
|
Can I access component/placeholder hierarchy from a `getPlaceholderRenderings` processor?
Our solution is using dynamic placeholders. We have a requirement to restrict what renderings can be inserted in the page content (under the content placeholder) and in the sidebar (placeholder right-sidebar). The restriction should be applied on all nesting levels.
What I'd like to do is make a custom getPlaceholderRenderings processor which would return allowed renderings of the content placeholder for every placeholder rendered inside content. The challenge is in finding out the part of the page the placeholder is being rendered in.
| |
You can do in this way:
datasource=/sitecore/content/home&databasename=master
Please find more informations here: http://getfishtank.ca/blog/treelist-data-source-hidden-functionality
|
Is there a way to set a Treelist field in the core database to point to a folder in the master database?
I am creating a Template in core database for a Custom User Profile. I have a Treelist field and I would like to point to a folder in master database. Is it possible?
| |
I had similar issue and I add new config for solr and it works fine
This is the content of the config file : Sitecore.Social.Solr.Index.Analytics.Facebook.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<contentSearch>
<configuration>
<indexes>
<index id="sitecore_analytics_index">
<configuration>
<fieldMap>
<fieldNames hint="raw:AddFieldByFieldName">
<field fieldName="contact.social.facebook.id" returnType="string"/>
<field fieldName="contact.social.facebook.appid" returnType="string"/>
</fieldNames>
</fieldMap>
</configuration>
</index>
</indexes>
</configuration>
</contentSearch>
|
Is the Solr equivalent of Sitecore.Social.Lucene.Index.Analytics.Facebook.config needed when switching from Lucene to Solr?
I'm in the process of migrating indexes from Lucene to Solr for a Sitecore site on Sitecore 8.2 Update 2 (Sitecore 8.2 rev. 161221). I'm disabling the Lucene specific configs and enabling the Solr specific versions of those indexes. This went fine for most of the indexes but there is no Solr specific configuration in the vanilla Sitecore 8.2 install for Sitecore.Social.Lucene.Index.Analytics.Facebook.config.
<indexes hint="list:AddIndex">
<index id="sitecore_analytics_index" type="Sitecore.ContentSearch.LuceneProvider.LuceneIndex, Sitecore.ContentSearch.LuceneProvider">
<param desc="name">$(id)</param>
<param desc="folder">$(id)</param>
<param desc="propertyStore" ref="contentSearch/indexConfigurations/databasePropertyStore" param1="$(id)" />
<param desc="group">experience</param>
<configuration ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration">
<fieldMap ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration/fieldMap">
<fieldNames hint="raw:AddFieldByFieldName">
<field fieldName="contact.social.facebook.id" storageType="YES" indexType="TOKENIZED" vectorType="WITH_POSITIONS_OFFSETS" boost="1f" emptyString="_EMPTY_" nullValue="_NULL_" type="System.String" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider">
<analyzer type="Sitecore.ContentSearch.LuceneProvider.Analyzers.LowerCaseKeywordAnalyzer, Sitecore.ContentSearch.LuceneProvider" />
</field>
<field fieldName="contact.social.facebook.appid" storageType="YES" indexType="TOKENIZED" vectorType="WITH_POSITIONS_OFFSETS" boost="1f" emptyString="_EMPTY_" nullValue="_NULL_" type="System.String" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider">
<analyzer type="Sitecore.ContentSearch.LuceneProvider.Analyzers.LowerCaseKeywordAnalyzer, Sitecore.ContentSearch.LuceneProvider" />
</field>
</fieldNames>
</fieldMap>
</configuration>
</index>
</indexes>
Is this because Solr doesn't need these additional fields in the sitecore_analytics_index? Part of the analytics index is defined in Sitecore.ContentSearch.Solr.Index.Analytics.config but the index doesn't show up in Indexing manager so I can't manually rebuild it to see if it works.
Do I need to create a Solr version for this file or is it only required for Lucene?
| |
That is /sitecore/system/Marketing Control Panel/Funnels in the master database.
|
What is the correct root node for 'sitecore_marketingdefinitions_master' index?
I am working on a task to move a Sitecore installation search from Lucene to Solr on Sitecore version 8.2. I am using Solr version 5.1 as it is the recommended version for sitecore 8.2. All the other indexes build correctly but I am having an issue while building sitecore_marketingdefinitions_master index.
The error says:
Root item could not be found
Upon investigating the config file for that index, I saw that the root node points to <Root>{09CF9489-8F71-4A16-B707-4F013D8CDEFB}</Root>. This item was not found in my local instance.
Since this is the default config for the index, I was wondering if someone could point me to the correct root node that I should use in this case! Or is it ok if I change the root node path to '/sitecore' node?
| |
Well, you don't provide much of a context. But API wise, it would come out like this:
foreach (Item item in ListOfItems)
{
item.Editing.BeginEdit();
item.Fields[FieldIDs.EnableLanguageFallback].Value = "1";
item.Editing.EndEdit();
}
For the Shared version of Language Fallback, change the constant.
foreach (Item item in ListOfItems)
{
item.Editing.BeginEdit();
item.Fields[FieldIDs.EnableSharedLanguageFallback].Value = "1";
item.Editing.EndEdit();
}
|
How to programmatically set "Enable field level fallback" field on a Template Field item?
I'm using sitecore 8.2.
I have a list of the Template Field items where I need to check the "Enable field level fallback" field programmatically.
So, something like that:
foreach (var item in ListOfItems)
{
item.Fields["Enablefieldlevelfallback"].Value = "1";
break;
}
Any help would be appreciated.
| |
sitecore_list_index contains the list of contacts and segmented lists that are used by the List Manager, the Email Experience Manager and the Experience Profile.
More information you can find here:
https://doc.sitecore.net/sitecore_experience_platform/setting_up__maintaining/search_and_indexing/indexing/search_index_descriptions
On this link https://doc.sitecore.net/sitecore_experience_platform/setting_up__maintaining/xdb/configuring_servers/configure_a_content_delivery_server you can see that you need to disable List Manager index on a content delivery server.
|
Sitecore_list_index on CDs
What exactly is the sitecore_list_index used for? Can it be deleted or can its crawling strategy be set to manual on CDs without affecting any other part of Sitecore?
| |
Assuming that you already checked that the configs of local and staging are in sync: did you try with log4net internal debugging? When log4net is working on one location and not on the other this has helped me a few times.
Try enabling this and (re-)start your application. If the connection cannot be established (as seems the case) -e.g. if anything is wrong with your connection string- it will log this. You can read here how to set internal debugging:
Internal debugging can be enabled by setting a value in the application's configuration file. The log4net.Internal.Debug application setting must be set to the value true. For example:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="log4net.Internal.Debug" value="true"/>
</appSettings>
</configuration>
This setting is read immediately on startup an will cause all internal debugging messages to be emitted.
As log4net internal debug messages are written to the System.Diagnostics.Trace system it is possible to redirect those messages to a local file. You can define a trace listener by adding the following to your application's .config file:
<configuration>
...
<system.diagnostics>
<trace autoflush="true">
<listeners>
<add
name="textWriterTraceListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="C:\...\log4net.txt" />
</listeners>
</trace>
</system.diagnostics>
...
</configuration>
Make sure that the process running your application has permission to write to this file.
|
Log4net not inserting record into database
I am using the Log4Net to insert errors into MSSQL. However, the errors are not being logged into the database.
Log4net Patch File - z.Logging.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<log4net>
<appender name="BufferingForwardingAppender" type="log4net.Appender.BufferingForwardingAppender">
<bufferSize value="1" />
<lossy value="true" />
<evaluator type="log4net.Core.LevelEvaluator">
<threshold value="INFO" />
</evaluator>
<appender-ref ref="ADONetAppender_SqlServer" />
</appender>
<appender name="ADONetAppender_SqlServer" type="log4net.Appender.ADONetAppender, Sitecore.Logging">
<bufferSize value="1" />
<param name="ConnectionType" value="System.Data.SqlClient.SqlConnection, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<param name="ConnectionString" value="user id=[userId];password=[password];Data Source=ServerName\CD_CUSTOM;Database=Sitecore.Logging" />
<param name="CommandText" value="INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message]) VALUES (@log_date, @thread, @log_level, @logger, @message)" />
<param name="Parameter">
<param name="ParameterName" value="@log_date" />
<param name="DbType" value="DateTime" />
<param name="Layout" type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy'-'MM'-'dd HH':'mm':'ss'.'fff}" />
</param>
</param>
<param name="Parameter">
<param name="ParameterName" value="@thread" />
<param name="DbType" value="String" />
<param name="Size" value="255" />
<param name="Layout" type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%t" />
</param>
</param>
<param name="Parameter">
<param name="ParameterName" value="@log_level" />
<param name="DbType" value="String" />
<param name="Size" value="50" />
<param name="Layout" type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%p" />
</param>
</param>
<param name="Parameter">
<param name="ParameterName" value="@logger" />
<param name="DbType" value="String" />
<param name="Size" value="255" />
<param name="Layout" type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%c" />
</param>
</param>
<param name="Parameter">
<param name="ParameterName" value="@message" />
<param name="DbType" value="String" />
<param name="Size" value="4000" />
<param name="Layout" type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%m" />
</param>
</param>
</appender>
<root>
<priority value="INFO" />
<appender-ref ref="LogFileAppender">
<patch:attribute name="ref">ADONetAppender_SqlServer</patch:attribute>
</appender-ref>
</root>
<logger name="Sitecore.Diagnostics.WebDAV" additivity="false">
<level value="INFO" />
<appender-ref ref="WebDAVLogFileAppender">
<patch:attribute name="ref">ADONetAppender_SqlServer</patch:attribute>
</appender-ref>
</logger>
<logger name="Sitecore.Diagnostics.Publishing" additivity="false">
<level value="INFO" />
<appender-ref ref="PublishingLogFileAppender">
<patch:attribute name="ref">ADONetAppender_SqlServer</patch:attribute>
</appender-ref>
</logger>
<logger name="Sitecore.Diagnostics.Crawling" additivity="false">
<level value="INFO" />
<encoding value="utf-8" />
<appender-ref ref="CrawlingLogFileAppender">
<patch:attribute name="ref">ADONetAppender_SqlServer</patch:attribute>
</appender-ref>
</logger>
<logger name="Sitecore.Diagnostics.Search" additivity="false">
<level value="INFO" />
<encoding value="utf-8" />
<appender-ref ref="SearchLogFileAppender">
<patch:attribute name="ref">ADONetAppender_SqlServer</patch:attribute>
</appender-ref>
</logger>
</log4net>
</sitecore>
</configuration>
Note
The same configuration has been applied on my local instance and everything works, i.e, the errors are logged into the table Log. However, on the Staging Environment, no errors are being logged.
I have also tried to modified the Sitecore.config directly and use the following configuration:
<log4net>
<appender name="BufferingForwardingAppender" type="log4net.Appender.BufferingForwardingAppender">
<bufferSize value="1" />
<lossy value="true" />
<evaluator type="log4net.Core.LevelEvaluator">
<threshold value="INFO" />
</evaluator>
<appender-ref ref="ADONetAppender_SqlServer" />
</appender>
<appender name="ADONetAppender_SqlServer" type="log4net.Appender.ADONetAppender, Sitecore.Logging">
<bufferSize value="1" />
<param name="ConnectionType" value="System.Data.SqlClient.SqlConnection, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<param name="ConnectionString" value="user id=[userId];password=[password];Data Source=ServerName\CD_CUSTOM;Database=Sitecore.Logging" />
<param name="CommandText" value="INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message]) VALUES (@log_date, @thread, @log_level, @logger, @message)" />
<param name="Parameter">
<param name="ParameterName" value="@log_date" />
<param name="DbType" value="DateTime" />
<param name="Layout" type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy'-'MM'-'dd HH':'mm':'ss'.'fff}" />
</param>
</param>
<param name="Parameter">
<param name="ParameterName" value="@thread" />
<param name="DbType" value="String" />
<param name="Size" value="255" />
<param name="Layout" type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%t" />
</param>
</param>
<param name="Parameter">
<param name="ParameterName" value="@log_level" />
<param name="DbType" value="String" />
<param name="Size" value="50" />
<param name="Layout" type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%p" />
</param>
</param>
<param name="Parameter">
<param name="ParameterName" value="@logger" />
<param name="DbType" value="String" />
<param name="Size" value="255" />
<param name="Layout" type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%c" />
</param>
</param>
<param name="Parameter">
<param name="ParameterName" value="@message" />
<param name="DbType" value="String" />
<param name="Size" value="4000" />
<param name="Layout" type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%m" />
</param>
</param>
</appender>
<appender name="LogFileAppender" type="log4net.Appender.SitecoreLogFileAppender, Sitecore.Logging">
<file value="$(dataFolder)/logs/log.{date}.txt"/>
<appendToFile value="true"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%4t %d{ABSOLUTE} %-5p %m%n"/>
</layout>
<encoding value="utf-8"/>
</appender>
<appender name="WebDAVLogFileAppender" type="log4net.Appender.SitecoreLogFileAppender, Sitecore.Logging">
<file value="$(dataFolder)/logs/WebDAV.log.{date}.txt"/>
<appendToFile value="true"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%4t %d{ABSOLUTE} %-5p %m%n"/>
</layout>
<encoding value="utf-8"/>
</appender>
<appender name="PublishingLogFileAppender" type="log4net.Appender.SitecoreLogFileAppender, Sitecore.Logging">
<file value="$(dataFolder)/logs/Publishing.log.{date}.txt"/>
<appendToFile value="true"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%4t %d{ABSOLUTE} %-5p %m%n"/>
</layout>
<encoding value="utf-8"/>
</appender>
<root>
<priority value="INFO"/>
<appender-ref ref="BufferingForwardingAppender"/>
</root>
<logger name="Sitecore.Diagnostics.WebDAV" additivity="false">
<level value="INFO"/>
<appender-ref ref="BufferingForwardingAppender"/>
</logger>
<logger name="Sitecore.Diagnostics.Publishing" additivity="false">
<level value="INFO"/>
<appender-ref ref="BufferingForwardingAppender"/>
</logger>
<logger name="Sitecore.Diagnostics.Crawling" additivity="false">
<level value="INFO" />
<encoding value="utf-8" />
<appender-ref ref="BufferingForwardingAppender" />
</logger>
<logger name="Sitecore.Diagnostics.Search" additivity="false">
<level value="INFO" />
<encoding value="utf-8" />
<appender-ref ref="BufferingForwardingAppender" />
</logger>
</log4net>
But still it worked on my local instance and not on the Staging Server.
Moreover, I have setup a profiler to see if there are any request coming through but in vain. Nothing is being obtained. I have also set the db_owner permission on the User.
I am making use of Sitecore 8.2 Update 1
Any help?
| |
1) For the col-wide-2, make sure the Editable checkbox is checked on the placeholder settings.
2) Have you perhaps added the 2-column-6-6 on the standard values of your template and then added it again through the page editor?
|
component is added twice in dynamic placeholder
I'm using the Integrated Dynamic Placeholders v1.2 and see the following 2 issues. Not sure if they are related.
In experience editor when I add 2 column 6-6 component, it shows the placeholder only for col-wide-1. It's not showing the placeholder for col-wide-2. [I gave them colored borders to identify.]
I have added the components via content editor. And when I check the page in Experience editor, it has added another 2 column 6-6 on its own.
Section Centered.cshtml
<section class="aboutUs">
<div class="container">
@Html.Sitecore().DynamicPlaceholder("section-centered")
</div>
</section>
2 column 6-6.cshtml
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6" style="border:1px solid red;">
@Html.Sitecore().DynamicPlaceholder("col-wide-1")
</div>
<div class="col-lg-6 col-md-6 col-sm-6" style="border:1px solid green;">
@Html.Sitecore().DynamicPlaceholder("col-wide-2")
</div>
</div>
Am I missing any setting here. Using Sitecore 8.2 with MVC
| |
Can you try bellow solution :
1)Copy the attached Sitecore.Support.350672 file to the bin folder
2)Open the Website\sitecore\shell\Applications\Security\EditUser\EditUser.xaml.xml file and implement the below change:
Comment
<Sitecore.Shell.Applications.Security.EditUser Application="Security/Edit User" x:inherits="Sitecore.Shell.Applications.Security.EditUser.EditUserPage,Sitecore.Client">-->
and add next line of code:
<Sitecore.Shell.Applications.Security.EditUser Application="Security/Edit User" x:inherits="Sitecore.Support.Shell.Applications.Security.EditUser.EditUserPage, Sitecore.Support.350672">
|
Sitecore custom user profile is not supporting inheritance?
I'm trying to extend existing User Profile Template with some project specific fields. I thought it will be handy to do it by template inheritance. But seems like only fields directly declared in Profile Template are visible in User Manager. Please take a look on the screens below.
We have _UserProfile which holds base set of fields,
I created interface template _Test_UserProfile with project specific fields.
I created Test_UserProfile template that inherits from _UserProfile and _Test_UserProfile
_ I added one field directly in Test_UserProfile
then I created Profile Item that inherits from Test_UserProfile
when I create user that uses my new Profile only directly declared fields are visible
Do you guys know if there is any way to make this work?
thanks!
| |
Short Answer
The out of the box solution is to ensure that the column names in your Excel CSV, match identically to the field names that they are being mapped to.
As an example, one of the out-of-the-box fields is called First Name. If your CSV column heading has First Name, then the Import Wizard will automatically select that and match it to the field.
Background Information
Original question asked from the point of view of EXM. It was updated to reflect List Manager instead.
The Contact import process that you're talking about is actually not EXM specifically, but rather List Manager, which is a sub-product in the larger Sitecore XP. EXM simply integrates with List Manager to provide the functionality which is why it looks like EXM is doing the work.
The CSV Import process can be heavily modified to work with custom Contact facets. For additional information on that, you can browse the following blogs:
Loading xDB Contacts with CSV Custom Fields
Mapping CSV Fields to Complex Sitecore xDB Contact Facets
|
In List Manager, is it possible to have a default field assignment when importing recipients from a file?
We import recipients from a file, which always has the same fields.
In the import process we always have to assign the fields from the file to the Sitecore fields.
Is it possible to save this fixed assignment once, so it does not have to be done every time we import?
We use Sitecore 8.1 Up-1 rev. 151207 / EXM 3.2 Initial rev. 151020.
| |
Yes, EXM is intended for this purpose among others. With EXM you can schedule dispatched emails (composed email sent to a large body of recipients), you can send triggered emails (the user does something on that site that sends them a one-off email), and you can also set up subscriptions.
With EXM, you are actually composing an email in a very similar fashion to how you compose a web page in Sitecore. You can have sub-layouts and renderings that drive the business logic that constructs the email, and then mix that with the personalization of each Contact so that you can tailor the email for them (I know you said you weren't interested, but the feature is there OOTB).
After doing so, you gain all of the reporting features that come along with it, including Open rates, click rates, deliverability, device, location (assuming you have subscribed to device/location detection).
How Does It Work
Currently, in EXM (version 3 through 3.4), Emails are attached to a campaign that is attached to an already built out Engagement plan that is used for the sending of that email. You can customize that engagement plan, however, it has been my experience that the default plan serves most all of the purposes.
There is also a pretty well built out Client API that allows you to quickly send out triggered emails from the content delivery server to a recipient in kind of an on-the-fly way.
If you have the ability to, I highly recommend using Sitecore 8.2 and EXM 3.4. However, if you still have a lower version of Sitecore 8, then you probably want to use EXM 3.3 (which requires Sitecore 8.1 Update-3) This does require a subscription to Sitecore's Email Delivery service which is provided via Dyn.
Dyn Support Ending Q4 2017 (EXM 3.0 - EXM 3.3)
However, support for sending mail through Dyn (which is the company that sends mail on behalf of Sitecore's EXM) is ending this year. This means that you won't be able to use EXM 3.3 or below without bringing your own Message Transfer Agent (MTA) which is totally possible by utilizing the CustomSMTP.config for EXM. SendGrid can be used as an MTA with EXM.
Sitecore Email Cloud Service (EXM 3.4)
Sitecore is pushing clients wanting to use EXM towards utilizing EXM 3.4, which requires a subscription to Sitecore's Email Cloud service. The purpose behind this is to increase the level of Reputation Management that is needed in order ensure your emails sent aren't marked as SPAM. Previously, with Dyn, there has been a number of deliverability issues that have affected reputation scores on mail. To fix this, Sitecore has teamed up with Spark Post to provide a white label MTA.
Technical Background
Every mail message that Sitecore EXM sends out has an Item representing it. If it's a triggered email, where the item itself might be utilized over and over, but the content changes, then you would just reference that same Triggered Email. So the first step is to create the item that represents the Mail email you're sending.
Very Simple Email Example
Let's say you have a triggered email, where you already have a mechanism for creating the markup of the email. One way that you can do this is to have an EXM Mail Message item that consists of nothing more than a Rich Text Box field.
Just prior to sending the message you desire, you use standard Sitecore API to edit the field value for the Rich Text Box to include the email HTML needed to satisfy the body of the email. After we're done, we want to ensure we get the MailMessage item, which contains all of the information and details we need around constructing the actual mail message.
MessageItem message = Sitecore.Modules.EmailCampaign.Factory.GetMessage(messageItem.ID.ToString());
Next step is to get the Contact that you want to send to. The recipient must be in Sitecore as an xDB contact already. If they are not, there are several ways to accomplish this (outside scope of this answer). For EXM, we want to ensure we're using the xDB Contact notation, which is done via:
var recipientId = new XdbContactId(xdbContact.ContactId);
Lastly, we want to send the email, which is a simple API method. The third argument is if we want the message to be sent async or not.
ClientApi.SendStandardMessage(message.MessageId, recipientId, true);
Given that the EXM configuration is appropriately done, this will immediately dispatch an email to this user.
Complex Emails Different for Each Contact
The process for sending a complex email, such as you hint at, where the content is significantly different, is really no different than the above process with maybe an additional step.
Basically, what you're looking to do specifically is create a sublayout/component that is applied to the email that contains the logic needed to build and differentiate the email. There's an assumption here that the logic and workflow for creating the body of an email. Same as if you're building a component for a web page. The logic you need creates output that you then display to the mail message, just like you would for any other web page.
Then when an email is sent (either Triggered or in batch), you can fetch the Contact information, and build the email based off of it as needed.
|
Send emails from EXM with custom data per triggered email
For a large number of implementations we use business logic to determine the actual body of an email and then send it through either smtp (or a custom save action in WFFM).
But would it make sense to use EXM for this behavior? The goal would be to use the reporting capabilities provided by EXM, not the personalization/editing capabilities.
The e-mail would consist of a recipient and body that are pushed into EXM for a specific template and are then dispatched. I probably need an Engagement plan to trigger this email.
Would this be a good (and feasible) approach? The other option would be to use a tool like SendGrid that also provides bounce and open rate information. But if we can use Sitecore for this, that would be great.
| |
i have tried a poc on this before & we can achieve it using fast query to unlock items locked by a specific user if you have reasonable number of items to be unlocked.
Item[] items = database.SelectItems("fast:/sitecore/content//*[@__lock='%user=%']");
foreach (var item in items){
item.Editing.BeginEdit();
item.Locking.Unlock();
item.Editing.EndEdit();
}
|
how to unlock all items that were locked by virtualssuser?
How to unlock items that were locked by virtualssuser sitecore 8.1 ?
query like it can't find any records about user in code database
SELECT UserId FROM dbo.aspnet_Users WHERE UserName like '%virtualssuser%'
| |
As of the writing of this answer, Sitecore's xDB Cloud Service is not compatible currently with Sitecore XP 8.2 Update 2.
Supported Versions
According to the Compatibility Table for xDB Cloud, the following versions are currently supported:
Sitecore 8.0 Update 6
Sitecore 8.0 Update 7
Sitecore 8.1 Update 1
Sitecore 8.1 Update 2
Sitecore 8.1 Update 3
Sitecore 8.2 Initial Release
Unsupported Versions
All of Sitecore 7.5 and below
Sitecore 8.0 Initial Release through Update 5
Sitecore 8.1 Initial Release
Sitecore 8.2 Update-1 (Coming February 2017)
Sitecore 8.2 Update-2 (Coming February 2017)
|
Is there a way to tell what version of Sitecore Cloud xDB is currently supporting?
I upgraded our environment to Sitecore 8.2 Update 2. I now am getting the following error on startup.
ManagedPoolThread #6 17:01:24 INFO Cache created: 'SqlDataProvider - Property data(production)' (max size: 500KB, running total: 5756MB)
8228 17:01:25 INFO xDB Cloud - Get xDB-set with License Id: '20150130061746' - Deployment Id: 'JDA20150130061746' Attempt 2 of 5
8228 17:01:30 INFO xDB Cloud - Get xDB-set with License Id: '20150130061746' - Deployment Id: 'JDA20150130061746' Attempt 3 of 5
8228 17:01:35 INFO xDB Cloud - Get xDB-set with License Id: '20150130061746' - Deployment Id: 'JDA20150130061746' Attempt 4 of 5
8228 17:01:40 INFO xDB Cloud - Get xDB-set with License Id: '20150130061746' - Deployment Id: 'JDA20150130061746' Attempt 5 of 5
8228 17:01:40 ERROR xDB Cloud - Exception during initializing occurred
System.MissingMethodException: Method not found: 'System.Threading.Tasks.Task`1<Sitecore.Cloud.RestClient.IRestResponse`1<!!0>> Sitecore.Cloud.RestClient.IRestClient.ExecuteAsync(Sitecore.Cloud.RestClient.IRestRequest)'.
at Sitecore.Cloud.Xdb.DiscoveryServiceClient.GetXdbSet(String licenseId, String deploymentId, String sitecoreVersion, String cloudXdbAssemblyVersion, String cloudSearchAssemblyVersion, String deploymentType)
at Sitecore.Cloud.Xdb.DiscoveryServiceClient.<GetXdbSet>b__0()
at Sitecore.Cloud.Xdb.Retryer.Execute[T](Func`1 task, Func`2 stopOnException, String message, Int32 retryNum, TimeSpan retryInterval)
at Sitecore.Cloud.Xdb.DiscoveryServiceClient.GetXdbSet()
at Sitecore.Cloud.Xdb.UpdateXdbConnectionStrings.Process(PipelineArgs args)
8228 17:01:40 ERROR xDB Cloud - xDB Cloud initialization failed. Please contact Sitecore Support via http://support.sitecore.net
8228 17:01:40 FATAL xDB Cloud - xDB Cloud initialization failed. Please contact Sitecore Support via http://support.sitecore.net
8228 17:01:40 INFO xDB Cloud - Initialization failed
8228 17:01:40 INFO [Analytics]: Started background service for 'maintenanceService'.
As nothing else changed in the environment other than the upgrade I was curious if it was because 8.2 Update 2 support hadn't been deployed to their cloud xDB yet?
| |
Here's another way to check if your license does have the XDB enabled or not.
Steps are login to your content editor and then click on the RED top left side hamburger menu as shown in below image.
Then click on license
on opening model window scroll down all the way below where you will see entry named like sitecore.xdb.base and date. as show below in image.
If you do not see entry with XDB that means your license is not XDB enabled
Hope this helps.
Thanks
Mrunal
|
How to check Sitecore.xDB.base in license file?
I am upgrading Sitecore 8.0 to 8.1. In Sitecore 8.1 Sitecore.xDB.base key is required.
So how can i check that Sitecore.xDB.base key is exists in license file?
| |
I guess is a mistake in code. From my point of view these lines must be on Debug mode not Info mode.
On line 124 we have
Sitecore.Diagnostics.Log.Info("GetModelFromView {0} {1}".Formatted(watch.ElapsedMilliseconds, args.Rendering.RenderingItem.ID), this);
and this line runs everytime GetModelFromView processor is running.
Please check glass mapper source code :
https://github.com/mikeedwards83/Glass.Mapper/blob/5136ac34f2159d57966e6a499b3318ff3020bb55/Source/Glass.Mapper.Sc.Mvc/Pipelines/Response/GetModelFromView.cs
This should be fixed in Release 4.3.4.197.
|
A ton of Glass.Mapper INFO messages in logs
So, I just upgraded to 8.2 Update 2 along with Glass.Mapper 4.3.4.196.
I now see a ton of Glass.Mapper INFO messages in my logs. This adds a ton of noise to the logs. Is there a reason this is happening or is this normal behavior.
1920 07:45:39 INFO GetModelFromView 0 {25363DC2-49BC-4FB9-84FF-F9164BE6CC3E}
1920 07:45:39 INFO GetModelFromView 0 {25363DC2-49BC-4FB9-84FF-F9164BE6CC3E}
1920 07:45:39 INFO GetModelFromView 0 {25363DC2-49BC-4FB9-84FF-F9164BE6CC3E}
1920 07:45:39 INFO GetModelFromView 0 {54661361-3C46-4AAA-A82B-6D649F43917F}
1920 07:45:39 INFO GetModelFromView 0 {1B427610-DB06-4F5B-AD35-8F1E8B8FD56B}
6720 07:45:39 INFO GetModelFromView 0 {FE5D7FDF-89C0-4D99-9AA3-B5FBD009C9F3}
6720 07:45:39 INFO GetModelFromView 0 {9DC3117B-367E-4510-AB61-490DDC8359A5}
6720 07:45:39 INFO GetModelFromView 0 {FD8ED973-34E5-4544-9886-9269BA4C1227}
6720 07:45:39 INFO GetModelFromView 0 {729DA297-DB63-4362-B835-E3D4E0CC90E5}
6720 07:45:39 INFO GetModelFromView 0 {AF675ECD-84AC-4110-A334-EB1CA2A34452}
6720 07:45:39 INFO GetModelFromView 0 {25363DC2-49BC-4FB9-84FF-F9164BE6CC3E}
6720 07:45:39 INFO GetModelFromView 0 {5281E350-9958-457F-8D37-FD98134FC9A4}
1920 07:45:40 INFO GetModelFromView 0 {9D5CCD1F-4519-4633-BDFE-72AC41131609}
1920 07:45:41 INFO GetModelFromView 0 {25363DC2-49BC-4FB9-84FF-F9164BE6CC3E}
1920 07:45:41 INFO GetModelFromView 0 {5281E350-9958-457F-8D37-FD98134FC9A4}
| |
You need to override for the SendEmail method in the processMessage pipeline (patched in the /App_config/Include/Sitecore.Forms.Config)
With something like this:
using Sitecore.Form.Core.Pipelines.ProcessMessage;
using System.Net.Mail;
namespace Arktouros
{
public class PressMessageOverride
{
public void SendEmail(ProcessMessageArgs args)
{
SmtpClient smtpClient = new SmtpClient(args.Host);
smtpClient.EnableSsl = args.EnableSsl;
if (args.Port != 0)
{
smtpClient.Port = args.Port;
}
smtpClient.Credentials = args.Credentials;
smtpClient.Send(this.GetMail(args));
}
private MailMessage GetMail(ProcessMessageArgs args)
{
MailMessage mail = new MailMessage(args.From, args.To.ToString(), args.Subject.ToString(), args.Mail.ToString())
{
IsBodyHtml = args.IsBodyHtml
};
//your reply to goes here, set to be the from address of the form being submitted
mail.ReplyToList.Add(new MailAddress(args.From));
if (args.CC.Length > 0)
{
mail.CC.Add(args.CC.ToString());
}
if (args.BCC.Length > 0)
{
mail.Bcc.Add(args.BCC.ToString());
}
args.Attachments.ForEach(delegate (Attachment attachment)
{
mail.Attachments.Add(attachment);
});
return mail;
}
}
}
then update the config file to point to your new class:
replace:
<processor type="Sitecore.Form.Core.Pipelines.ProcessMessage.ProcessMessage, Sitecore.Forms.Core" method="SendEmail" />
with
<processor type="NamespaceOfYourClass, YourDLL" method="SendEmail" />
and away you go, for info this is not fully tested, but should work fine.
|
Add Reply-To Email to WFFM Send Email Message Save Action
I'm attempting to add a reply-to address to an email I'm sending via WFFM 8.1. The save action I am using is "Send Email Message." The email being sent includes the email address of the user filling out the associated form. I would like to use the user's email as the reply-to address. In the email message editor, I do not see a reply-to email option so I assume I will need to write a custom save action. My question is twofold:
Is it possible to add a reply-to address to the "Send Email Message" save action with out-of-the-box WFFM?
If this functionality is not available out-of-the-box, it possible to extend the functionality of the "Send Email Message" save action to include a reply-to email while preserving the following UI that accompanies the save action?
Thanks for the help!
| |
Here's how I would approach this.
1) Execute this query in your MongoDB shell (or in Robomongo):
var ids = [];
db.Identifiers.aggregate(
{ $match: { _id: { $not: /@/ } } },
{ $project: { _id: 1 } }
).result.forEach(function(r) { ids.push(r._id) });
printjson(ids);
You'll get an array of all identifiers that aren't emails (i.e. don't contain the @ symbol).
2) Create a C# script (e.g. an .aspx page) and insert the ids you retrieved earlier:
string[] ids = { "Identifier1", "Identifier2", ... };
3) For every identifier, load the contact and merge it with the corresponding email-identified contact.
Note that in the code below I am using the ContactRepository.MergeContacts() API that was designed for merging two contacts into one.
var contactRepository = (ContactRepositoryBase)Factory.CreateObject("contactRepository", true);
LeaseOwner leaseOwner = new LeaseOwner("SOME_UNIQUE_WORKER_NAME", LeaseOwnerType.OutOfRequestWorker);
foreach (string identifier in ids)
{
LockAttemptResult<Contact> lockResultOld = contactRepository.TryLoadContact(identifier, leaseOwner, TimeSpan.FromMinutes(1));
if (lockResultOld.Status == LockAttemptStatus.Success)
{
Contact oldContact = lockResultOld.Object;
try
{
// Get the new email ID from somewhere, e.g. from a facet.
var emails = oldContact.GetFacet<IContactEmailAddresses>("Emails");
string newIdentifier = emails.Entries[emails.Preferred].SmtpAddress;
LockAttemptResult<Contact> lockResultNew = contactRepository.TryLoadContact(newIdentifier, leaseOwner, TimeSpan.FromMinutes(1));
if (lockResultNew.Status == LockAttemptStatus.Success)
{
Contact newContact = lockResultNew.Object;
try
{
// This will merge all contact data, including all the visits, into the new contact.
contactRepository.MergeContacts(newContact, oldContact);
contactRepository.ReleaseContact(oldContact.ContactId, leaseOwner);
// When you save the new contact, the old contact will be marked as "obsoleted" in the database.
var options = new ContactSaveOptions(release: true, owner: leaseOwner);
contactRepository.SaveContact(newContact, options);
}
catch
{
contactRepository.ReleaseContact(newContact.ContactId, leaseOwner);
throw;
}
}
}
catch
{
contactRepository.ReleaseContact(oldContact.ContactId, leaseOwner);
}
}
}
|
How to write script to merge xDB contacts?
We have a Sitecore 8.1-3 instance. Previously we had used the user's Sitecore username as the identifier in xDB. Then after the site was live for some time we realized that using the user's email address was a much better solution. So we changed the site to use email address in the Identify method. And the site has been running for a while with that.
However this caused the unfortunate situation where we have some users that have two contacts in xDB - one identified by their Sitecore username and one identified by their email address.
Is there any way that I can write a script that would merge these? Ultimately what I would like to do is look for all of the contacts that are identified by their Sitecore username (OLD contact), then for each one of those go find their contact that is identified by their email address (NEW contact). I would like to then transfer all of the Sitecore analytics activity from the OLD contact to the NEW contact. Then delete the OLD contact. Is this even possible?
Right now the problem we have is that when you search in Experience Profile you get double results for some contacts. And some of the activity is assigned to one contact and some is assigned to the other contact. We would like to find a way to clean this up. Any ideas?
| |
Thanks Marek for leading me in the right way, there is a great blog post about hiding the Publish Site buttons written by Marek himself, basically what needs to be done is the following
In order to hide them, you need to switch the database to Core, run the Security Editor application, select the role and:
remove the Read permission from the sitecore > content > document and settings > all users > start menu > left > publish site item,
deny the Read permission from the sitecore > content > applications > content editor > menues > publish site item.
|
How to allow a user to publish items one by one, but not the entire site
I received a client request where they want me to modify the Author role; so that any user with this role can view and modify a subset of items, and can publish only a single item at a time and not the entire site, is there a role or group that would provide such access?
| |
You can also post to the various Social Media groups:
Sitecore group on Facebook: https://www.facebook.com/groups/6932529533/
Sitecore group on LinkedIn: https://www.linkedin.com/groups/71381
Sitecore Developer group on LinkedIn: https://www.linkedin.com/groups/3066050
Sitecore on Reddit: https://www.reddit.com/r/sitecore/
You can also get your post added to the Sitcore Links collection: http://sitecore.link/Suggest
Don't forget, it perfectly valid to provide links to your own blog posts on answers here on StackExchange and also on StackOverflow - just be mindful not to provide Link-Only answers (i.e. if the blog post was to disappear the answer should still be valid on it's own)
|
Where to list a new blog about Sitecore?
Our team began to write blog posts about Sitecore.
How can I let the Sitecore community know that there's a new interesting blog? What channels can I use to promote it?
| |
This is caused by a missing sub-item within the Web Forms for Marketers base form creation process. To fix this until Sitecore corrects the issue:
Go into the Content Editor and find your Form
Right click on your form and insert a new Form Section (or select it and use your insert options)
Give it a name
That should get you working again. Until a fix is ready, I have created a basic form with just a "Fields" section and instead of creating a new form, I just click the button to copy from an existing form.
|
WFFM. "Collection is read-only" when trying to add field in designer
Upgraded from WFFM 2.4 to 8.2u1. Forms that already exist is able to add new fields and edit in any way.
If i create a new form and try to press "Add field" in the form designer this error pops up:
Any ideas?
| |
Marketplace in the end is a very convenient way to execute a vetted, tested, set of ARM templates, provides by vendors like Sitecore. You don't need marketplace to execute ARM templates, quite on the contrary, you can execute your own customized ARM templates through:
the cross platform command line interface
powershell
or even through the portal, if you go to: https://portal.azure.com/#create/Microsoft.Template - where you can write / paste your own template
|
In Sitecore PaaS can we use a custom ARM template in the Marketplace wizard?
I was doing some initial digging into the Sitecore PaaS version that deploys the XM1 configuration. While doing so, I noticed that there was an 'automation options' link that allowed me to view template details and parameters and there was an upload template option.
If one were to upload a custom Sitecore ARM template (say the XP1 template from Sitecore) would the Marketplace wizard be able to use it to provision? Or can you upload customized XM1 templates?
| |
If you have a lot of custom user profile data, especially if you have 500k+ users, then your best bet is probably going to be to create a custom SQL database and store your user data, with a key for the each user's record(s) in the database stored in a custom Sitecore user profile field (assuming you are using Sitecore membership, which I believe your question implies)
This is especially true when you store complex objects, since all properties must be serializable and you really don't want to slow your UserProvider and user access logic down. By the same token, if you add a large amount of data to your user profiles, especially when you have a large number of users (like you're expecting), you will likely experience a noticeable decrease in performance.
Given the above, we can conclude from an extensibility and performance standpoint that a custom database is the right decision, but how about from a GUI perspective? What if your authors want to be able to view the data for each user in Sitecore? The reality is that, given the number of users that you are describing, you should probably create a custom interface anyway for viewing user data. Sitecore's User Manager is meant more for managing securities, roles, etc. than viewing user data. Performance is not optimized and searching in this tool is neither robust nor extensible. If viewing user data is a requirement for you, then this question may come down to cost and budget for your project.
|
Why we should keep all user profile data in Sitecore?
I had a good debate with friends at work to decide where we should keep user profile and why?
As the discussion goes on we had these key points below which I feel our competency is up to only a certain extend. So I thought I would ask for your opinion here.
Background: We setup a Sitecore instance to serve websites for Europe continent with multiple domain name, 60% common layouts, different content, different languages. We know there are common data fields among the sites. There should be around 500K users in the core database when the system rolled out.
Custom data in new table
Small data I/O foot print
Easier to code for CRUD data
Easier to write export to Excel code by put DataTable object to the existing function. The outstanding data fields get normalize before save to DB.
But
I don't know when was the last time there was a problem in our SQL servers. I believe our database server is quite strong.
All in Sitecore
Fully engaged with Sitecore
All fields can be found in Sitecore admin UI
The data might be usable in xDB
But
The code can be complicated
| |
You can check the database to see if there is any data still present within the SharedFields table. The data for Shared, Versioned and Unversioned fields are stored within different tables.
SELECT COUNT(*) FROM [Sitecore_Web].[dbo].[SharedFields] WHERE [FieldId] = 'your field id'
|
How can I determine when a shared/unshared background process has finished?
In Sitecore (I'm specifically working with version 7.5 right now, but I believe this applies to other versions), when you mark a field as shared or unshared, you receive a popup that a lengthy background process has started. Is there any way to definitely determine when this process has finished?
| |
It turns out that the cause to my issue was lying within the rules set under Sitecore -> System -> Settings -> Rules -> Insert Option Rules,
These rules make it easier to set insert options for a large set of items using simple logic, without having to set them in the standard values for those items templates.
Following is a sample rule that will reflect on the home item and all of its descendants except the settings item and its descendants to add 2 insert options, one to add a "Page" Item and the other to add a "Blogs Page" item:
"where" the item is "Home" item or one of its descendants
"and" "except where" the item is the "Settings" item or one of its descendants
add "Page" insert option
"and" add "Blogs Page" insert option
|
Getting insert options even though item is configured to have none
I'm working on a clients site and I am currently facing a weird behavior, when right clicking items on the item tree to add a new child item, I am getting options to insert items of different template types even though that I manually cleared the insert options for that item, I even cleared them for the standard values of that items template and restored the insert options for that item to default, but I am still getting those options, something that I noticed and could be of help, is that all the items under the site node including the site node itself have the ability to add the same types of items, even though when going through any items insert options you would find that they are empty.
What could I be missing? and how can I remove these unwanted insert options.
| |
If you are in Eastern Standard Time then that means that you are 5 hours behind UTC. The LastPsswordChangedDate stored in the database is always in UTC to avoid issues with changing time-zones. This way, logic that views the stored value can be set to view it in the time-zone that you specified in the ServerTimeZone setting.
The general idea here is that the data should be separate from and thus should not depend on the business logic. Regardless of what you set as a display setting/preference/etc. the data should be consistent and standardized, so that the logic run on the data simply determines how it is to be presented.
Getting time in the ServerTimeZone using Sitecore's DateUtil methods
What you want to do is use Sitecore's DateUtil class to convert the resulting time to the server time that you specified. You are looking for the Sitecore.DateUtil.ToServerTime(...) method. Your DateTime.Now should be returned in the server time, but your membershipUser.LastPasswordChangedDate is still in UTC and must be converted, like so:
var membershipUser = Membership.GetUser(myUserName);
var passwordChangedDate = Sitecore.DateUtil.ToServerTime(membershipUser.LastPasswordChangedDate);
var elapsedTimeSinceLastPasswordChange = DateTime.Now - passwordChangedDate;
|
Why is my LastPasswordChangedDate 5 hours in the future?
I have a Sitecore 8.1-3 instance. I am trying to get the Datetime that the user's password was last changed. I am using this code:
var membershipUser = Membership.GetUser(myUserName);
var elapsedTimeSinceLastPasswordChange = DateTime.Now - membershipUser.LastPasswordChangedDate;
I am finding that membershipUser.LastPasswordChangedDate is always 5 hours ahead of the time on my machine. I am running all of this on my local computer. I am in the US Eastern time zone. The time on my PC is correct. And I have the following setting in my Sitecore.config file:
<setting name="ServerTimeZone" value="Eastern Standard Time"/>
Am I missing something?
| |
Normally you already specified the hostname in the site definition configuration file.
You can get the hostname by calling
Sitecore.Context.Site.HostName or Sitecore.Context.Site.TargetHostName.
if you have a list of sites domain delimited by |, it will return you all the values from the hostName attribute.
Then you can split by | to get the different sites URL. If you specify the targetHostName attribute as https://www.mysite.com, then you can make use of the TargetHostName.
Proposed Solution 1
You can either change the position of the urls in the hostName from
hostName="cms.mysite.com|www.mysite.com|33.44.54.123"
to
hostName="www.mysite.com|cms.mysite.com|33.44.54.123"
Then when you split, you take the first one.
Proposed Solution 2
Make use of the targetHostName in your SiteDefinition.config as follows:
hostName="cms.mysite.com|www.mysite.com|33.44.54.123"
targetHostName="www.mysite.com"
Then, make use of the code
var url = Sitecore.Context.Site.TargetHostName;
EDIT 1
It is better to not use Sitecore.Context.Site.HostName but Sitecore.Context.Site.TargetHostName because the HostName property is ok while you one have only one Hostname per site in the web.config.
The TargetHostName take the property TargetHostName of the site if specified in the site tag of the web.config or the first hostname if this property is not specified.
Reference: http://sitecoreblog.blogspot.com/2010/12/dont-use-hostname.html?m=1
|
How to access ServerUrl when sitecore website setup in clustered enviroment
We have set up two CD server( http://cds1mysite.com & http://cds2mysite.com ) in clustered environment where redirection to these URLs handled by LoadBalancer. Website public URL is https://www.mysite.com
So If we use following code to get server URL it's returning CD server URL not public URL. Instead it should return https://www.mysite.com
string serverurl = Sitecore.Globals.ServerUrl;
Do we have any other way to access public URL
| |
You need just to assign a validation rule to your fields
The Sitecore field validators is a set of user-input validators that can be applied to either an item, a specific field type or a specific field on a specific item.
Sitecore comes with a set of standard validators, including broken links validation, email validators, max length validators and XHTML/W3C validation. You can find all validation rules at /sitecore/system/settings/validation rules.
You apply rules to fields on individual items by selecting the field on a template to apply validation. Select the Validation Rules secion and select the rules to apply in the fields “Quick Action Bar” (applies validation to the left of the field), “Validate Button” (validation is run when clicking the Validation button on the Review tab), “Validator Bar” (applies validaton to the bar at the right of the fields) and the “Workflow” (applies validation when workflow is running).
More informations you can found here: https://briancaos.wordpress.com/2011/05/09/using-sitecore-field-validators/
|
How to implement character limit validation on Single-Line Text and Multi-Line Text fields?
I want to implement character limit on input by user on Single-Line text and Multi-Line Text fields. Please guide me.
| |
Datasources folder under Settings contains a list of datasource configuration items for the existing datasources.
These datasource configuration items don't have any references to them.
For example:
Carousel datasource configuration item specifies where all carousel datasource items exits in sitecore. In this case : /sitecore/content/Habitat/Global/Media and what kind of datasource template.
This makes it easier to find/manage datasources in future.
|
What is the purpose of Datasources (under Setting) in habitat project?
What is the purpose of Datasources (under Setting) in habitat project? I searched for many datasources but didn't find any items where these are linked.
| |
When you use Registry.SetString(key,value) or any other Registry.Set* you're setting in fact this value on user profile:
Sitecore.Context.User.Profile[key] = value;
Clearing the cache will not help you here. Even if you clear the value in cache, it will still be set on the profile and loaded from there if needed.
EDIT
I've written a blog post describing how you can work with Sitecore Registry and with simple Sitecore Registry Editor application.
|
Clear Workbox's Registry constant
In workbox, Listing of workflow items can be customized using Registry.SetString("/Current_User/Workflow/FilterOption"). but how to clear this filteroption & rollback to default. currently while testing i'm using powershell console or codebehind to do this everytime but wondering whether it can be doable through clearing cache in 'admin/cache.aspx'. Any input on this ?
| |
Finding the contact in the Collection database
The error you're seeing occurs when the given identifier has already been used for another contact.
Contact identifiers are stored in a separate collection named Identifiers. You can verify which contact has (or had) the identifier in question with the following MongoDB query. Make sure to convert the identifier to upper case.
db.Identifiers.find({ _id: "[email protected]" })
You'll see an object that looks like this:
{
"_id" : "[email protected]",
"contact" : NUUID("604bd137-84e6-4996-8cdb-37fec38eb7f5"),
"updated" : ISODate("2016-02-25T08:44:30.009Z")
}
You can then find what contact the identifier refers to (or used to refer to) using this query:
db.Contacts.find({ _id: CSUUID("604bd137-84e6-4996-8cdb-37fec38eb7f5") })
Note that I have changed NUUID to CSUUID in order for the query to work. Robomongo supports CSUUID in its JSON parser, but not NUUID.
Why wasn't the contact found by this identifier?
When you call manager.LoadContactReadOnly(identifier), Sitecore will first query the Identifiers collection to find the contact ID, much like we did above. It'll then load the contact from the Contacts collection. But there's a catch: it will only return the contact if its current identifier is the same as the one you passed to LoadContactReadOnly. If the current identifier is different, it will return null.
I can think of two reasons why LoadContactReadOnly may return null in your case:
The contact has been manually removed from Contacts, but the Identifiers entry stayed;
The contact's identifier was changed, but the Identifiers entry was not updated. As a matter of fact, this may be a defect in Sitecore—I don't see any logic that would update Identifiers when the contact's identifier changes.
Hot to approach this problem?
First of all, register this as a defect with Sitecore Support. Changing a contact's identifier should not lead to a bug like this. Feel free to point out my findings to the support team, and maybe they'll provide you with a quick fix.
In the meanwhile, the safest option would be not to change identifiers for existing contacts.
But if you must, then, whenever you save a contact with a changed identifier, you'll need to remove the old identifier from the Identifiers collection:
var driver = MongoDbDriver.FromConnectionString("analytics");
string id = "[email protected]";
driver["Identifiers"].Remove(
Query.EQ("_id", (BsonValue) id.ToUpperInvariant()),
RemoveFlags.None,
WriteConcern.Acknowledged);
|
Why am I getting "another contact with the same identifier already exists" error?
I have a Sitecore 8.1-3 instance. I am trying to write some code that lets admin users edit a user's xDB contact information. I have written a general-purpose method in my code that gets a contact object using the user's email address. The idea behind this method is that it could be used within a regular page request (where we are trying to get the current logged in user's contact) or it might be used on an admin page (where we are trying to get the contact that goes with some other user). If the code can't find a contact with the given identifier then it should create a new contact and return it. What I am noticing however is that when my code tries to save the new contact (in the case where it couldn't find a contact using that email address) it throws an error that says "another contact with the same identifier already exists". I can't figure this out. When I use robomongo to look for a contact with that identifier it returns no results.
private Contact GetXdbContact(string identifier)
{
if (Tracker.Current != null && Tracker.Current.Contact != null && Tracker.Current.Contact.Identifiers.Identifier == identifier)
{
//This is the current user
return Tracker.Current.Contact;
}
//There is no Tracker.Current.Contact, so this must be running in some non-user context
var manager = Factory.CreateObject("tracking/contactManager", true) as ContactManager;
var contact = manager.LoadContactReadOnly(identifier);
if (contact == null)
{
//No contact was found so create one
var repository = Factory.CreateObject("tracking/contactRepository", true) as ContactRepository;
var leaseOwner = new LeaseOwner("ADMIN", LeaseOwnerType.OutOfRequestWorker);
var newContact = repository.CreateContact(Guid.NewGuid());
newContact.Identifiers.Identifier = identifier;
newContact.Identifiers.IdentificationLevel = ContactIdentificationLevel.Known;
var options = new ContactSaveOptions(true, leaseOwner);
repository.SaveContact(newContact, options); //EXCEPTION IS THROWN HERE
return newContact;
}
return contact;
}
In our system, the email address is the identifier. So if I call this with [email protected] as the identifier, the manager does not find any contact, so my code attempts to create a new one. However, when it goes to save the contact it throws the exception below. I can use robomongo to verify that indeed there are not contacts where Identifiers.Identifier == '[email protected]', so I'm not really sure what is going on here.
Another contact with the same identifier already exists.
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.InvalidOperationException: Another contact with the same identifier already exists.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: Another contact with the same identifier already exists.] Sitecore.Analytics.Data.DataAccess.MongoDb.MongoDbDataAdapterProvider.SaveContactWithIdentifier(IContact contact, ContactSaveOptions saveOptions) +1256 Sitecore.Analytics.Data.DataAccess.MongoDb.c__DisplayClass9.b__7()
+25 Sitecore.Analytics.Data.DataAccess.MongoDb.MongoDbDataAdapterProvider.Try(Action action) +173 Sitecore.Analytics.Data.DataAccess.MongoDb.MongoDbDataAdapterProvider.SaveContact(IContact contact, ContactSaveOptions saveOptions) +222 Sitecore.Analytics.Data.ContactRepository.SaveContact(Contact contact, ContactSaveOptions options) +590
| |
I think since you have a DI configured that will be resetting any routes registered after you've added them so you need to do this afterwards in the initialize Pipeline like so:
Create a pipeline to register your route:
public class RegisterMySampleRoute
{
public virtual void Process(PipelineArgs args)
{
RouteTable.Routes.MapHttpRoute("my_sample_route",
"mysample/api/{controller}/{action}",
new {controller = "SampleController"}
);
}
}
Then patch it in like so:
<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<initialize>
<processor type="MyNamespace.Pipelines.RegisterMySampleRoute, MyNamespace" patch:before="processor[@type='Sitecore.Mvc.Pipelines.Loader.InitializeRoutes, Sitecore.Mvc']" />
</initialize>
</pipelines>
</sitecore>
</configuration>
That should do it.
|
WebAPI Attribute Routing Not Picking Up Routes
Sitecore 8.2 rev 160729
My understanding is that, as of Sitecore 8.2, you no longer need to call .MapHttpAttributeRoutes() because it's now included (in fact, it'll throw an error if you do). However, Sitecore is not picking up my ApiControllers using attribute based routing.
public class SampleController : ApiController
{
[Route("-/api/sample/test"), HttpGet]
public string Test()
{
return "Hello World!";
}
}
The above route does not appear in the route tables, and the URL gives me a 404.
Do I need to tell Sitecore which assemblies to look for routes in, or is there an additional configuration step I'm missing?
| |
I am facing the same issue with WFFM 8.2 rev. 161129 along with Sitecore 8.2 update 2. Initially thinking it was something version specific, tried using rev 170518 with Sitecore 8.2 update 3, but faced the same issue again.
Further analysed the Sitecore.Forms.PopupMenu.js and other list related JavaScript provided with WFFM.
Not sure if this is the perfect solution to this issue but adding the below line of code did the job for me:
this.show = function(event, controlid, height, width, args) {
window.Sitecore.Forms.PopupMenu.args = args;
...
}
It was the missing popup arguments on field selection that were preventing the update.
Adding this as an answer here, as this was the only question that exactly matched the issue I was facing, except for the version difference. Hope it helps.
|
WFFM: Why no field selection in Drop List?
When configuring the source for a Drop List field, both the Value and Text are defaulted to ItemName. I need Display Name for both Value and Text, but there are no dropdowns to select which fields to use. I have seen these in other forum posts' screenshots. Why do I not have these and how do I get them to show up? Is there a back door way to set these? I'm using WFFM 8.0 rev. 141217 btw.
Looking at the css, I found a width attribute. I unchecked it and now see the dropdown arrows. In the list of fields when I select one I get a javascript error.
Debugging the Javascript, it's breaking at line 13, the ListItems.callback call. Looks like QueryKeyHolder is null. Now what am I gonna do with that???
Per jammykam's suggestion, I tried installing a new instance of Sitecore and installed WFFM on that (same versions) and see the same behavior there. I opened a ticket with Sitecore support, they were also able to replicate the issue and should be sending a patch soon. I'll update this post then.
| |
You can have two ways of doing it.
First way
If you will have the same domain but different rootPath, you will need to make use of the virtualFolder and physicalFolder attribute in the sitedefinition.config.
The virtualFolder and physicalFolder will allow you to use the same domain but having different sites that hits different rootPath. This will allow you to have less coding.
Site Definition Example:
Once the Site Definition is setup, patch the Sitecore setting AlwaysStripLanguage to set the value to false as shown below:
From
<setting name=”Languages.AlwaysStripLanguage” value=”true”/>
To
<setting name=”Languages.AlwaysStripLanguage” value=”false”/>
You may check my blog post how to setup it here: https://hishaamn.wordpress.com/2016/12/22/sitecore-multi-sites-with-same-domain-but-different-sitecore-item-node/
Second way
You can have a single site node on your content tree. Let's say the path is sitecore/content/sites/Europe sites. Then you can add different language versions in order to create a multilingual sites. In other words, the Europe sites item will have different language versions along with its subitems.
The main advantage here is that you will have to manage a single node. However, if you are using Sitecore 7.2 or below, you will not be able to customize the presentation details per language as these Sitecore versions do not have the feature of shared and final layout. Also, it may be difficult to manage 10 language versions on items.
In terms of performance, if I am not mistaken, it is not recommended that an item stores many versions. Furthermore, indexing will take more time to rebuild.
Both approaches are good but it depends on how you want to structure your content tree. Also, in terms of security and access level, you need to take note who are going to work on the content tree. Will it be a single team managing all the different language versions or scattered among different teams?
UPDATE
You can have a single item node as shown below:
/sitecore/content/mycompany/Sites/NewSite
Then you only add the language version you want. That is, you want to add 10, 8 or 5 language versions based on your requirement. Then you need to setup your SiteDefinition as follows:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<sites>
<site name="mysite1" patch:before="site[@name='website']"
virtualFolder="/"
physicalFolder="/"
rootPath="/sitecore/content/mycompany/Sites/NewSite"
startItem="/home"
database="web"
domain="extranet"
allowDebug="true"
cacheHtml="true"
htmlCacheSize="50MB"
enablePreview="true"
enableWebEdit="true"
enableDebugger="true"
language="es-CR"
disableClientData="false"/>
<site name="mysite2" patch:before="site[@name='website']"
virtualFolder="/"
physicalFolder="/"
rootPath="/sitecore/content/mycompany/Sites/NewSite"
startItem="/home"
database="web"
domain="extranet"
allowDebug="true"
cacheHtml="true"
htmlCacheSize="50MB"
enablePreview="true"
enableWebEdit="true"
enableDebugger="true"
language="es-PE"
disableClientData="false"/>
<site name="mysite3" patch:before="site[@name='website']"
virtualFolder="/"
physicalFolder="/"
rootPath="/sitecore/content/mycompany/Sites/NewSite"
startItem="/home"
database="web"
domain="extranet"
allowDebug="true"
cacheHtml="true"
htmlCacheSize="50MB"
enablePreview="true"
enableWebEdit="true"
enableDebugger="true"
language="pt-BR"
disableClientData="false"/>
<site name="mysite4" patch:before="site[@name='website']"
virtualFolder="/"
physicalFolder="/"
rootPath="/sitecore/content/mycompany/Sites/NewSite"
startItem="/home"
database="web"
domain="extranet"
allowDebug="true"
cacheHtml="true"
htmlCacheSize="50MB"
enablePreview="true"
enableWebEdit="true"
enableDebugger="true"
language="es-AR"
disableClientData="false"/>
</sites>
</sitecore>
</configuration>
As you see the root path and start item may be the same but it is the language which is important here. If you specify in your URL the language, it will load the site with the proper language version.
If the url is www.mysite.com/pt-BR, it will load the website with the Portuguese Brazil language.
You can make use of the following Sitecore Module to perform the localization much quicker: Smart Tools - Add Version and Copy Content
|
Sitecore multisite , multiple country/region and multilanguage support implementation
We have implemented multisite & multilingual Sitecore implementation and now we are going to implement new website which will support 3 language and 10 country. Code base( VS solution) & Sitecore instance is common for all these sites.
Existing sites
rootPath="/sitecore/content/mycompany/Sites/USSite" startItem="/Home" --> This support only one language en
URL: http://www.myussite.com/en
rootPath="/sitecore/content/mycompany/Sites/CASite" startItem="/Home" --> This support two language en and fr-CA for this we have added fr-CA in system language.
URL: http://www.mycasite.com/en and http://www.mycasite.com/fr-CA
rootPath="/sitecore/content/mycompany/Sites/NewSite" startItem="/Home" --> This will support 3 language (english,spanish and portuguese) and for 10 country.
For this website, domain name remain same for all country. For country and language selection I will provide drop-down. I will add all required language entry in sitecore/system/language node i.e. language and country/region code
User will select country (Brazil) and language(Portuguese) then will be redirected to http://www.mysite.com/pt-BR URL and so on for all language-country combination. For example following will be URL and accordingly we will have content item for each language-country combination
http://www.mysite.com/es-PE
http://www.mysite.com/es-CR
http://www.mysite.com/pt-BR
http://www.mysite.com/es-DO
and so on for all other combination
Is this correct approach? Just want to know that after user selection for country/region code and language how should we redirect user to combined URL
Thanks
UPDATE
Basically right now we have 13 websites which is distinguished by domain name for exp. mysite.co.cr, mysite.com.ar, mysite.com.br and so on and 3 language en(English), es(Spanish) and pt(portuguese).
Region wise language list is /es-cr, /es-ar, /pt-br, /es-cl, /es-co, /es-do, /es-sv, /es-gt, /es-mx, /es-pa, /es-pe, /es-pr, /es-uy
We are planning to migrate all this to Sitecore. There will be one domain mysite.com only which show default en content. For different country/region redirection will be something like mysite.com/pt-BR
Some content pages, social, newsroom etc. will be live only in specified country not in all
All es language content (for exp. articles) remain same across the es specific country but banner/ carousal may be different region/country wise
Our existing structure is already mentioned above. So for this new site how should we organize content set up planning.
Do we need to add 10 language version for each page then only we will be able fetch relevant content as per URL like
for pt-BR region it will be mysite.com/pt-BR
for es-CR region it will be mysite.com/es-CR
for es-ar region it will be mysite.com/es-ar
and so on ( please correct me if I'm wrong here )
please provide any suggestion
| |
The [SearchReturnedItem].Paths.Path) is going to to return the list of ItemIDs for the path. You'll want to instead sort by [SearchReturnedItem].Path which will sort by the full text path you are looking for.
|
Sort Listing of search items by Item Path
I need to display a list of items based on their path. For instance:
Content tree setup:
I am trying to sort results by item path, so if I perform a search that matches the items in the below list then the results would display in the following order, regardless of relevance, age, etc.:
CategoryA
Book1
Article1
CategoryB
Book2
Article4
I have tried using .OrderBy(x => [SearchReturnedItem].Paths.Path).ToArray(), but it's not working. Does anyone have any suggestions that might help?
edit - code moved to question body
using (var searchContext = ContentSearchManager.GetIndex("<indexname>").CreateSearchContext())
{
var result = searchContext.GetQueryable<SearchResultItem>()
.Where(x => x.TemplateId.Guid.ToString()
.Contains("<Template1-GUID>,<Template2-GUID>,<Template3-GUID>,..>"));
var sortedResult = result.OrderBy(x => x.Path);
}
| |
Which version of TDS are you using? Though I won't argue that TDS can be a build performance bottle neck, version 5.5+ doesn't install the connector if one of the same version is found. See release notes for 5.5:
http://www.teamdevelopmentforsitecore.com/Download
|
TDS install the sitecore connector for each project in my solution
I am using a Helix/Habitat-inspired setup in which the Sitecore items of my solution is split into a number of smaller projects in the different layers (Foundation, Features and project). Currently we have +50 smaller TDS projects.
My issue is that it seems that TDS installs its connector for each project when i I build, which slows the build process a lot. As the connector is the same for all projects, and the Sitecore Access Guid is the same, I would expect the connector to only be installed once.
Do any of you have experience in optimizing the build process with regards to TDS?
Note: I have a TdsGlobal.config file which controls my TDS projects and currently it contains the following settings:
<!-- Deployment Properties -->
<SitecoreWebUrl>http://local.dev</SitecoreWebUrl>
<SitecoreDeployFolder>C:\Websites\local.dev\Website</SitecoreDeployFolder>
<RecursiveDeployAction>SitecoreRecycle</RecursiveDeployAction>
<InstallSitecoreConnector>True</InstallSitecoreConnector>
<DisableFileDeployment>False</DisableFileDeployment>
<SitecoreAccessGuid>b0c833d0-1061-4c83-9c84-f2418527863a
| |
From what I remember, the logic responsible for RTE links is in ExpandLinks processor of renderField pipeline:
<processor type="Sitecore.Pipelines.RenderField.ExpandLinks, Sitecore.Kernel"/>
public virtual void Process(RenderFieldArgs args)
{
Assert.ArgumentNotNull((object) args, "args");
if (Context.PageMode.IsExperienceEditorEditing)
return;
args.Result.FirstPart = DynamicLink.ExpandLinks(args.Result.FirstPart, Settings.Rendering.SiteResolving);
args.Result.LastPart = DynamicLink.ExpandLinks(args.Result.LastPart, Settings.Rendering.SiteResolving);
}
You could write your own logic here to make sure that links include host name as well.
You can also update LinkProvider method ExpandDynamicLinks to force it to include host names:
public virtual string ExpandDynamicLinks(string text, bool resolveSites)
{
Assert.ArgumentNotNull((object) text, "text");
LinkProvider.LinkParser linkParser = this.CreateLinkParser();
UrlOptions defaultUrlOptions = this.GetDefaultUrlOptions();
defaultUrlOptions.SiteResolving = resolveSites;
defaultUrlOptions.AlwaysIncludeServerUrl = true; // <---
return linkParser.ExpandDynamicLinks(text, defaultUrlOptions);
}
EDIT
If you want Sitecore to expand those links for you in custom code, you can run something like that:
protected virtual string RunPipeline(Field field)
{
using (new SiteContextSwitcher(SiteContext.GetSite("website")))
{
RenderFieldArgs renderFieldArgs = new RenderFieldArgs()
{
Item = field.Item,
FieldName = field.Name,
DisableWebEdit = true
};
CorePipeline.Run("renderField", (PipelineArgs) renderFieldArgs);
return renderFieldArgs.Result.FirstPart + renderFieldArgs.Result.LastPart;
}
}
string bodyOfEmail = RunPipeline(item.Fields[FieldIds.EmailBodyField]);
|
Add full media url in Rich text editor
We have email templates that are stored in Sitecore. We are using Richtext field to store html of emails. When I add images from Sitecore media library to that rich text field links are generating as
<img src="-/media/Id.ashx?la=en-gb" alt="email-header" width="600" height="149">
because of this, gmail rendering the image wrong as: http://-/media/Id.ashx?la=en-gb
We can search and replace the html while we sending emails, but is there is a way to tell Sitecore to use full image url's for rich text field?
| |
The problem with Sitecore.Context.Site:
Sitecore performs publishing on the publisher site, and as you noted, the publish:end is an event and is called without a request, so there isn't even a URL to work from.
Based on the above, hypothetically, if we assume that Sitecore is going to resolve a site (we don't know which yet) to put in the Sitecore.Context then the website (or custom site) that you're looking for isn't even a candidate.
Working towards getting the site:
Every item in Sitecore is site-specific, in that it's path should only ever live within a single site. The publish:end event just so happens to have a handy little Publisher object as a parameter, that holds the RootItem that was published. You can access this item and the Site it belongs to by doing the following in your event handler:
...
var scArgs = args as Sitecore.Events.SitecoreEventArgs;
if (scArgs == null)
{
return;
}
var publisher = scArgs.Parameters[0] as Publisher;
if (publisher == null)
{
return;
}
var rootItem = publisher.Options.RootItem;
var site = Sitecore.Configuration.Factory.GetSiteInfoList()
.FirstOrDefault(site => rootItem.Paths.FullPath.StartsWith(site.RootPath));
...
But wait! What about multi-site publishes?
What if you published more than one site? Now you will match the first one, when you should probably return both or return null. On the flip side, what if you published the full solution and have only one site, or else you published the full solution and now you want to get all sites that you published? The above will give you null in these cases, but maybe that's not what you want.
Getting the site with multi-site publishing support:
In order to support multi-site and situations where you may have published the full solution, update the above to the following:
...
var scArgs = args as Sitecore.Events.SitecoreEventArgs;
if (scArgs == null)
{
return;
}
var publisher = scArgs.Parameters[0] as Publisher;
if (publisher == null)
{
return;
}
var rootItem = publisher.Options.RootItem;
var publishedSites = Sitecore.Configuration.Factory.GetSiteInfoList()
.Where(site => rootItem.Paths.FullPath.StartsWith(site.RootPath));
...
We aren't done yet, however. You still don't have the URL of the site.
Solution: Getting the URL of the published site(s)
The site-definition nodes have the nifty little optional attributes targetHostName and scheme. Assuming that you have specified a value for those attributes, you can then retrieve the URLs of the sites of the sites you published by updating the above to the following:
...
var scArgs = args as Sitecore.Events.SitecoreEventArgs;
if (scArgs == null)
{
return;
}
var publisher = scArgs.Parameters[0] as Publisher;
if (publisher == null)
{
return;
}
var rootItem = publisher.Options.RootItem;
var publishedSites = Sitecore.Configuration.Factory.GetSiteInfoList()
.Where(site => rootItem.Paths.FullPath.StartsWith(site.RootPath));
var publishedHosts = publishedSites
.Select(site => site.Properties["scheme"] + @":\\" + site.Properties["targetHostName"]);
...
|
How to get hostname on publish end event
I am trying to get "http://hostname" in below way.
string.Concat(Request.Url.Scheme, Uri.SchemeDelimiter, Request.Url.Host)
this should work in normal cases, but i am doing this on publish:end event, where request is null.
The context site is publisher and could not find Request property in EventArgs whats the best way to get Request properties in this case?
| |
I think you are talking about custom field type.
Looks like you are talking about something that cannot be done with standard field types thus you will have to create your own custom field type for that
How to create custom field type
Implement your custom field
namespace Sitecore.Playground.Fields.FieldTypes
{
public class CustomField : Edit
{
protected override void DoRender(HtmlTextWriter output)
{
Attributes["placeholder"] = Translate.Text(Placeholder);
string str = " type=\"hidden\"";
SetWidthAndHeightStyle();
output.Write("<input" + ControlAttributes + str + ">");
RenderChildren(output);
// render your custom control here
}
}
}
Notice output.Write usage.
Now you have to build your own HTML with rows, columns and then store a raw value of the field in <input>.
Perhaps you will have to override Value property from the base class to properly serialise/deserialize stored value.
As you probably know each field value can be expressed as Raw Value. Idea is that your field raw value could be for example:
1|2|3|4;5|6|7;8|9|0
then in C# code, you need to properly render those values as rows/columns. This is an example, I don't know what you want to store there.
Register your custom field with config
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<controlSources>
<source mode="on" namespace="Sitecore.Playground.Fields.FieldTypes" assembly="Sitecore.Playground" prefix="myCustomPrefix" />
</controlSources>
</sitecore>
</configuration>
Create field type item in core database
/sitecore/system/Field types/Developer Types/My Custom field
Fill Control field with this value: myCustomPrefix:CustomField
This blog post might be useful for you:
https://www.sitecore.net/company/blog/474/creating-a-custom-sitecore-field-4246
|
How to create a multiple column field with text boxes
I am trying to figure out if i can have multiple columns and multiple rows for one particular field under an item in Content Editor.
Field Name:
[column 1][column 2][column 3][column 4][column 5]
This serves as a drawing. So in Content Editor, where you can fill out Details of the item, I would like to have multiple columns and multiple rows. So the data will be served under one particular "Type". Hopefully this makes sense
| |
You can't patch configuration that are outside of Sitecore node section.
To patch configuration outside Sitecore node I recommend you to use SlowCheetah.
Patching only works on the Sitecore configuration section. This is located in under /configuration/sitecore node section. Configuration in other sections of Web.config cannot be controlled through patching.
How to See the Result of Patching
Since the Sitecore configuration is the result of the merging of configuration from Web.config with a variable number of patch files, you cannot look at Web.config or any individual patch file in order to determine the configuration Sitecore is using. Sitecore includes an admin script to do this.
The script displays the results of the config file patching process.
http://[host]/sitecore/admin/ShowConfig.aspx
You can find SlowCheetah on below link :
https://visualstudiogallery.msdn.microsoft.com/69023d00-a4f9-4a34-a6cd-7e854ba318b5/view/Discussions/1
Getting started is really simple, just install this package. Then in the solution explorer you can easily add your config transform by right-clicking and selecting Add Transform.
After you add the transform you will notice a transform for each build configuration.
You can place your customizations inside of the transform files, for example if you want to tweak app settings and connection strings you might use the syntax shown below.
When you build your applicatoin the files are transformed and dropped into the output directory. If you are transforming the app.config then when the file is transformed it will be renamed in the output directory as usual to ensure that your application picks it up at runtime.
For web projects the files are transformed when you publish or package your application.
You can also quickly preview your transform using the Preview Transform context menu on the transform file.
|
How to patch 'system.webServer' using Sitecore patch config file
The browser console was showing errors for woff font type. So, in the site's web.config I included this property and it was fixed.
<system.webServer>
......
......
<staticContent>
<mimeMap fileExtension=".woff" mimeType="application/font-woff"/>
</staticContent>
</system.webServer>
But, I want to add this property via a patch. I created a config in the VS project /App_Config/Include/MySite.config as below and published:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
</staticContent>
</system.webServer>
</sitecore>
</configuration>
In the site's showconfig.aspx it is rendered as below, but the woff error in the console shows up.
<system.webServer patch:source="MySite.config">
<staticContent>
<mimeMap fileExtension=".woff" mimeType="application/font-woff"/>
</staticContent>
</system.webServer>
Am I including the patch in the right way?
Using Sitecore 8.0 with MVC
| |
You can't find any new fields there out of the box. But Sitecore recently introduced the Standard Comment Template, thereby making it possible to cook up more advanced authoring scenarios.
Grant Bartlett has a good example of what that could look like in Sitecore 8: Advanced workflow commenting
In short; it was changed because Sitecore now has the ability to attach a "Comment Template" to workflows, and therefore it is now easier to extend for specific needs.
|
Why was WorkflowPipelineArgs Comments changed to CommentFields in Sitecore 8?
Previously we used string WorkflowPipelineArgs.Comments which seems got obsolete now and suggests to use StringDictionary WorkflowPipelineArgs.CommentFields.
By using Reflector tool I found that to read comments I should write as below:
WorkflowPipelineArgs.CommentsField["Comments"]
My question is why it was changed like that and what other values we can find from CommentFields property?
| |
Here is the link to the doc describing what you want to achieve:
https://doc.sitecore.net/web_forms_for_marketers/setting_up_web_forms/appearance/create_a_custom_css_style_in_a_web_form
And here is copy paste from that page with main points so no one tells that it's a link only answer ;)
To create a custom CSS style:
In the Website\sitecore modules\Shell\Web Forms for Marketers\Themes\folder, in the custom.css file, define a new CSS style.
In the Content Editor, navigate to the sitecore/System/Modules/Web Forms for Marketers/Settings/Meta data/CSS Classes folder, and in the right pane click Extended List Item.
In the Message dialog box, enter the name of the CSS style, for example Short Date. Click OK.
In the right pane, in the Value field, enter the name of the CSS style. Click Save.
Your custom CSS style is now added, and you can apply it to any form field in the Form Designer.
|
Web Forms For Marketers Custom Class on Form's fields?
I am trying to add the custom class on the form field, can anyone help me that how can i add or what will the flow to add custom class for form's fields
| |
From a purely technical perspective, locales and cultures have no bearing on timezones (i.e., en-US does not mean or even imply the EST time zone, or any other time zone). This is not a Sitecore specific detail.
Inside the CMS, dates are displayed and take input based on the ServerTimeZone setting. However, all dates are stored inside the database as UTC and retrieved as UTC.
The language version of an item has no bearing on what time zone the date/time field is using for input. If you want the ability to set specific time zones on date fields, you'll need to use a custom field such as this one: DateTimeZoneField
|
Datetime Field in multilingual environment
We have multilingual site, which has content editors from around the world.
We have a maintenance banner on home page which display "Site will be down from dd:mm:yyyy time to this dd:mm:yyyy". This banner should be content manageable. That means content editors can pick From Date and To Date in sitecore to display/hide this banner.
My question is, how does sitecore date time field deal with time zones?
Example scenario:
In fr-FR sitecore Item version, If a content editor from France added from date today 9 AM To today 12PM.
In en-GB sitecore item version, if a content editor from London added From date today 9AM To today 12PM.
Does below code, displays banner from 9AM to 12PM in french site at french local time and 9AM to 12PM in GB site at GB local time?
@{ if (ShowBroadcastMessageFrom >= DateTime.UtcNow && ShowBroadcastMessageTo <= DateTime.UtcNow)
{
//Show maintenance banner
}
}
If not, what's the best way to achieve this?
| |
To get Sitecore to resolve datasources using custom logic, you can add a pipeline processor to the resolveRenderingDatasource pipeline in Sitecore.config:
<resolveRenderingDatasource>
<processor type="Example.DataSourceService, Example"/>
</resolveRenderingDatasource>
The DataSourceService processor can then inject any custom logic it needs for resolving the datasource string to an ID:
public class DataSourceService
{
public void Process(ResolveRenderingDatasourceArgs args)
{
if (!args.Datasource.StartsWith("site:"))
return;
if (Context.Database == null || Context.Site == null)
{
args.Datasource = "";
return;
}
var item = CustomQuery(args.Datasource);
args.Datasource = item.ID.ToString();
}
}
MVC:
If you're in an MVC environment you'll need to also add a processor to the mvc.customizeRendering pipeline in Sitecore.MvcExperienceEditor.config:
<mvc.customizeRendering>
<processor type="Example.ResolveRenderingDatasource, Example" patch:after="*"/>
</mvc.customizeRendering>
The ResolveRenderingDatasource processor needs to call the resolveRenderingDatasource pipeline.
Also make sure you add reference to Sitecore.Mvc.Analytics.
using Sitecore.Mvc.Analytics.Pipelines.Response.CustomizeRendering;
using Sitecore.Pipelines;
using Sitecore.Pipelines.ResolveRenderingDatasource;
public class ResolveRenderingDatasource : CustomizeRenderingProcessor
{
public override void Process(CustomizeRenderingArgs args)
{
var rendering = args.Rendering;
var renderingDatasourceArgs = new ResolveRenderingDatasourceArgs(rendering.DataSource);
CorePipeline.Run("resolveRenderingDatasource", renderingDatasourceArgs);
rendering.DataSource = renderingDatasourceArgs.Datasource;
}
}
|
Custom rendering datasource syntax without breaking experience editor
I'd like to be able to use a custom datasource syntax for renderings and sublayouts.
In particular I'd like to be able to handle custom prefixes for various different usages. The main one being site-relative paths such as:
site:*[@@templateid="{...guid...}"]
I've had no problem using the custom syntax from codebehind, as it's available as a raw string.
The issue arises in Experience Editor mode. If I use a custom datasource syntax the frame of the rendering breaks.
Is there a pipeline I need to use to tell Sitecore what item or ID it should be using for the rendering?
| |
You can create a custom style and assign it to each form individually.
Create an item under /sitecore/system/Modules/Web Forms for Marketers/Settings/Meta data/Submit Button Type of template type /sitecore/templates/Web Forms for Marketers/Meta Data/Extended List Item and set the Value to your custom CSS class.
Then on the form itself, you can select the style in the Submit Button type field. You have to do this from the Content Editor, there is no option to set this from the Form Designer.
The style on your submit button will be set as btn custom-style-value. The value from Submit Button size field is also applied in the same way, so it's possible to use that for styling also.
|
WFFM Custom Class for Submit Button
I was wondering if we could apply custom classes (bootstrap) to the submit button in WFFM? I know that form inputs seem to have this ability, but I don't seem to see this feature for the submit button itself.
| |
TL;DR
Some possible solutions to reduce build/deployment time:-
Reduce the number of projects in your solution by 'compacting' projects.
Reduce the number of projects in your solution by having a Tests-project-free sln file.
Create an sln file with the explicit ProjectDependencies removed. This would only be for local builds. It doesn't help you for your deployments after a pull from source control.
Utilize the Delta Deployment feature in TDS, deploying only items changed after a set date (like one week ago).
Remove any other unnecessary things being run for local builds.
Long Version
When developing with Helix, a common pain that people have reported is the lengthy build times due to the large amounts of projects in the solution.
Naturally, the more projects, the longer the build/deployment time.
As TDS serializes items into projects, this again means that there will be more projects in your solution.
If the number of projects is becoming a pain, I would suggest considering how you could reduce the number of projects, but still maintain the Helix principles in your solution. This can be done by utilizing Hedgehog's FxCop rules which perform code analysis based on your namespaces.
Maybe you want to consider duplicating the sln file, having one for general development (removing the Tests projects), and one complete one where the Tests are still included. For the Tests-free sln, Visual Studio may run builds faster.
As for the deployment of the solution, the Habitat.TDS repository adds custom 'Project dependencies' to force a correct deployment order within the solution (this is done in the original repo with custom gulp scripts, deploying Foundation -> Feature -> Project layers). This custom deployment order should always be maintained when:-
performing an initial deployment
performing a deployment when you've retrieved code and items from other developers (like when you get the latest from source control through a git pull)
However, during your own development (in between source code retrieval....just developing locally), you theoretically don't need this order for just builds (because you're not doing deploys). It's not ideal, but you could duplicate your sln file, remove all the custom project dependencies (the sections in the raw sln file that have ProjectSection(ProjectDependencies)), and develop with that. This way Visual Studio builds only projects with the actual references, and doesn't unnecessarily go through the entire solution. I've tested this on the example site, and found a little bit of improvement in build times.... but again, it's not an ideal scenario.
Here's a PowerShell script that can create this sln file for you:- https://github.com/HedgehogDevelopment/Habitat/blob/TDS-latest/scripts/CreateQuickBuildSlnFile.ps1
Utilize the 'Deploy Items Changed After' option on the Properties -> General Tab. (You could set this in your local TdsGlobal.config.user file using the <IncludeItemsChangedAfter> node). This ignores the deployment of items from AFTER the set date. Maybe set the date to 1 week prior. This can greatly speed up the local deployment process.
You want to be careful about this though, as it uses the __Updated field on the items to do the comparison out of the box....so you could customize it to check source control for updated .item files instead.
Minimize the other things that cause the build to take longer. In one solution, I saw that the developers were running certain gulp tasks that weren't needed for every build. They also had Razor View compilation. Now for these, we moved them out to the 'Release' configuration, so they were still run, but only for CI builds, not local developer builds (which are run on the 'Debug' configuration).
All up, using some combinations of the above, we found that we were able to reduce some build times from 14 minutes down to about 2 minutes. Again, it depends on your solution, but these are some things you may want to consider.
|
Slow build performance using TDS (Helix-inspired)
I am using TDS to maintain my Sitecore items in a Helix-inspired solution with around 50 smaller projects (currently with 17 TDS projects). When I try to deploy my TDS projects locally, it takes +9 minutes for the 17 projects, which is a pain in a multi-developer setup, in which I often have to push items from other developers (without knowing which of the TDS projects they have commited to - if we only had a single TDS project I could simply sync that project).
We are using TDS version 5.5.0.20 and my Gulp build configuration is:
return gulp.src([location + "/**/tds/**/*.scproj"])
.pipe(foreach(function (stream) {
return stream
.pipe(debug({ title: "Building project:" }))
.pipe(msbuild({
targets: ["Deploy"],
configuration: config.buildConfiguration,
logCommand: false,
verbosity: "minimal",
stdout: true,
errorOnFail: true,
maxcpucount: 0,
toolsVersion: 14.0,
properties: config.tdsMsbuildProperties
}));
}));
Any tips on how to optimize the deployment of TDS items across multiple projects?
| |
EXM utilizes Sitecore's own rendering system to create each message. In doing so, the Dispatch server will make a call to the content delivery role to display the email through an HTTP call. It does so by passing in a handful of arguments, of which include both Message ID and Contact in EXM's GetBody() method.
This process then emulates as the user, meaning when Sitecore renders the components on the email, it's doing so, just like if it were drawing to a web page.
Therefore all aspects of the Sitecore Context, as well as Analytics context, exists.
That means we can retrieve the Sitecore Contact by using normal API methods.
Tracking.Current.Contact should reveal the contact that the message is being built for.
From there, you can access the Contact Facets through normal means.
If you're using a shared layout, you can use the following method to determine whether a sublayout is rendering for a normal page request or EXM is requesting a message body, use:
Sitecore.Modules.EmailCampaign.Util.IsMessageBodyRequest()
|
Is there a recommended way to retrieve information about the current recipient in EXM?
As the title says. If I have some logic to run that requires information about the current contact / recipient an email is being sent to, e.g. contact facets, what is the best way to get a hold of that contact profile?
| |
In the above example, the SolutionConfig XML attribute is constructed by the build process. Internally, this overrides the Configuration parameter when the build supplies the SolutionConfig value.
Remove the SolutionConfig property:
<GetFilesToTransform
FileExtension="config"
Configuration="Local"
SourceWebProject="$(SourceWebProject)"
WebProjectRoot="$(MSBuildProjectDirectory)\$(SourceWebPhysicalPath)"
WebProject="$(SourceWebVirtualPath)"
Condition="'$(ConfigTransformAvailable)' == 'true'">
<Output TaskParameter="TransformFilesToRemove" ItemName="TransformFilesToRemove"/>
<Output TaskParameter="Transforms" ItemName="Transforms"/>
</GetFilesToTransform>
And ensure that the file in the csproj has the dependant element:
<Content Include="App_Config\Include\_Common\Sites.Local.config">
<DependentUpon>Sites.config</DependentUpon>
<SubType>Designer</SubType>
</Content>
|
TDS GetFilesToTransform
I am playing around with the TDS task GetFilesToTransform. I want to try and transform files based on an environment variable that is not the current build configuration.
The default task definition in C:\Program Files (x86)\MSBuild\HedgehogDevelopment\SitecoreProject\v9.0\HedgehogDevelopment.SitecoreProject.targets is this:
<GetFilesToTransform
FileExtension="config"
SolutionConfig="$(CurrentSolutionConfigurationContents)"
Configuration="$(Configuration)"
SourceWebProject="$(SourceWebProject)"
WebProjectRoot="$(MSBuildProjectDirectory)\$(SourceWebPhysicalPath)"
WebProject="$(SourceWebVirtualPath)"
Condition="'$(ConfigTransformAvailable)' == 'true'">
<Output TaskParameter="TransformFilesToRemove" ItemName="TransformFilesToRemove"/>
<Output TaskParameter="Transforms" ItemName="Transforms"/>
</GetFilesToTransform>
I assumed that the Configuration property would allow me to pass in a different variable and pickup config transforms. I have duplicated this entry and created my own build task that looks like this:
<GetFilesToTransform
FileExtension="config"
SolutionConfig="$(CurrentSolutionConfigurationContents)"
Configuration="Local"
SourceWebProject="$(SourceWebProject)"
WebProjectRoot="$(MSBuildProjectDirectory)\$(SourceWebPhysicalPath)"
WebProject="$(SourceWebVirtualPath)"
Condition="'$(ConfigTransformAvailable)' == 'true'">
<Output TaskParameter="TransformFilesToRemove" ItemName="TransformFilesToRemove"/>
<Output TaskParameter="Transforms" ItemName="Transforms"/>
</GetFilesToTransform>
I am using Local as the configuration. However this is task still transforming using the build configuration value of DEBUG instead of Local. Any suggestions why this happening?
This is the build log:
11> Task "GetFilesToTransform"
11> Task Parameter:FileExtension=config
11> Task Parameter:SolutionConfig=<SolutionConfiguration>
11><ProjectConfiguration Project="{135a1e1b-e091-439b-97d1-6f871280e339}" AbsolutePath="F:\TDS.Master.scproj">Debug|AnyCPU</ProjectConfiguration>
11><ProjectConfiguration Project="{b4239999-0ae1-438a-842b-094a33a8a2d1}" AbsolutePath="F:\Host.csproj">Debug|AnyCPU</ProjectConfiguration>
11> Task Parameter:Configuration=Local
11> Task Parameter:SourceWebProject={b4239999-0ae1-438a-842b-094a33a8a2d1}|EC.SWP.Common.Host\EC.SWP.Common.Host.csproj
11> Task Parameter:WebProjectRoot=F:\Host
11> Task Parameter:WebProject=/Host.csproj
11> Transforms=
11> App_Config\Include\_Common\Sites.config
11> TransformFile=App_Config\Include\_Common\Sites.Debug.config
11> web.config
11> TransformFile=web.Debug.config
| |
You can look up installed licenses from the Content Editor. There might be more ways to reach this, but that's where I normally go.
Then check for your specific license. In this case xDB.
Unfortunately I know of no easy way to determine, exactly what license key is required for the various aspects of xDB. But anything not licensed, should not be showing up on the dashboard.
|
Experience Analytics licensing
How do you quickly determine if a client’s license includes something like Experience Analytics? Is it basically that if the license wasn’t good for a component, it wouldn’t show up on the Launchpad or work, or is there somewhere in the license itself to see? I can see Experience Analytics on the CM, and it looks like it's collecting data (I'm not sure it's any good but that's another story), so I'd assume it's licensed but I'd like to be sure.
| |
Looks like you might have Tracing enabled. This can be configured on a web.config level, something like this:
<configuration>
<system.web>
<trace enabled="true" pageOutput="false" requestLimit="40" localOnly="false"/>
</system.web>
</configuration>
See also: How to: Enable Tracing for an ASP.NET Application
|
Content tree outputing request
Has anyone seen this? I have Sitecore 8.0 update 7 running and at times(it comes and goes, haven't determined when exactly and why) I see this request output showing along side with the content tree on the content editor view? I'm not seeing any exceptions on logs that indicate anything useful on this matter
| |
The problem could be that the Powershell script which is enabling all Solr configuration files. You have to be careful because if you are using a regex for that (all files which name contains "Solr") then it is also enabling Sitecore.ContentSearch.SolrCloud.SwitchOnRebuild.config.example. This should be disabled if you did not configure it.
|
How can I use SXA and SOLR together?
I've installed Sitecore 8.2 Original release, and then Ran the Sitecore Powershell Extensions-4.3 for Sitecore 8 and the Sitecore Experience Accelerator 1.2 rev. 161216 onto the instance. That all seems to work just fine. However, the problem comes when I convert my site to run on SOLR. As soon as I do this I get a SOLR Error. Here's what I get:
Server Error in '/' Application.
Could not create instance of type: Sitecore.XA.Foundation.Search.Providers.Solr.SolrSearchIndex. No matching constructor was found.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Sitecore.Exceptions.ConfigurationException: Could not create instance of type: Sitecore.XA.Foundation.Search.Providers.Solr.SolrSearchIndex. No matching constructor was found.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ConfigurationException: Could not create instance of type: Sitecore.XA.Foundation.Search.Providers.Solr.SolrSearchIndex. No matching constructor was found.]
Sitecore.Configuration.DefaultFactory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert) +291
Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +165
Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert) +72
Sitecore.Configuration.DefaultFactory.GetInnerObject(XmlNode paramNode, String[] parameters, Boolean assert) +932
Sitecore.Configuration.DefaultFactory.AssignProperties(XmlNode configNode, String[] parameters, Object obj, Boolean assert, Boolean deferred, IFactoryHelper helper) +560
Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +322
Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert) +72
Sitecore.Configuration.DefaultFactory.CreateObject(String configPath, String[] parameters, Boolean assert) +619
Sitecore.ContentSearch.ContentSearchManager.get_SearchConfiguration() +266
Sitecore.ContentSearch.SolrProvider.SolrContentSearchManager.get_Cores() +92
Sitecore.ContentSearch.SolrProvider.SolrNetIntegration.DefaultSolrStartUp.Initialize() +255
(Object , Object[] ) +71
Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +484
Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22
Sitecore.Nexus.Web.HttpModule.Application_Start() +259
Sitecore.Nexus.Web.HttpModule.Init(HttpApplication app) +704
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +618
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +402
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +343
[HttpException (0x80004005): Could not create instance of type: Sitecore.XA.Foundation.Search.Providers.Solr.SolrSearchIndex. No matching constructor was found.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +579
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +112
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +712
If I switch back to Lucene, everything works fine. However, my production environment (and my test environments) are all SOLR, so I need to be able to use SXA in a SOLR environment. What am I missing?
| |
I found the root of the issue. It was caused by some controller actions, for which:
Either the [ValidateRenderingToken] attribute was missing;
Or the [ValidateRenderingToken] attribute was added after the [ValidateAntiForgeryToken] attribute, thus changing the execution order.
|
How to use the AntiForgeryToken with a custom log-in form?
There may be several forms on any given page of our site. Distinguishing between post requests from these forms is implemented using ValidateRenderingToken. There is also AntiForgeryToken / validation defined for every form.
One of these forms is the log-in / log-out form in the header. My problem is currently this error when logging in:
The provided anti-forgery token was meant for user "", but the current user is "extranet\someuser".
And this error when logging out (previously logged in as an admin):
The provided anti-forgery token was meant for user "sitecore\admin", but the current user is "".
As I understand, this is because the user is changed in the middle of the request, and the [ValidateAntiForgeryToken] attribute for all subsequent post handlers on the page gets called anyway and fails. This is despite having a [ValidateRenderingToken] attribute on every POST handler:
[HttpPost]
[ValidateRenderingToken]
[ValidateAntiForgeryToken]
public ActionResult Index(SomeModel model)
{
// ...
}
The only solution that comes to mind is to somehow postpone the login/logout procedure until the end of the request, when all anti-forgery validation has been executed. Is there a better, more standard way of handling the log-in / log-out procedure with multiple secured forms on the page?
| |
Security Setup
Here are the steps I followed to grant access.
Navigate to the item /sitecore/content/Documents and settings/All users/Start menu/Right/Reporting Tools/PowerShell Reports
Grant access to sitecore\Sitecore Client Authoring
See changes.
Troubleshooting
If you see the report menu item but does not expand, ensure that the user has access to the group defined in the configuration for Execution service.
Example: If you decided to use a different group in the above, then be sure to patch the setting below. Issue #765 will be addressed in 4.4, however you can manually fix it.
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<powershell>
<services>
<remoting>
<authorization>
<patch:delete />
</authorization>
<authorization>
<add Permission="Allow" IdentityType="Role" Identity="sitecore\Sitecore Client Users" />
</authorization>
</remoting>
</services>
</powershell>
</sitecore>
</configuration>
Book Documentation
Instructions from this page have been copied to the book.
|
Sitecore Powershell Extensions - Reports Authorization
I've created some PSE scripts to give our client some reports on their content. I created them under the proper convention of Script Module and Script Library so that the reports show up under Reporting Tools in the Sitecore start menu.
Tree:
Menu:
This works great for an admin. What I can't figure out is how to grant access to these reports to editors. In Core, I've given Read access to /sitecore/content/Documents and settings/All users/Start menu/Right/Reporting Tools/PowerShell Reports. I've also given read access in Master to my script module, script library and individual scripts.
What am I missing to allow editors to see these reports in the Sitecore start menu? With the access changes noted above, they only see an empty Powershell Reports menu.
| |
I can confirm this is working as you describe. Standard values or base templates in general are not available in the search index.
You'll have to add your own computed field to enable this:
https://reasoncodeexample.com/2014/01/29/indexing-base-templates-sitecore-7-content-search/
|
Sitecore Search and Standard Values
Let's say you have an item with a checkbox field "DisplayOnPage", and the standard values for the Items template has "DisplayOnPage" set to be checked by default (thus the standard value for this field is "1"). If you do a field query against an index containing your item, and look for items where "displayonpage" = "1", your item that is using the standard value (again, to set the value of the DisplayOnPage field to 1) will NOT return as a result. If, on your item, you uncheck the DisplayOnPage field, save the item, then recheck the DisplayOnPage field, save again and publish - your item will be returned by your FieldQuery.
I believe the cause to this is that standard value fields are not stored by items explicitly in the database, so the Sitecore Search doesn't make the connection that your item implicitly has the value you're searching for.
Is there a way around this?
| |
First things first. The fact that you get YSOD on a malformed value is actually a bug. It is registered with Sitecore under public reference 96011.
That said; internally; General Link is an XML element. For your scenario to work, you need to store your value as such. The element looks like this:
<link
text="Text"
linktype="internal/external"
url="url"
anchor="anchor"
title="title"
class="class"
querystring="querystring"
target="target"
id="id" />
So in your case, something like this should work:
<link linktype="external" url="http://placehold.it/350x150" />
I don't believe any of the other attributes will be required, for an external link such as yours.
Or the full code example:
Sitecore.Security.Accounts.User.Profile.SetCustomProperty("ProfilePhoto", "<link linktype=\"external\" url=\"http://placehold.it/350x150\" />");
Sitecore.Security.Accounts.User.Profile.Save();
|
How to programatically update a General Link field in a custom user profille?
I have a template for a custom user profile that has a General Link field type. Here's what I am trying to do:
Sitecore.Security.Accounts.User.Profile.SetCustomProperty("ProfilePhoto", "http://placehold.it/350x150");
Sitecore.Security.Accounts.User.Profile.Save();
Problem is that by updating this way it messes with the General Link field for this field expects an XML.
Notice how this field is displayed (blank) after updating it the way above:
And then when I click on Insert Link it displays the yellow screen of death.
To fix that I have to click on Clear and then try to insert a link again.
Any idea?
| |
If you will have the same domain but different rootPath, you will need to make use of the virtualFolder and physicalFolder attribute in the sitedefinition.config.
The virtualFolder and physicalFolder will allow you to use the same domain but having different sites that hits different rootPath. This will allow you to have less coding.
Site Definition Example:
Once the Site Definition is setup, patch the Sitecore setting AlwaysStripLanguage to set the value to false as shown below:
From
<setting name=”Languages.AlwaysStripLanguage” value=”true”/>
To
<setting name=”Languages.AlwaysStripLanguage” value=”false”/>
You may check my blog post how to setup it here: https://hishaamn.wordpress.com/2016/12/22/sitecore-multi-sites-with-same-domain-but-different-sitecore-item-node/
|
Multi-Site setup and Single domain configuration
When configuring a multi-site solution on Sitecore 7.2 Update 2, the client has decided to switch to a single domain. I would like to keep it as a multi-site solution in case the client decides for two domains in the future. There is minimal content that is shared across the sites.
I know that I can use https://marketplace.sitecore.net/en/Modules/Multiple_Sites_Manager.aspx. I am looking for other possible solutions as well.
The Sitecore Tree is:
sitecore
|_content
|_Personal
|_Business
|_Dictionaries
The Dictionaries are setup
Dictionaries
|_Personal Dictionary : Fallback Global
|_Business Dictionary : Fallback Global
|_Global Dictionary
The sites configuration is below:
<site name="personal"
hostName="www.mydomain.com"
targetHostName="www.mydoman.com"
virtualFolder="/"
physicalFolder="/"
rootPath="/sitecore/content/personal"
dictionaryDomain="{UniquePersonalDictionaryDomain}"
patch:before="site[@name='modules_website']"/>
<site name="business"
hostName="business.mydomain.com"
targetHostName="business.mydomain.com"
virtualFolder="/"
physicalFolder="/"
rootPath="/sitecore/content/business"
startItem="/Home" database="web"
domain="extranet" allowDebug="true"
cacheHtml="true" htmlCacheSize="10MB"
registryCacheSize="0" viewStateCacheSize="0"
xslCacheSize="5MB" filteredItemsCacheSize="2MB"
enablePreview="true" enableWebEdit="true"
dictionaryDomain="{UniqueToBusinessDictionary}"
enableDebugger="true" disableClientData="false" />
<site name="website">
<patch:attribute
name="rootPath">/sitecore/content/public</patch:attribute
<patch:attribute name="dictionaryDomain">{UniqueToBusinessDictionary}</patch:attribute>
</site>
| |
Issue Resolved
Cause of Issue:
Created a Sitecore Item with basic template under /sitecore/client/Your Apps and browsed by using the physical path of the layout.
Solution:
Created a Sitecore Item under /sitecore/client/Your Apps using Speak related templates using sitecore rocks.
Assigned a relevant layout and browsed that item with Sitecore Item path as url (sitecoreinstance/itempath).
|
cshtml file is not accepting in server it shows the error "does not inherit from 'System.Web.WebPages.WebPage'."
I am working on speak-ui. I have created one view (mybutton.cshtml) under sitecore/client/speak/Your Apps/App/ in the core database. When i am trying to see the preview page it shows
Type 'ASP._Page_sitecore_shell_client_App_myButton_cshtml' does not inherit from 'System.Web.WebPages.WebPage'
Here is my code:
mybutton.cshtml:
@model Sitecore.Mvc.Presentation.RenderingModel
@{
}
<div>
<h1>Hello world</h1>
</div>
I added these lines in web.config file (C://windows/Microsoft.net/Framework64/config/) also.
<add key="webpages:Enabled" value="true"/>
if I add below code in cshtml.
@inherits Sitecore.Mvc.Presentation.RenderingModel
I am getting below error
Can anyone suggest how to fix this issue.
| |
Which version of SXA are you using? I'm asking because this <div class="component-content @Model.CssClasses.Aggregate()"> is old piece of code. Since 1.2 you should use @Html.Sxa().Component("MyMenu", Model.Attributes).
"MyName" isn't a name of your component, it's one of CSS class which will be added to the wrapping div.
In SXA we have created separate pipeline which can be used to add additional attributes to the renderings. It's use for example in the Creative Exchange.
So the @Html.Sxa().Component helper method beside attributes from Model.Attributes list (you can fill that list in the Controller of your rendering - it's inherited from StandardController) also adds attributes which you decide to add in the processors.
The pipeline is called decorateRendering. An example processor can look like this:
public class AddMyCssClass : RenderingDecorator
{
public override void Process(RenderingDecoratorArgs args)
{
if (YOUR_CUSTOM_CONDITION)
{
args.AddAttribute(Foundation.MarkupDecorator.Constants.AttributeNames.Class, "my-custom-class");
}
}
}
|
How does CssClasses and Attribute work?
I think I understood the principle of creating an SXA controller with this topic Here.
But i have some question about :
@Html.Sxa().Component("MyName", Model.Attributes)
@Model.CssClasses.Aggregate()
To exert myself, I developed a rendering controller that allows to display a menu according to its datasource and the buttons that it has as child.
And I have this in experience editor :
And this in preview :
So I think this comes from the definition I did not make on Attributes and CssClasses in my model ? Why my menu is different between Experience editor and preview ?
So, my question is : How does CssClasses and Attribute work ? And do I have to deffine them in my repository or elsewhere ?
For info, here is the code of my view :
<div @Html.Sxa().Component("MyMenu", Model.Attributes) >
<div class="component-content @Model.CssClasses.Aggregate()">
@if (!this.Model.ListeBoutons.Any())
{
@Model.MessageIsEmpty
}
else
{
<ol>
@foreach (var bouton in Model.ListeBoutons)
{
<li>
<a href="@bouton.Url">@bouton.Label</a>
</li>
}
</ol>
}
</div>
But i have a error with this code ( System.ArgumentNullException: Value cannot be null. ) because of @Model.CssClasses.Aggregate(). So I removed it to have the previous capture of my menu in Experience Editor.
In advance thank you for your feedback.
| |
What is your logger level set to? you can change it to Debug and that should show the ID of the items being skipped. This should reflect on the logs the IDs of the items.
In the Sitecore.config change to Debug as in:
<logger name="Sitecore.Diagnostics.Publishing" additivity="false"> <level value="INFO" /> <appender-ref ref="PublishingLogFileAppender" /> </logger>
|
Is there a way to check which items got skipped during publishing?
I am using Sitecore 8.1 update 1. I wanted to check if there is a way by which I can get a list of skipped items during publishing process? I have come across the Sitecore module that does it but I am not allowed to install any modules at this time.
Hence I was wondering if there is any way I can check the list of skipped items during publishing without installing any modules!
| |
Yes. You have to install commerce server to create an edge catalog between the commerce site and AX. Your website calls commerce runtime services for catalog information and real time services for customer and order information.
Then AX syncs products with the edge catalog via the AX real time services.
http://commercesdn.sitecore.net/SCpbMD81/SitecoreCommerceMicrosoftDynamics/en-us/Concepts/c_AX_CommerceServerCatalogEdgeCatalog.html
|
Is Commerce Server required to connect Dynamics AX to Sitecore?
As per the subject. I had a client ask whether they needed to install Commerce Server to connect to their retail installation of DAX.
| |
It's possible to extend although not entirely that easy because Sitecore uses a lot of dynamics instead of actually typing things when it comes to ItemWebApi.
A small example (note that this kinda works but isn't intended to actually be used, more like a starting point):
public class SortResult : ReadProcessor
{
#region Overrides of OperationProcessor<ReadArgs>
public override void Process(ReadArgs arguments)
{
// Gets the sorting parameter.
// This needs to exist in the parameters list found underneath processor type="Sitecore.ItemWebApi.Pipelines.Request.CheckParameters, Sitecore.ItemWebApi"
var sortingParameter = arguments.Context.HttpContext.Request.Params["sorting"];
if (string.IsNullOrWhiteSpace(sortingParameter)) return;
var getResult = arguments.Result as Dictionary<string, object>;
var result = getResult?["result"] as Dictionary<string, object>;
var items = result?["items"] as Sitecore.ItemWebApi.Dynamic[];
if (items != null)
{
// Sort the result using the key provided.
var sortedItems = items.OrderBy(item => item[sortingParameter]);
result["items"] = sortedItems.ToArray();
}
}
#endregion
}
And the config showing where to patch it:
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<itemWebApiRead>
<processor type="ItemWebApi.Pipelines.Read.SortResult, ItemWebApi"
patch:after="processor[@type='Sitecore.ItemWebApi.Pipelines.Read.GetResult, Sitecore.ItemWebApi']" />
</itemWebApiRead>
</pipelines>
</sitecore>
</configuration>
This works but I think it might be easier just to overwrite GetResult inside the itemWebApiRead pipeline instead of going through the hassle of changing the dynamics.
|
Sitecore 8.2 How to sort items based on a specific parameter within a content item
So I have a list of items (e.g. FAQs). and I am calling them through the WEB Api. I want to be able to do a get from Sitecore and be able to sort based on the date created and sort it either ascending or descending. Is there a work-around, or there is something OOB?
| |
Starting with version 8.1 Sitecore.Form.Core.Submit.ISaveAction interface has been moved to Sitecore.WFFM.Abstractions.Actions.ISaveAction
Please verify your code if your classes inherits from Sitecore.Form.Core.Submit.ISaveAction
You need to change your submit button to use new action. Please check here how to create a new save action:
https://doc.sitecore.net/web_forms_for_marketers/working_with_actions_and_validations/save_actions/create_a_new_save_action
|
Could not load type 'Sitecore.Form.Submit.ISaveAction' from assembly 'Sitecore.Forms.Core, Version=8.2.0.0, Culture=neutral, PublicKeyToken=null'
I have Sitecore 8.2(update 1) site with WFFM 8.2. When i navigate to the Sample form folder sitecore/System/Modules/Web Forms for Marketers/Sample form and click on any form then i got error in popup:
Could not load type 'Sitecore.Form.Submit.ISaveAction' from assembly
'Sitecore.Forms.Core, Version=8.2.0.0, Culture=neutral,
PublicKeyToken=null'.
I have all latest dll and config files of WFFM 8.2 and this error i have faced after upgrading my Sitecore from 8.1 to 8.2.
| |
So a few things going on. First, and probably most importantly, your version of Sitecore will not be fully functional on most modern browsers. Specifically if you're using Chrome.
For reference information, see: Sitecore does not work in Chrome 37 and later
Now, unless you have developer access to your solution (doesn't sound to me like you have), you will not be able to implement any of the proposed solutions offered in this article. You would need to request this from whoever maintains your solution. Switching to Internet Explorer might solve some of it for you, I'm not sure.
Don't worry too much about finding an "upload" folder - the CMS should be configured for you. Usually you will find some sort of folder structure under "Media Library" and, as appropriate, you will upload your images to there. Upload fails for you - most likely - because of the above limitations of Chrome.
|
Can't upload files through Sitecore CMS
I'm a newbie at Sitecore and recently took over the position where I have to make some changes in Sitecore website such as updating texts and uploading attachment. I tried to look at existing products and follow folder path to upload new attachment files but I can't do it because
I can't find one folder in path for ex)
\examplefolder\upload\anotherexmaple is where other files are located at but I can't find that upload folder
When I tried to make new folder and upload files and use it instead, nothing happens when I click on Upload button in media library
When I hover over the upload button,
long string shows at the bottom of browser ends with
database=master#readonly=0&db=master#
Does this mean I don't have access to do this?
Sitecore version is 6.4.1
| |
Do you run Visual Studio in Admin mode? Recently I had the same issue and it was related to some URL Rewrite redirects which made TDS unable to complete its tests. You could use Fiddler to check that. You should see something like this:
|
TDS failing with "Sitecore Deploy Path & Sitecore Web point to the same location"
I have setup an application in my local where I am trying to Sync with TDS. I am facing the following issue as shown in the screen shot.
I have provided the Sitecore Deploy Path & Sitecore Web URL Path which should match my locally hosted IIS site.
| |
You need to change bellow setting from ashx to empty string.
<setting name="Media.RequestExtension" value="ashx" />
will be
<setting name="Media.RequestExtension" value="" />
|
Sitecore pdf file enable .pdf extension
For some reason the PDF files (that are uploaded on media library) are shown as *.ashx when referencing from RTE etc.
Is there a way to show *.pdf instead so that it's user/seo friendly?
Thanks.
| |
$name is a token (value set on Standard Values item) which is replaced by new item new when new item is created.
If if wasn't there before and for some reason now it's there in dropdowns, most probably someone in your team set this token for the field used in dropdown on Standard Values but for the items which are already there, token is not replaced and it won't be replaced automatically.
And here is a blog from John West explaining how to expand Standard Values tokens in existing items https://community.sitecore.net/technical_blogs/b/sitecorejohn_blog/posts/expand-standard-values-tokens-in-existing-items-with-the-sitecore-asp-net-cms
|
"$name" showing up in website content
We have a website that uses a lot of search indexes, and today some of the dropdowns are displaying "$name" as the first item in the dropdown list. I've done some googling and some say it is due to indexes needing to be rebuilt. I've rebuilt all of them but the issue is still happening.
Is there anything else that could be causing this?
Thanks so much in advance!
| |
Yes you can. It will take a little code and a pipeline change, but you can find the code for mvc here and webforms here.
What you want to do it count the number of times a rendering has been put on the page and stop it if it passes your max number.
public class PerformRendering : Sitecore.Mvc.Pipelines.Response.RenderPlaceholder.PerformRendering
{
protected override IEnumerable<Rendering> GetRenderings(string placeholderName, RenderPlaceholderArgs args)
{
// get all renderings
var renderings = base.GetRenderings(placeholderName, args);
// return all renderings in Experience Editor
if (Sitecore.Context.PageMode.IsExperienceEditor) return renderings;
// get the maximum number of components
var maxComponents = this.GetMaxComponents(args);
// return only first n components
return maxComponents > 0 ? renderings.Take(maxComponents) : renderings;
}
private int GetMaxComponents(RenderPlaceholderArgs args)
{
var maxComponents = 0;
if (args.CustomData.ContainsKey("maxComponents"))
{
int.TryParse(args.CustomData["maxComponents"].ToString(), out maxComponents);
}
return maxComponents;
}
}
The config change
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<mvc.renderPlaceholder>
<processor patch:instead="*[@type='Sitecore.Mvc.Pipelines.Response.RenderPlaceholder.PerformRendering, Sitecore.Mvc']"
type="Website.Pipelines.RenderPlaceholder.PerformRendering, Website" />
</mvc.renderPlaceholder>
</pipelines>
<sitecore>
</configuration>
|
Is it possible to limit Renderings so they can only be placed once on a page?
I'm using Sitecore 8.1 rev. 151207 - And I have that rendering which only should be placed once on a page.
Is it possible to limit that in terms of letting the user not add another one of the same rendering again.
The only way I can think of would lead to possible wasted Renderings and items which are put on the page but are not shown and I think thats not best practice.
I already searched for solutions but nothing showed up so far
| |
What we know (or assume to know) to be true
Sitecore runs fine
Fails when trying to install an update package
Fails because it's trying to write to a drive/path that does not exist
Only happens in production. Other environments are fine.
Referenced drive/path (E:) is not to be found in any configuration files
What we also know
Update packages are really .zip archives
Zip archives/packages are decompressed into the system TEMP folder (reference: Cassidy, December 2008. Sitecore Packager throwing System.IO.IOException: The file exists.)
Hypothesis
Something is wrong with yout %TEMP% or %TMP% environment settings. They either point to lala land or... :
Either your AppPool Identity user does not have full access to said folder (which could be the case with overzealous security hardening only done on production, not other environments).
Or you are running Network Service as AppPool Identity and THAT doesn't have required permissions on the folder
Proposed Solution
Depends a bit on what the problem is. Check the environment settings for %TEMP% and %TMP%. A quick way to test, would be to set the AppPool Identity to Local User and provide admin credentials to it. DO NOT LEAVE IT LIKE THIS however, only use it to see if it's a permissions issue or if the %TEMP% setting is outright wrong.
If the site starts working after you've set Local User, it's a permissions issue. Find out where %TEMP% points, and grant your AppPool Identity user full control on the folder.
If it still doesn't work, figure out what the %TEMP%/%TMP% variables are set to, and fix them.
A few references:
https://stackoverflow.com/questions/542312/asp-net-access-to-the-temp-directory-is-denied
https://social.msdn.microsoft.com/Forums/en-US/c43238f8-a2ef-4503-aec6-fbf46870d8a4/access-to-the-temp-directory-is-denied?forum=tfswebaccess
|
Dictionary access denied
hey folks I'm running an upgrade package on sitecore 8.0 (from update 3 to 7) and I noticed it started taking a long time to process. I verified the logs and ran into hundreds of these error messages:
Access to the path E:\dictionary.dat is denied.
Funny thing is that there is no E drive on this server. As far as I know the dictionary.dat should be on the temp folder but Sitecore seems to be looking at the E drive. anyone ever seen this?
UPDATE 1:
By the way this is the same package I have used to UPGRADE a DEV and a QA environment but this is happening only on PROD
UPDATE 2:
I have tried all sugestion and none addressed the issue. I did notice one thing. Every time I restart IIS the error will jump from one drive to the next letter. It started with E drive. Then F. I restarted IIS and now it's looking on G drive.
Even if I hard code the path of the temp folder to the temp folder of the website folder as in D:\thewholepath\Website\temp
Maybe it's worth mentioning that I got a copy of the existing website and data folders, restored a backup of the databases from a running environment and created a new IIS site and pointed to it. Sitecore loads fine. No errors on logs. These errors do happen when I try to run the upgrade package.
Any other thoughts?
Running out of ideas here
| |
While doing an install and a reporting database rebuild on a local development environment, I started receiving the exact same error messages on pretty much any SSC web API call. I evaluated all of the links provided in comments, and the one answer that seemed to help me exactly was the forcible removal and clearing of all cookies for the development domain that I was working on.
The Chrome "Clear Cache and Hard Reset" did not do the trick.
Open up Chrome Tools, Go to Application, and right click on your local site, and press the clear button. Then refresh your browser.
|
Active Tests window receives __RequestVerificationToken error
In a development environment, when I attempt to open the Active Tests window from the Optimizaton tab of the Experience Editor, the window does not finish loading. I opened Chrome Developer Tools, and see that the following request:
http://mySite/sitecore/shell/api/ct/Tests/GetActiveTests?page=1&pageSize=75&_=1486004964281
receives an error:
"{"Message":"An error has occurred.","ExceptionMessage":"The required anti-forgery cookie \"__RequestVerificationToken\" is not present.","ExceptionType":"System.Web.Mvc.HttpAntiForgeryException","StackTrace":" at System.Web.Helpers.AntiXsrf.TokenValidator.ValidateTokens(HttpContextBase httpContext, IIdentity identity, AntiForgeryToken sessionToken, AntiForgeryToken fieldToken)\r\n at System.Web.Helpers.AntiXsrf.AntiForgeryWorker.Validate(HttpContextBase httpContext, String cookieToken, String formToken)\r\n at Sitecore.Web.Http.Filters.ValidateHttpAntiForgeryTokenAttribute.OnAuthorization(HttpActionContext actionContext)"}"
This is on Sitecore 8.1, update 3, with SXA 1.2.
| |
You can create custom profile properties for the profile in the core database. There you can even use Image field. From your code you can reach it and show on the page.
How to create custom property - Link
Go to core database and create your custom profile template like /sitecore/templates/System/Security/MyCustomProfile
Create your custom profile from this template here /sitecore/system/Settings/Security/Profiles
In User Manager you can change the user profile on the users
|
Add profile image for Sitecore user
Can we add profile images for the Sitecore user. When a user is created, I can only see the option to assign an icon from a preset list.
My project is a blogging site, where every blogger is a sitecore user. Their blog should show the user image and name.
Using Sitecore 8.0
| |
There can be different factors that causing this issue:
1. Version Compatibility
SPE version is not compatible with the Sitecore version.
Powershell version should be in sync across all the environment if development
code base is having powershell dll reference.
2. Package Installation
The package is not installing properly whereby some files are not getting installed accordingly.
I will tend to go for the 2nd point since the error shows that it cannot create an object from
Cognifide.PowerShell.SitecoreIntegrations.Applications.PowerShellConsole,Cognifide.PowerShell.
Seems like the assembly Cognifide.PowerShell is not properly installed. Try to make sure that the proper security permission (write/read) is set on the website folder including subfolders.
|
"Cognifide.PowerShell.SitecoreIntegrations.Applications.PowerShellConsole,Cognifide.PowerShell" not found Error while opening Sitecore PowerShell
When we try to open Sitecore Powershell console or ISE after fresh installation on one of the Sitecore instances, we receive below error :
Log Entry for this error is:
3572 06:48:51 WARN Could not find type in ReflectionUtil.CreateObject: Cognifide.PowerShell.SitecoreIntegrations.Applications.PowerShellConsole
3572 06:48:51 ERROR CodeBeside class "Cognifide.PowerShell.SitecoreIntegrations.Applications.PowerShellConsole,Cognifide.PowerShell" not found. (method: Sitecore.Web.UI.HtmlControls.CodeBeside.OnInit(EventArgs e)).
Sitecore version : 8.1 Update 1 & Powershell Version 3.3
| |
When you create a new tenant it is disabled by default.
You need to enable it. On the tenant item on Administration section you have a checkboxfield Enabled
Please see below image:
You can enabled or disabled a single pipeline batch.
On the pipeline batch processor item on Administration section you have a checkboxfield Enabled Please verify if is enabled, maybe someone else disabled it.
|
Run Pipeline Batch button disabled
I installed Data Exchange Framework, Sitecore Provider for Data Exchange Framework, and Dynamics CRM Provider for Data Exchange Framework (all 1.2.0 rev 161212) in my Sitecore instance. I have tested the connection and confirmed that a connection with Dynamics CRM is established.
And when I'll try to run a pipeline batch, the Run Pipeline Batch is grayed out (disabled) and can't be clicked for every pipeline batch.
This is strange because I had this working once in a different instance with same versions installed (I was able to sync Accounts aside from the default Contacts etc). But when I created another and another one, both buttons are disabled. I've followed the walkthrough but this is really bothering me for almost two days now. Thanks a lot for your help!
| |
The problem was with MVC setup in the project not with Glass. This was the solution - http://samirvaidya.blogspot.hu/2015/10/the-type-expression-is-defined-in.html.
The error was exactly
The type 'Expression<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
And non of the HtmlExtensions was not working.
Solution is that you need the following references in your web.config.
<compilation debug="true" targetFramework="4.5">
<assemblies>
<add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<add assembly="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<add assembly="Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
<add assembly="System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
|
Html.Glass helper not found after installing Glass Mapper v4
I've installed Glass.Mapper.Sc (v4.3.4.196) with out any problems but in a razor view i can't use helper @Html.Glass() because i have an error that says that HtmlHelper does not contain a definition for Glass and no extension method Glass... i'm missing something?
| |
You'll need to run your CM instance in Live Mode.
Running a site in Live Mode means that it reads items directly from the Master database. At the same time, your web connection string is preserved and you are still able to publish from Master to Web.
To enable the Live Mode, go to App_Config/Include and rename the file LiveMode.config.example to LiveMode.config.
Additionally, if you have other site definitions apart from website, you'll need to update them as well by modifying the LiveMode.config. For example, if you have a custom site definition named "mySite", your LiveMode.config might look like this:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<sites>
<site name="website">
<patch:attribute name="database">master</patch:attribute>
<patch:attribute name="filterItems">true</patch:attribute>
</site>
<site name="mySite">
<patch:attribute name="database">master</patch:attribute>
<patch:attribute name="filterItems">true</patch:attribute>
</site>
</sites>
</sitecore>
</configuration>
|
How do I show non-published items on the Content Management server when not logged in?
I have a content delivery server and a content management server. On the content management server I want visitors to be able to see non-published items when they are not logged into Sitecore.
If I change the connection string for Web to Master I can see the non-published items obviously, but then I cannot publish as it tries to publish from Master to Master.
| |
Channel settings are located in the following configuration file:
Include/Channel/Sitecore.Analytics.Channel.config
The determineInteractionChannel pipeline is used to set the channel of the current interaction.
You will need to add a custom processor to this pipeline; it needs to inherit from DetermineChannelProcessorBase. You can find this class in the Sitecore.Analytics.OmniChannel.dll assembly.
public class InternalTrafficChannel : DetermineChannelProcessorBase
{
private readonly string channelId;
public InternalTrafficChannel(string channelId)
{
this.channelId = channelId;
}
public override void Process(DetermineChannelProcessorArgs args)
{
if(this.IsInternalTraffic())
{
args.ChannelId = new ID(this.channelId);
}
}
private bool IsInternalTraffic()
{
// return true if the traffic is internal
}
}
Create a configuration patch (e.g. under App_Config\Include\zzz) to configure your custom processor:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<determineInteractionChannel>
<processor type="Some.Namespace.InternalTrafficChannel, Some.Assembly">
<param desc="channelId">{channel-definition-item-guid}</param>
</processor>
</determineInteractionChannel>
</pipelines>
</sitecore>
</configuration>
|
Attribute internal traffic to a custom channel
I have a question regarding a requirement for a client of ours. The client has a number of offices around the world. Traffic coming from these offices (specific IP addresses/ranges) should not be excluded from analytics (so no easy ExcludeRobots configuration).
However, in the Experience Analytics reporting, internal traffic coming from these offices should be excluded by default. A specific (custom?) report needs to be available to view analytics details for all internal traffic.
I'm thinking of creating a specific "Channel type" "Internal traffic" for this, with the different offices around the world as "Channels" below the "Channel Type". Did anyone ever implement something like this? Any other (better) ideas to meet the requirements mentioned above?
What would the technical implementation look like? Probably some pipelines that need to be customized? Can someone elaborate on this?
On the reporting side:
How can I filter out all visits from a "Channel type" or specific "Channel" for all default reports in Experience Analytics?
How can I create a custom report that only shows the visits from the newly created Channel type "Internal traffic" and underlying offices (as channels)? Is creating such a custom report straightforward?
Any other things I need to do (for example related to excluding internal traffic from the Path Analyzer)?
Thanks in advance!
Gert.
| |
After switching to MongoDB, Sitecore introduced an option to use an SQL storage again only in 8.1. So I don't believe staying at 8.0 is an option in your situation.
If your decide to upgrade to 8.1, check out this tutorial on configuring the SQL storage for forms:
https://doc.sitecore.net/web_forms_for_marketers/81/setting_up_web_forms/installing/use_a_custom_sql_provider_to_store_form_data
See the configuration file Include/Sitecore.WFFM.Dependencies.config for available forms storage providers.
|
WFFM 8.0 Update 1 with Analytics Disabled (no MongoDB) Issue
I have Web Forms for Marketers 8.0 Update-1 installed on Sitecore Experience Platform 8.0 Update-1 website which has analytics disabled and there is no MongoDB installed.
When submitting any form I got the following error:
4972 2017:02:02 03:27:53 WARN Value cannot be null.
Parameter name: owner
Exception: System.ArgumentNullException
Message: Value cannot be null.
Parameter name: owner
Source: Sitecore.Kernel
at Sitecore.Diagnostics.Assert.ArgumentNotNull(Object argument, String argumentName)
at Sitecore.Diagnostics.Log.Warn(String message, Object owner)
at Sitecore.WFFM.Core.Extensions.Warn.IsNull(Object obj, String name)
at Sitecore.WFFM.Analytics.AnalyticsTracker.get_SessionId()
at Sitecore.Form.Core.FormDataHandler.ExecuteSaveActions(ID formId, ControlResult[] fields, ActionDefinition[] actions)
at Sitecore.Form.Core.FormDataHandler.ProcessData(ID formID, ControlResult[] fields, ActionDefinition[] actions, CallContext context)
The submitted form data will be saved into MongoDB by default, Is there any way I can use to save to SQL instead, I tried the following marketplace module which also needs the analytics to be enabled?!
https://marketplace.sitecore.net/Modules/W/WEB_FORMS_FOR_MARKETERS_8X_SQL_PROVIDER.aspx
| |
I believe your code is doing exactly what you instruct it to; updating the field information in master. This will not trigger a re-publish on its own.
And while we could find a way to make it work like you expect; I'd say there is an easier way. Hook into item:saved instead. This triggers every time you update the item and every time the updated item is published. It is saved to "web".
In it's simplest form, it could look like this:
Simple Form
public void OnItemSaved(object sender, EventArgs args)
{
Sitecore.Events.SitecoreEventArgs eventArgs = args as Sitecore.Events.SitecoreEventArgs;
Sitecore.Diagnostics.Assert.IsNotNull(eventArgs, "eventArgs");
Sitecore.Data.Items.Item item = eventArgs.Parameters[0] as Sitecore.Data.Items.Item;
Sitecore.Diagnostics.Assert.IsNotNull(item, "item");
item.Editing.BeginEdit();
// do your lat/long thing.
item.Editing.EndEdit();
}
And a handler looking something like:
<event name="item:saved">
<handler type="yourclass, yourassembly" method="OnItemSaved">
<clientKeyField>Client Key</clientKeyField>
<address1FieldName>Address Line 1</address1FieldName>
<latitudeField>Latitude</latitudeField>
<longitudeField>Longitude</longitudeField>
</handler>
<event>
Limiting it to specific template
Optionally you need to restrict this code by Template ID or whatever is appropriate for your scenario. Inject it via configuration.
public string TemplateId { get; set; }
And...
<templateid>{your-template-id}</templateid>
Reference: Repost: Intercepting Item Updates with Sitecore
|
Fields Modified Via the itemProcessed Pipeline Showing in Master but not Web Database
I have the following transform for my local site that injects a function call into the publish:itemProcessed event:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<sitecore>
<events timingLevel="custom" xdt:Transform="Insert">
<event name="publish:itemProcessed">
<handler type="Website.PublicSite.Web.PublishItemProcessed.PushContentForPublication, Website.PublicSite.Web" method="OnItemProcessed">
<database>master</database>
<uniqueIdField>Unique Id</uniqueIdField>
<clientKeyField>Client Key</clientKeyField>
<address1FieldName>Address Line 1</address1FieldName>
<latitudeField>Latitude</latitudeField>
<longitudeField>Longitude</longitudeField>
</handler>
</event>
</events>
</sitecore>
</configuration>
The following method is being called that populates the latitude and longitude values of the item using the item's address field and Google Location Services (this is the call to _service.GetCoordinates(publishedItem)):
public void OnItemProcessed(object sender, EventArgs args) {
ItemProcessedEventArgs itemProcessedEventArgs = args as ItemProcessedEventArgs;
PublishItemContext context = itemProcessedEventArgs?.Context;
if (context?.VersionToPublish == null) {
return;
}
Item publishedItem = context.VersionToPublish;
if (!CheckIfRunnable(publishedItem)) {
return;
}
if (publishedItem[LatitudeField].Length == 0 || publishedItem[LongitudeField].Length == 0)
{
Tuple<string, string> latLong = _service.GetCoordinates(publishedItem);
var latPos = latLong.Item1;
var longPos = latLong.Item2;
if (latPos == null || longPos == null)
{
throw new Exception("Error adding record to coordinates to store item. Location not found by Google Location API.");
}
//This will re-fire the saving pipeline
publishedItem.Editing.BeginEdit();
publishedItem[LatitudeField] = latPos;
publishedItem[LongitudeField] = longPos;
publishedItem.Editing.EndEdit();
}
}
The code is working as expected for the most part. The item is updated with the proper lat/long coordinates and is published to Web. However, only the item it the Master database has its latitude and longitude coordinates updated. For the Web database item, both of these fields are blank. My understanding is when I edit the publish item it should refire the publishing pipelines and an updated version of the item should be published to Web but that appears not to be the case. Anyone know how I can get both the Master and the Web database items to show the updated fields? Thanks for the help!
| |
It should be possible, but probably not that simple - at least not if you want to use a different analyzer at search time.
Please note that I haven't tested any of the stuff below.
Changing the analyzer (both indexin and searching)
You should be able to change the analyzer of the _content field like this:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<contentSearch>
<indexConfigurations>
<defaultLuceneIndexConfiguration>
<fieldMap type="Sitecore.ContentSearch.FieldMap, Sitecore.ContentSearch">
<fieldNames hint="raw:AddFieldByFieldName">
<field fieldName="_content" storageType="NO" indexType="TOKENIZED" vectorType="NO" boost="1f" type="System.String" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider">
<analyzer type="Sitecore.ContentSearch.LuceneProvider.Analyzers.StandardAnalyzerWithStemming, Sitecore.ContentSearch.LuceneProvider">
<param hint="version">Lucene_30</param>
</analyzer>
</field>
</fieldNames>
</fieldMap>
</defaultLuceneIndexConfiguration>
</indexConfigurations>
</contentSearch>
</sitecore>
</configuration>
This should then use the specified analyzer for both indexing and searching this field.
Copying the _content field with different analyzer
The _content field is a special field added by Sitecore at index time.
If you want to index _content more than once, using different analyzers, I think you would need
to extend Sitecore.ContentSearch.LuceneProvider.LuceneDocumentBuilder and override the method void AddField(IIndexableDataField field).
object obj = fieldConfiguration1.FormatForWriting(fieldValue);
float boost = BoostingManager.ResolveFieldBoosting(field);
if (IndexOperationsHelper.IsTextField(field))
{
LuceneSearchFieldConfiguration fieldConfiguration2 = this.Index.Configuration.FieldMap.GetFieldConfiguration("_content") as LuceneSearchFieldConfiguration;
this.AddField("_content", obj, fieldConfiguration2 ?? this.defaultTextField, 0.0f);
}
this.AddField(name, obj, fieldSettings, boost);
In that method you could then add your own _content_ngram or something like that and control the used analyzer in the field configuration as shown above.
Using another analyzer at search time
If you want to use another analyzer at search time than the one specified on the field configuration, then you could probably
utilize execution contexts by implementing Sitecore.ContentSearch.Linq.Common.IExecutionContext. The implementations themselves do not need any logic.
public class NGramExecutionContext : IExecutionContext
{
}
You would then need to create a custom analyzer which uses a specific analyzer depending on the field name.
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<contentSearch>
<indexConfigurations>
<defaultLuceneIndexConfiguration>
<analyzer type="Sitecore.ContentSearch.LuceneProvider.Analyzers.PerExecutionContextAnalyzer, Sitecore.ContentSearch.LuceneProvider">
<param desc="map" type="System.Collections.Generic.List`1[[Sitecore.ContentSearch.LuceneProvider.Analyzers.PerExecutionContextAnalyzerMapEntry, Sitecore.ContentSearch.LuceneProvider]]">
<map hint="list:Add">
<mapEntry type="Sitecore.ContentSearch.LuceneProvider.Analyzers.PerExecutionContextAnalyzerMapEntry, Sitecore.ContentSearch.LuceneProvider">
<!-- Your custom execution context -->
<param hint="executionContext" type="YourNamespace.NGramExecutionContext, YourAssembly">
<!-- Any parameters for your execution context constructor -->
</param>
<!-- Your custom analyzer -->
<param desc="analyzer" type="YourNamespace.CustomAnalyzer, YourAssembly">
<!-- Any paramters for your custom analyzer constructor -->
</param>
</mapEntry>
</map>
</param>
</analyzer>
</defaultLuceneIndexConfiguration>
</indexConfigurations>
</contentSearch>
</sitecore>
</configuration>
How to implement the custom analyzer I'll leave up to you. You could take a look at how Sitecore.ContentSearch.LuceneProvider.Analyzers.DefaultPerFieldAnalyzer works to get some inspiration.
|
Using alternate ContentSearch analyzers
I am looking into using some of the alternate analyzers provided in the Sitecore.ContentSearch.LuceneProvider.Analyzers namespace.
Specifically what I would like to achieve is to:
Create copies of the _content field and apply different analyzer to them (one stemmed and another ngrammed).
Be able to control the analyzer that is used at query time so that I can search with either a stemmer or an ngram analyzer.
So, using Sitecore.ContentSearch.LuceneProvider.Analyzers.StandardAnalyzerWithStemming and Sitecore.ContentSearch.LuceneProvider.Analyzers.NGramAnalyzer are of interest.
However, trying to get them implemented in the config files is another thing. I am experiencing crashes with no log/stack trace any time of indexing and can't seem to be able to get specific fields included in the index but only analyzed by the LowerCaseKeywordAnalyzer (ex. things like GUIDs which a stemmer wreaks havoc on).
I have (I think) scoured the web and have a few bits and pieces of information but nothing concrete for these analyzers. Aside from personal experience, if anyone knows of some good Sitecore documentation on the analyzers or on index configuration files, anything would be helpful. Thanks.
| |
You can get the Sitecore Compatibility Table here: https://kb.sitecore.net/articles/087164
And to answer your query, Sitecore 8.0 + supports windows 10
|
What version of Sitecore starts the support of Windows 10?
We are going to upgrade Sitecore platform to Sitecore 8.0, i have a doubt about Sitecore version compatibility.
What version of Sitecore starts the support of Windows 10? What version will likely work, but not officially supported?
| |
If you want to get string value instead of int value you need to update your reader with:
string statusCodeStr = entity.FormattedValues[this.AttributeName];
Here is debug result:
According to DateTime mapping.
Adam Conn has already answered. The solution is to use ISO Date Value Reader for the transformer.
POCO DateTime not mapping correctly in Data Exchange Framework
|
Dynamics CRM Connect - Map OptionSet and DateTime CRM fields to Sitecore
I am mapping Status Reason from CRM which is an Option Set to a Single Line of Text field on Sitecore. I have checked the Use Value Property
but it returned the integer value of the option set.
I have seen http://integrationsdn.sitecore.net/DynamicsCrmConnect/v1.2/cookbooks/synchronization/option-set-values/index.html for mapping option set values but it works the other way around, i.e., Sitecore to CRM. I tried creating a Read Version of the code as follows:
using Microsoft.Xrm.Sdk;
using Sitecore.DataExchange.DataAccess;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace DynamicsCrm
{
public class EntityAttributeOptionSetValueReader : IValueReader
{
public EntityAttributeOptionSetValueReader(string attributeName)
{
this.AttributeName = attributeName;
}
public string AttributeName { get; private set; }
public CanReadResult CanRead(object source, DataAccessContext context)
{
var canRead = false;
var isGuess = false;
if (source != null)
{
if (source is Entity)
{
canRead = true;
isGuess = true;
}
}
return new CanReadResult { CanReadValue = canRead, IsGuess = isGuess };
}
public ReadResult Read(object source, DataAccessContext context)
{
var entity = source as Entity;
if (entity != null)
{
if (entity.Attributes.ContainsKey(this.AttributeName))
{
if (entity.Attributes[this.AttributeName] is OptionSetValue)
{
//var value2 = entity.Attributes[this.AttributeName] as OptionSetValue;
int value = (entity.Attributes[this.AttributeName] as OptionSetValue).Value;
//value2.Value = (int)value;
//return new ReadResult { ReadValue = 2 };
// Get the raw option set value and return the label
}
}
else
{
entity.Attributes[this.AttributeName] = new OptionSetValue((int)value);
//return true;
}
}
//return false;
}
}
}
However, I'm stuck with the Read method because I don't know what specifically is ReadValue since it's an object. I'm unfamiliar with this and cannot find examples in the documentation and I would really appreciate your guidance. As for DateTime, it doesn't map the correct value too and return the following:
There are no problems with strings and single line of texts. Thank you very much for your help!
EDIT:
Thanks to Vlad, here is my code I've patterned from http://integrationsdn.sitecore.net/DynamicsCrmConnect/v1.2/cookbooks/synchronization/option-set-values/add-value-writer.html
EntityAttributeValueAccessorConverterEx.cs
using System.Text;
using System.Threading.Tasks;
using Sitecore.DataExchange.Repositories;
using Sitecore.DataExchange.DataAccess;
using Sitecore.Services.Core.Model;
using Sitecore.DataExchange.Providers.DynamicsCrm.Converters.DataAccess.ValueAccessors;
using Sitecore.DataExchange.Providers.DynamicsCrm.Models.ItemModels.DataAccess;
using DynamicsCrm;
namespace DynamicsCrm
{
public class EntityAttributeValueAccessorConverterEx : EntityAttributeValueAccessorConverter
{
public EntityAttributeValueAccessorConverterEx(IItemModelRepository repository) : base(repository)
{
}
public override IValueAccessor Convert(ItemModel source)
{
var accessor = base.Convert(source);
if (accessor != null && accessor.ValueReader == null)
{
var useValueProperty = base.GetBoolValue(source, EntityAttributeValueAccessorItemModel.UseValueProperty);
if (useValueProperty)
{
string attributeName = base.GetStringValue(source, EntityAttributeValueAccessorItemModel.AttributeName);
accessor.ValueReader = new EntityAttributeOptionSetValueReader(attributeName);
}
}
return accessor;
}
}
}
EntityAttributeOptionSetValueReader.cs
using Microsoft.Xrm.Sdk;
using Sitecore.DataExchange.DataAccess;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace DynamicsCrm
{
public class EntityAttributeOptionSetValueReader : IValueReader
{
public EntityAttributeOptionSetValueReader(string attributeName)
{
this.AttributeName = attributeName;
}
public string AttributeName { get; private set; }
public CanReadResult CanRead(object source, DataAccessContext context)
{
var canRead = false;
var isGuess = false;
if (source != null)
{
if (source is Entity)
{
canRead = true;
isGuess = true;
}
}
return new CanReadResult { CanReadValue = canRead, IsGuess = isGuess };
}
public ReadResult Read(object source, DataAccessContext context)
{
var entity = source as Entity;
if (entity != null)
{
if (entity.Attributes.ContainsKey(this.AttributeName))
{
if (entity.Attributes[this.AttributeName] is OptionSetValue)
{
//var value2 = entity.Attributes[this.AttributeName] as OptionSetValue;
string statusCodeStr = entity.FormattedValues[this.AttributeName];
//value2.Value = (int)value;
return new ReadResult(DateTime.Now) { ReadValue = statusCodeStr, WasValueRead = true };
// Get the raw option set value and return the label
}
}
else
{
return new ReadResult(DateTime.Now) { ReadValue = String.Empty, WasValueRead = false };
//return true;
}
}
//return false;
return new ReadResult(DateTime.Now) { ReadValue = String.Empty, WasValueRead = false };
}
}
}
In the Converter Type in the template's standard value, I wrote DynamicsCrm.EntityAttributeValueAccessorConverterEx, DynamicsCrm. I tried debugging it (the DLL is in inetpub/wwwroot/sitecoreinstance/website/bin) but didn't hit the breakpoint. Does the code make sense or am I missing something? Thank you very much!
| |
First of all is not recommended to put content like Title in the rendering paramenters.
@inherits Glass.Mapper.Sc.Web.Mvc.GlassView<ConexioFC.Models.Separator>
var parameters = GetRenderingParameters<ConexioFC.Models.RenderingParameters.Separator>();}
and you can to access parameters using @parameters.PropertyName
More informations you can find here:
http://www.glass.lu/Mapper/Sc/Tutorials/Tutorial23
https://stackoverflow.com/questions/29714169/inherit-model-and-rendering-parameters-both-in-sitecore-mvc-view-using-glass-map
|
Map model class to render view parameters with Glass.View v4?
I have a project with Glass.Mapper v4 and i have a simple model class like this:
public class Separator
{
public virtual string Title { get; set; }
public virtual string CssColorClass { get; set; }
}
And a razor view like this:
@model ConexioFC.Models.Separator
This is the separator
<h2 class="@Model.CssColorClass">@Model.Title</h2>
From Sitecore i have this templates:
Then i have a View Rendering like this:
This view rendering has a parameters template pointing to the template previously shown.
Then i have on the control properties of the page:
The problem is that when i go to the page preview the Model.CssColorClass and Model.Title are blank.
| |
I was lucky enough to receive this award - here's why I think I got it.
I have presented at Sitecore user groups and a while ago now, admittedly, at Sitecore Symposium in Australia (they only had the one)
I am a co-organiser of the Sydney Sitecore User Group
I am very active on all the community channels: Slack; Sitecore Community site; Stack Exchange, etc
I wrote two whitepapers on transitioning on-prem solutions to the cloud that Sitecore published
I have architected, deployed, and continue to maintain some of the largest Sitecore Azure implementations in the country
Over the last few years I have actively promoted Sitecore on Azure
I have created several modules that facilitate the use of Sitecore on Azure
I am working with Sitecore's internal cloud teams on features and strategies that will help develop the product with "field use" experience
I should mention that I have also held a Technical MVP award for 5 years, and transitioned this year.
FWIW, I have a number of blog articles that are in various stages of completion that I never seem to get around to publishing :( but there will be a bunch through as soon as I find a couple hours one day. Everything from setting up Ubuntu for MongoDB and Solr, to Azure ARM template best practices, to Git multi-tenant branching strategies.
|
What is Sitecore MVP Cloud category?
I noticed this year Sitecore MVP has a new category called Cloud. What is it for? and which areas you can work or contribute to become one of the MVP under Cloud category?
| |
The DropList field only stores the name of the item selected.
To accomplish what you are trying to do, you need to use a Droplink field instead.
The Droplink field will store the ID of the selected item. From there, you can use the ID to find the selected item in Sitecore and convert it to a strongly-typed class that has the ClassName property that you are ultimately trying to retrieve.
Having said all of this above, looks like you're using GlassMapper. If that's the case, it's even easier for you. The type for your property that will map to the Droplink field should be the class that represents the item that will be selected in the Droplink field. GlassMapper will automatically find the item in Sitecore by ID and cast it to the strongly-typed class for you. If no item is selected in the field in Sitecore, GlassMapper will simply set the property to null.
Here's some sample code based on GlassMapper.
Let's say this is the class that represents the type of items that will be selected in the Droplink (I just made up a template ID):
[SitecoreType(TemplateId = "{12121212-1212-1212-1212-121212121212}", AutoMap = true)]
public class CssColor
{
public virtual Guid ID { get; set; }
public virtual string Color { get; set; }
}
Here's how you would update your Separator class:
[SitecoreType(TemplateId = "{51D5974A-7ABE-40C3-9EED-E32267C03112}", AutoMap = true)]
public class Separator
{
public virtual Guid ID { get; set; }
public virtual string Title { get; set; }
public virtual CssColor CssColorClass { get; set; }
}
|
How to map a datasource in DropList to a specific parameter on selection?
I have a model that contains a parameter called CssClassName like this:
[SitecoreType(TemplateId = "{51D5974A-7ABE-40C3-9EED-E32267C03112}", AutoMap = true)]
public class Separator
{
public virtual Guid ID { get; set; }
public virtual string Title { get; set; }
public virtual string CssColorClass { get; set; }
}
Now, from Sitecore side, this CssColorClass parameter is a DropList that points to a datasource where the template contains two parameters ClassName and Description. How can i tell the CssColorClass to "grab" the ClassName parameter and not the Item name of the items on the datasource?
On my razor view i have this:
@inherits Glass.Mapper.Sc.Web.Mvc.GlassView<MyModels.Models.Separator>
@using MyModels.Models
@using System.Web.Optimization
@{
Separator separatorModel = GetRenderingParameters<Separator>();
}
@Styles.Render("~/bundles/separator-css")
<h2 id="@separatorModel.ID" class="separator @separatorModel.CssColorClass">@separatorModel.Title</h2>
| |
If you consider the basics of the Helix principles that features should not be aware of the project layer, you could decide that the "Header" feature you are developing should have 2 sets of contoller-model-view. In my opinion, a feature can have multiple implementations of something that might seem similar. If in your case the header is so different between site A and site B that you cannot fix it in the project layer (as it seems), you actually have 2 cases. You could even decide to create 2 features for it, but that would seem real overkill. So I would create one feature and have 2 possible header implementation in that.
As a comparison, just consider an event feature. You might re-use that event feature over multiple sites. But what if one site want to display the events in a calendar view and the other one just as a flat list? I assume in that case you would also just have a calender view and a list view in your event feature. Just as you would do if those views were wanted in 1 site. The feature doesn't care where you use it. For events this might seem obvious, so I don't see why that would be different for a header.
To resume: I would create 1 feature with 2 options for your header.
|
How should I split features in Helix based solutions?
I just came to that problem that, in a multisite solution we need to deliver the same feauture but with different Controller and View.
As we are implementing features indepently for Projects how should I split the Features independently?
For example
I have a Header for both sites but I need different data template, Model, View, Controller for site A and site B.
Use Areas for that inside the Features or create a new layer between Features and Projects or any other suggestions? I think it is a common problem with multisite solutions based on Helix.
| |
As we don't (yet) know which example you have in mind, I'll give my general opinion: although it is best practice to use datasources, it might not be best practice to use them for everything. Your content editors could go completely crazy if they need to quickly publish a news article and they need to create 5 datasources and a content item to achieve that (Sitecore will seem overwhelming to lots of people if you do that). Best practice is actually to think about your content architecture and create something that enables your content editors to work fluently and give them and the marketers the ability to do their (marketing) job - meaning let them personalize, test, etc.. renderings where needed.
Even in SXA not all components use a datasource. The title of the page is picked from the item itself. This does not mean you need to do that always, but in many cases it might be a good idea. Talk to the customer, the editors and the marketers that will administer the site and decide based on that information how the content should be structured (so they can do their job and the site is still performing well) and how and where to use renderings with datasources.
ps: sometimes it can also be a good idea to let an editor assign a datasource optionally (take the current item if no datasource was set).
|
Why Sitecore habitat is not following best practice to use datasource everywhere
Sitecore best practice says to use datasource but habitat doesn't seem to follow this. At many places in habitat, content is in the item, instead of linked through datasource. Can someone explain me if there are any reasons behind this or best practise for this has not not been followed in habitat. Thanks
| |
What you actually need to do are two things:
Create the datasource item
Prevent the dialog from appearing
Creating the datasource is done in the getRenderingDatasource pipeline. Add a processor before the CheckDialogState. In that processor you can put some logic to determine that you actually want to create an item. Once you determined you want to create an item, do so using the Sitecore api (you might need a security disabler and a site switcher). Add the parent to the args.DatasourceRoots. Once the item is created, you have to set it's path in the arguments: args.CurrentDatasource = datasourceItem.Paths.FullPath; (args being the GetRenderingDatasourceArgs).
If you would stop here, the datasource is created and would be shown in the dialog as a prefilled value. It is not filled in
The dialog is a tricky one. Like mentioned in the comments I wrote a blog post on it. What you need to do is override (copy) the command AddRendering (Sitecore.Shell.Applications.WebEdit.Commands.AddRendering). In the run method, before the code where the dialog is opened (ShowModalDialog), you need to adapt the code (if-statement to determine whether to show the dialog or not) and send a WebEditResponse:
WebEditResponse.Eval(FormattableString.Invariant(
$"Sitecore.PageModes.ChromeManager.handleMessage('chrome:placeholder:controladded',
{{ id: '{itemNotNull.ID.Guid.ToString("N").ToUpperInvariant()}',
openProperties: {flag.ToString().ToLowerInvariant()},
dataSource: '{datasourceItem.ID.Guid.ToString("B").ToUpperInvariant()}' }});"));
This way the dialog won't open and the Sitecore editor is still notified that a rendering was added (with the datasource). Without that notification, the rendering will not be added.
ps: it is probably also possible to include the item creation in the addrendering command - didn't test that
Update: links to github repo and marketplace module containing this:
https://github.com/Gatogordo/LocalDatasources
https://marketplace.sitecore.net/en/Modules/L/Local_Datasources.aspx
|
How to create component data sources automatically?
When a component is added to the page in the Experience Editor, its data source field is empty. The content editor then needs to manually create or select a data source in the "Select the Associated Content" dialog.
To simplify this process, Sitecore allows to show the dialog automatically when a component is added to the page.
I want to take this one step further.
In our solution, data sources are normally stored under every page item. It would be convenient for our content editors if a data source was created automatically for every new component, without even showing the "Select the Associated Content" dialog.
How can this be achieved?
| |
Out of the box, you cannot prevent this. It's just the way the RTE works in Sitecore.
Fortunately you can work around this issue, but it's a fairly involved process. It involves:
Parsing the RTE html for <img> elements with a style attribute, then removing width and height
Optionally hooking into the Sitecore renderField pipeline and run the above mentioned parser on fields of type rich text
Optionally hooking into the <saveRichTextContent> pipeline and run the above mentioned parser. I prefer this option.
Patching in your new modifications.
Eric Stafford has a complete writeup of this process on: Handling Images on a Responsive Sitecore Implementation
|
Prevent Width\Height styles when resizing image in RTE
When inserting Images into RTE content, images are rendered as this:
<img src="-/media/AS15F536E453B97C2GJI6901F55GG.ashx?h=857&amp;w=1523" height="857" width="1523" />
This works fine with responsive design. However, if I resize the image inside the RTE the image tags gets rendered as this:
<img style="height: 857px; width: 1523px;" src="-/media/AS15F536E453B97C2GJI6901F55GG.ashx?h=857&amp;w=1523" height="857" width="1523" />
(adding the style="width...;height...")
This prevents the images from working properly in responsive cases.
If I remove the styles manually, everything remains fine.
So how can I prevent the RTE from adding these styles?
Sitecore 8.1
| |
Sitecore will capture information about the request in the analytics, but if you are just sending the data to the 3rd party analytics API you can probably just use the Request.Browser object that is just part of the MVC Controller request.
You could use the following properties
public ActionResult MyRendering()
{
var os = Request.Browser.Platform;
var browserVersion = Request.Browser.Version;
// Parse the UserAgent yourself or use a 3rd party to parse:
var userAgent = Request.UserAgent;
}
If you don't get enough information from the properties, you could parse the UserAgent - use a service to give you consistent results. Something like: https://developers.whatismybrowser.com/
|
Sitecore API to get Browser, Device and OS details
We have a requirement to pass browser, OS, Device details to third party analytics (yes they don't capture by default).
Does sitecore provides any API which we can use to capture these details? Any alternate approach is fine as well.
| |
Using the "Name/Expression scheme" I was able to retrieve the field just like in C#. This gets the correct field value.
Get-ChildItem -Path $root -Language * | Show-ListView -Property `
@{Label="Id"; Expression={$_.Fields["Id"].Value}}
|
Show-Listview shows Item Id instead of Field Id
We're using Sitecore PowerShell Extensions to generate some reports.
In one of our templates we have a field with the name Id.
This id field is not being listed correctly by PSE because it is conflicting with the Item Id from Sitecore. How would we get our own id field in PSE instead of the Sitecore ID?
This is the shortened code.
Get-ChildItem -Path $root -Language * | Show-ListView -Property Id,Description
| |
port 587 will only apply to the smtp.sitecore.sparkpostelite.com machine; https is port 443.
|
What is the IP range of Sitecore Email Cloud (port 587)
We are setting up a new production environment which utilizes the new Sitecore Email Cloud (Sparkpost and EXM 3.4). Our hosting vendor does not allow us to open for all traffic on port 587, so we need a hostname and/or an IP range to open. I have crawled the document but have only found this statement in doc.sitecore.net:
Make sure the firewall on your server does not block the following
URL's:
https://apps.sitecore.net
smtp.sitecore.sparkpostelite.com
https://sparkpost.cloud.sitecore.net
https://sitecore.sparkpostelite.com/
Open port 587 to support the
Transport Layer Security (TLS). TLS is required by Sitecore MTA to
send email messages.
From the above it seems that I need to open up for all traffic to port 587, not only for the specific 4 URLs.
| |
Since we are using multi-tenant solution, I'm able to achieve this by below code. i.e. verifying domain equals to "extranet" & hostname not equals to null/empty.
if (Sitecore.Context.PageMode.IsNormal
&& GetSites().Where(x =>x.Name.ToLower()
.Equals(Sitecore.Context.Site.Name.ToLower()))
{
//Do task here
}
private List<SiteInfo> GetSites()
{
List<SiteInfo> sitesInformation = Factory.GetSiteInfoList();
if (sitesInformation != null && sitesInformation.Count > 0)
{
return sitesInformation.Where(s => s.Domain != null
&& s.Domain == "extranet"
&& !string.IsNullOrEmpty(s.HostName)).ToList();
}
return null;
}
|
'httprequestbegin' pipeline in live web page
i want to process certain operation at 'httprequestbegin' pipeline in live web page (CM or CD) i.e.
notequals to PageEditor,
notequals to ExperienceEditor,
notequals to ContentEditor,
notequals to Preview
After some analysis & references from this link
Most reliable way to detect if running in live site?
My code snippet looks like
if (Sitecore.Context.PageMode.IsNormal
&& !Sitecore.Context.Site.Name.ToLower.Equals("shell"))
{
//Do task here
}
Question:
since we have default websites like shell,login,services,scheduer,system etc, do i need to include all the sites in the above
condition to get out of default websites provided by sitecore. I have noticed 'service' website is triggering a request which would bypass the above condition.
Any inputs on this please.
| |
I'm going to try and make this not a link only answer.
What you are trying will not work because the renderings fields (shared and final) want to store the ID of the data source item. If you just type in a path to an item that does not exist, it will not be able to work out an ID.
If you want to make sure that Datasources are set when the item is created, a better way would be to use a Branch Template. This way you can have your datasource items created at the same time as you create your page item.
Use a Branch Template
So create your structure in the branch template area, and create all your datasource items, pointing the rendering datasources at the branch template/page/. You would get something like this:
Branch Templates
- $name
- Page Item
- Data Source Content 1
- Data Source Content 2
- etc...
Good so far...
Fix Up Sitecore
Now we need to fix Sitecore - because when Sitecore creates the items from the branch templates, it will keep the original ID's of the items from the branch template location.
Fortunately there is already a fix for that. @Kamsar wrote up a nice fix here for Branch Datasource Presets. This modifies the addFromTemplate pipeline from the itemProvider group. I will include the code here so this doesn't become a link only answer. All credit for code goes to @Kamsar.
Configuration changes:
<!-- Add this to App_Config/Include to enable branch presets -->
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<group name="itemProvider" groupName="itemProvider">
<pipelines>
<addFromTemplate>
<processor type="BranchPresets.AddFromBranchPreset, BranchPresets" />
</addFromTemplate>
</pipelines>
</group>
</pipelines>
</sitecore>
</configuration>
And this is the code that gets run to fix the datasource locations:
public class AddFromBranch : Sitecore.Pipelines.ItemProvider.AddFromTemplate.AddFromTemplateProcessor
{
public override void Process(AddFromTemplateArgs args)
{
Assert.ArgumentNotNull(args, nameof(args));
if (args.Destination.Database.Name != "master") return;
var templateItem = args.Destination.Database.GetItem(args.TemplateId);
Assert.IsNotNull(templateItem, "Template did not exist!");
// if this isn't a branch template, we can use the stock behavior
if (templateItem.TemplateID != TemplateIDs.BranchTemplate) return;
Assert.HasAccess((args.Destination.Access.CanCreate() ? 1 : 0) != 0, "AddFromTemplate - Add access required (destination: {0}, template: {1})", args.Destination.ID, args.TemplateId);
// Create the branch template instance
Item newItem = args.Destination.Database.Engines.DataEngine.AddFromTemplate(args.ItemName, args.TemplateId, args.Destination, args.NewId);
// find all rendering data sources on the branch root item that point to an item under the branch template,
// and repoint them to the equivalent subitem under the branch instance
RewriteBranchRenderingDataSources(newItem, templateItem);
// now go through all descendants to translate their data sources
var newItemDescendants = newItem.Axes.GetDescendants();
for (int i = 0; i < newItemDescendants.Length; i++)
{
RewriteBranchRenderingDataSources(newItemDescendants[i], templateItem);
}
args.Result = newItem;
}
protected virtual void RewriteBranchRenderingDataSources(Item item, BranchItem branchTemplateItem)
{
string branchBasePath = branchTemplateItem.InnerItem.Paths.FullPath;
LayoutHelper.ApplyActionToAllRenderings(item, rendering =>
{
if (string.IsNullOrWhiteSpace(rendering.Datasource))
return RenderingActionResult.None;
// note: queries and multiple item datasources are not supported
var renderingTargetItem = item.Database.GetItem(rendering.Datasource);
if (renderingTargetItem == null)
Log.Warn("Error while expanding branch template rendering datasources: data source {0} was not resolvable.".FormatWith(rendering.Datasource), this);
// if there was no valid target item OR the target item is not a child of the branch template we skip out
if (renderingTargetItem == null || !renderingTargetItem.Paths.FullPath.StartsWith(branchBasePath, StringComparison.OrdinalIgnoreCase))
return RenderingActionResult.None;
var relativeRenderingPath = renderingTargetItem.Paths.FullPath.Substring(branchBasePath.Length).TrimStart('/');
relativeRenderingPath = relativeRenderingPath.Substring(relativeRenderingPath.IndexOf('/')); // we need to skip the "/$name" at the root of the branch children
var newTargetPath = item.Paths.FullPath.Replace("Home", "").Replace("Global", "").TrimEnd('/') + relativeRenderingPath;
var newTargetItem = item.Database.GetItem(newTargetPath);
// if the target item was a valid under branch item, but the same relative path does not exist under the branch instance
// we set the datasource to something invalid to avoid any potential unintentional edits of a shared data source item
if (newTargetItem == null)
{
rendering.Datasource = "INVALID_BRANCH_SUBITEM_ID";
return RenderingActionResult.None;
}
rendering.Datasource = newTargetItem.ID.ToString();
return RenderingActionResult.None;
});
}
There is a bit more to the code, so please get it from @Kamsar's blog post and github repo.
This should get you where you want to be with presetting the datasource items relative to the page item.
|
Set relative datasource for rendering
I have a template configured for two devices. Each device has its own type of rendering, but they share the same data source item. Each instance of the page template will have the following structure in the content tree:
- Page (with 2 devices)
- - Data source item (device renderings point at this)
These items will by added to the tree via a branch, grouping them.
Against the template's standard values, I'm trying to set the Data source property of the renderings relative to the Page, i.e. ./<Data source item name> but this doesn't work.
Is there a query syntax I can use to get the relative path?
| |
We have a similar requirement (1/2 million named users) and went the method of sitecore virtual users, and then assigning a specific sitecore role when they are authenticated. You can then authorise which sitecore items (pages) the role has access to.
I'd also suggest you look into implementing your own membership provider, however it does add complexity.
|
Sitecore virtual user vs Session
We are using Sitecore 8.1 to develop an Enterprise-level Website, this site receives around 1/2 million users.
We have a user dashboard and other details that the visitor can see after login, and they can browse protected pages and edit their details like any normal account.
Is it a good idea to keep user details in Session (InProc) and check a session value if they want to access protected pages or we can use Sitecore's Virtual User concept?
Which approach should we take in terms of scalability, security and performance?
| |
I suggest you use Sitecore's MVC equivalent of a FieldRenderer (more information can be found here: http://sitecore-community.github.io/docs/sitecore-mvc/rendering-content/)
@model RotatorViewModel
<h1>Products List</h1>
@foreach (var item in Model.RotatorItems)
{
<h2>@Html.Sitecore().Field("Title", item)</h2>
@Html.Sitecore().Field("Image", item)
@Html.Sitecore().Field("Description", item)
}
This will make sure that all your fields output the proper HTML tags. I advise against outputting it manually, even using @Html.Raw(item.Fields["Description"]) for the html formatted content as you're not expanding links in this case.
|
How to render all fields from a datasource containing items with title,image,description fields using controller rendering
Controller:
public class RotatorController : SitecoreController
{
public ActionResult Index()
{
var dataSourceId = RenderingContext.CurrentOrNull.Rendering.DataSource;
var dataSource = Sitecore.Context.Database.GetItem(dataSourceId);
var viewModel = new RotatorViewModel
{
RotatorItems = dataSource.Children
};
return View(viewModel);
}
}
View Model:
public class RotatorViewModel
{
public IEnumerable<Item> RotatorItems { get; set; }
}
View:
@model RotatorViewModel
<h1>Products List</h1>
@foreach (var item in Model.RotatorItems)
{
<h2>@item.Fields["Title"]</h2>
@item.Fields["Image"]
@item.Fields["Description"]
}
my doubt is:
the description(discription is a field) is of type table....but in webpage it is renderd as tags
and also for the image
can anyone help me with this?
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.