Posts

Showing posts from 2015

ISSUE:Sitecore 8 Edit Frame does not display fields for the context language

SOLVE: Sitecore provided a patch to fix the issue: https://kb.sitecore.net/articles/814090

RESOLVED: Sitecore Solr provider error: Value cannot be null. Parameter name: fieldNameTranslator.

Server Error in '/' Application.
Value cannot be null.
Parameter name: fieldNameTranslator
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.ArgumentNullException: Value cannot be null.
Parameter name: fieldNameTranslator

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:

[ArgumentNullException: Value cannot be null. Parameter name: fieldNameTranslator]    Sitecore.ContentSearch.Linq.Solr.SolrIndexParameters..ctor(IIndexValueFormatter valueFormatter, IFieldQueryTranslatorMap`1 fieldQueryTranslators, FieldNameTranslator fieldNameTranslator, IExecutionContext[] executionContexts, IFieldMapReaders fieldMap, Boolean convertQuer…

RESOLVED: Connection error to search provider [Solr] : Unable to connect to , Core: [index_name]

If you are working with Solr provider for Sitecore 8, I'm sure you have already read this article regarding changes to the Schema.xml that must be applied.

In a recent Solr integration with Sitecore 8 Update 5 (rev. 150812), I ran into the following error(s):

Connection error to search provider [Solr] : Unable to connect to <solr service address>, Core: [index_name]
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.ContentSearch.Exceptions.SearchProviderConnectionException: Connection error to search provider [Solr] : Unable to connect to [http://ocomp-sc-solr:8080/solr], Core: [social_messages_master]

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 s…

BUG: $now in Standard Values changes to 1/1/0001 on Save

Working with Sitecore 8 Update 3 (rev. 150427) I ran into a bug where $now, $date and $time tokens don't seem to be working correctly in Standard Values. Reported it to Sitecore and they confirmed it as a bug and provided the following workaround:
BUG: Adding $now to Standard Values of a template and saving changes the value to 1/1/0001
SOLVE:While on the Standard Values, check "Raw Values" under the View tab. Then add the $now token and Save. Un-check the Raw Values and you will still see a 1/1/0001 value in Standard Values but each time a new item is created, it will have the correct DateTime value. This should with with $date and $time tokens as well.

RESOLVED: Upload file to Sitecore 8 Media Library causes Input string was not in a correct format error

Apparently there is a bug in Sitecore 8 Update 3 (rev. 150427), when you try to upload a file that is 0 Bytes in length, you get the below exception:

Server Error in '/' Application.

Input string was not in a correct format.

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.FormatException: Input string was not in a correct format.

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:

[FormatException: Input string was not in a correct format.]   System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +14292453   System.Number.ParseInt32(String s, NumberStyl…

RESOLVED: A domain specified in the Sitecore.Security.SwitchingProfileProvider provider/domain map could not be found. Domain name:

If you encounter the following error working with setting up Active Directory integration:

A domain specified in the Sitecore.Security.SwitchingProfileProvider provider/domain map could not be found. Domain name: <yourdomain>

Line 3897:        <clear />
Line 3898:        <add name="sql" type="System.Web.Profile.SqlProfileProvider" connectionStringName="core" applicationName="sitecore" />
Line 3899:        <add name="switcher" type="Sitecore.Security.SwitchingProfileProvider, Sitecore.Kernel" applicationName="sitecore" mappings="switchingProviders/profile"></add>
Line 3900:      </providers>
Line 3901:      <properties>


The solve is pretty simple, add a domain element with your domain name such as: <domain name="yourdomain" />  to App_Config/Security/Domains.config

RESOLVED: Solr Exceptions - Document contains at least one immense term in field

If you implemented Solr with Sitecore using Solr 5.x, you may run into the following error when indexing extremely large content in string fields:

org.apache.solr.common.SolrException: Exception writing document id <xxxuniqueid> to the index; possible analysis error. Caused by: java.lang.IllegalArgumentException: Document contains at least one immense term in field="<xxxfieldname>" (whose UTF8 encoding is longer than the max length 32766), all of which were skipped. Please correct the analyzer to not produce such terms. The prefix of the first immense term is: '[10, 9, 9, 10, 32, 32, 32, 32, 32, 32, 82, 84, 82, 83, 32, 70, 97, 99, 105, 108, 105, 116, 121, 32, 10, 32, 32, 32, 32, 84]...', original message: bytes can be at most 32766 in length; got <intgreaterthan32766>Caused by: org.apache.lucene.util.BytesRefHash$MaxBytesLengthExceededException: bytes can be at most 32766 in length; got <intgreaterthan32766>

This is due to the fact that ther…

Sitecore: Indexing Associated Content

Setting up indexes and indexing content for site search in Sitecore is a pretty straightforward task and there is an extensive knowledge base put together by the community with various examples. One useful construct we often find ourselves implementing for keyword search is setting up a computed field. I typically use this construct to index any additional content referenced by a page, typically (content blocks, promos, callouts) added to the page via presentation details


The Need: Index externally reference content by a page itemSolve: Create a computed field to index TextField and HtmlText type fields of referenced items
This implementation fetches all the renderings for the current item's presentation for the default device and checks their datasource item for index-able content.
As a suggestion, check if the current item inherits from certain page templates else skip the execution.

Step1: Create a class and implemented the IComputedIndexField interface as shown below: public cl…

Solr Error: Plugin init failure for [schema.xml] fieldType "x": Error loading class 'solr.xfield'

I recently integrated Solr with Sitecore 7.2 and found that the Schema.xml generated by Sitecore is only supported up to Solr 4.x. Configuring Solr for Sitecore 8 provides the steps required to upgrade Schema.xml to work with Solr 5.x, especially the Step 3 that mentions that Solr.IntField is deprecated and must be replaced with Solr.TrieIntField.

What is fails to mention is that you need to replace the other field types as well else you run into the following error for each of the field types:
Could not load conf for core contentindex: Plugin init failure for [schema.xml] fieldType "plong": Error loading class 'solr.LongField'.The Fix:

In Sitecore generated Schema.xml

Replace


<fieldType name="pint" class="solr.IntField" />     <fieldType name="plong" class="solr.IntField" />     <fieldType name="pfloat" class="solr.FloatField" />     <fieldType name="pdouble" class="solr.Do…

RESOLVED: Uncaught TypeError: Cannot read property 'parent' of null

While testing a few pages in page editor, I started running into this error:
Uncaught TypeError: Cannot read property 'parent' of null This would happen when trying to add a new component while in edit mode. Since the error wasn't very descriptive and researching it online was leading me down the wrong path as this js error usually occurrs due to collision with jquery plugin ($ issue).

So as a trial and error method I started removing the components one by one to see if the "Add Here" buttons would show up. I was able to trace it back to a listing component that was had a couple of Partial Views included in the markup.

The culprit: Using @Html.PartialView() to rendering partial views within a view rendering.

The fix: For the time being I am checking the Page Mode to load or skip the partial views.

 I know this is not the best solution. Please let me know if someone has a better solution.

I was looking to statically bind the renderings instead of using Partial View…

RESOLVED: Empty strings are not allowed. Parameter name: roleName

A lot of users working with Chrome have been complaining about the below mentioned error:

Exception Details: System.ArgumentException: Empty strings are not allowed. Parameter name: roleName ... Stack Trace: [ArgumentException: Empty strings are not allowed. Parameter name: roleName] Sitecore.Security.Accounts.Role.FromName(String roleName) +257 Sitecore.Shell.Applications.Security.EditUser.EditUserPage.Add_Click() +557 [TargetInvocationException: Exception has been thrown by the target of an invocation.] System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0 System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +229 ...
Here is the resolution for it: https://kb.sitecore.net/articles/826753

Implementing Tabbed Select Rendering Dialog in Sitecore new

Image
Looking for better ways to organize components while selecting them using Select Rendering dialog in Page Editor, I came across this module (unable to find it on Sitecore Marketplace) and decided to implement it. The approach seemed pretty straight forward till I actually started implementing it. Here are a few lessons learnt during the implementation.

The idea is to go from this:


To:



Since I couldn't find the module on Sitecore market place I decided to write this post describing the full implementation, including the code:


Find the following file and create a backup <sitecore web root>\sitecore\shell\Applications\Dialogs\SelectRendering\SelectRendering.xml
Edit the file to include the following line below "Renderings" element <Tabstrip ID="Tabs" Width="100%" Height="100%" Background="white" Padding="0px" style="position:absolute; width:100%;top:0px"/>Edit the codebeside element as follows <CodeBe…

Sitecore Tabbed Select Rendering dialog

Image
If you aren't already doing this, you should be!

Found an interesting module (unable to find it on Sitecore Marketplace) to show renderings grouped into tabs while using the Select Rendering dialog from page editor.

The idea is to go from this:


To:




The approach is promising with a few updates:

Tried implementing it by inheriting from SelectRenderingForm and it did not work. No rendering items were being listed. Had to decompile Sitecore.Client.dll and copy the code from Sitecore.Shell.Applications.Dialogs.SelectRendering.SelectRenderingFormHad to comment the following line in OnLoad this.Renderings.InnerHtml = this.RenderPreviews((IEnumerable<Item>)renderingOptions.Items);Found a few issues with the styles, could have be an updated style sheet for Sitecore 7.5, but had to add the following attributes to the tabstripBackground="white" Padding="0px" style="position:absolute; width:100%;top:0px"Here is a detailed description of my implementation.

The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 Authentication required

Using the default Email Action item for Workflow action in Sitecore 7.2 takes the following parameters:

To (To Email)From (From Email)SubjectMessage (Body)Mail Server (Host)Type (default: Sitecore.Workflows.Simple.EmailAction, Sitecore.Kernel) If the mail server uses authentication, which most email hosts do, you get the following error:

The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 Authentication required
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.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 Authentication required

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and loca…