output
stringlengths
34
25.7k
instruction
stringlengths
81
31k
input
stringclasses
1 value
This issue can be caused by modified setting <setting name="RequestErrors.UseServerSideRedirect" value="false" /> which is false by default. According to notes in config file If true, Sitecore will use Server.Transfer instead of Response.Redirect. But Server.Transfer is not good option for regular login page redirect because: ASP.NET does not verify that the current user is authorized to view the resource delivered by the Transfer method. (https://msdn.microsoft.com/en-us/library/y4k58xk7.aspx).
Error executing child request during redirect I am trying to complete login redirect functionality. I prohibited read/write access for default/anonymous for mysite.org/security-page and added NoAccessUrl <setting name="NoAccessUrl" value="/login" />setting. When user visit this page I have an error: The same error occurs when trying redirect to /404 page.
Below is what I believe the proper way of doing this. Note that, since you're not in the context of a live session, some Sitecore mechanisms (such as cross-cluster session migration) aren't available to you. Hence, you must guard against edge cases, particularly when the contact with given identifier already exists and is currently locked by another process. Since the contact you're creating doesn't exist in xDB yet, there's no need for an actual merge. What you need to do is get the existing contact and update its fields. public void EnsureUser(string email) { LeaseOwner leaseOwner = new LeaseOwner("YOUR_WORKER_NAME", LeaseOwnerType.OutOfRequestWorker); ContactRepositoryBase contactRepository = Factory.CreateObject("contactRepository", true) as ContactRepositoryBase; // Attempt to obtain an exclusive lock on an existing contact in xDB. LockAttemptResult<Contact> lockResult = contactRepository.TryLoadContact(email, leaseOwner, TimeSpan.FromMinutes(1)); Contact contact = null; if (lockResult.Status == LockAttemptStatus.AlreadyLocked) { // Another worker or a live web session has an exclusive lock on the contact. // You can't use this contact right now. It's up to you what to do in this case. /* ... */ } else if (lockResult.Status == LockAttemptStatus.DatabaseUnavailable) { // Database is down. Try to handle this gracefully. /* ... */ } else if (lockResult.Status == LockAttemptStatus.NotFound) { // A contact with the given identifier doesn't exist. // Just create a new contact object. contact = contactRepository.CreateContact(Guid.NewGuid()); // Identify it. contact.Identifiers.Identifier = email; // And make it known. contact.Identifiers.IdentificationLevel = Sitecore.Analytics.Model.ContactIdentificationLevel.Known; } else { // We successfull locked an existing contact. contact = lockResult.Object; } // Set some other data on the contact: /* ... */ // Save the contact and release the lock. if (contact != null) { var options = new ContactSaveOptions(release: true, owner: leaseOwner); contactRepository.SaveContact(contact, options); } } Note that instead of the Contact Manager, I used the Contact Repository in the above code, since it works directly with the xDB storage. The Contact Manager in your sample code queries and saves contacts in the Shared Session first, and only then accesses xDB via the underlying Contact Repository.
Identify contact without using Tracker.Current.Session.Identify() I'm creating a contact programmatically (outside of a user context) and saving it to the xDB usnig the following code: public void EnsureUser(string email) { var contactManager = Factory.CreateObject("tracking/contactManager", true) as ContactManager; var contact = contactManager.CreateContact(Guid.NewGuid()); contact.Identifiers.Identifier = email; // Set some other data on the contact contactManager.SaveAndReleaseContactToXdb(contact); } However, I would like to ensure that if a user with the supplied email already exists, the newly created contact is merged with the existing one, and the contact should be marked as a "known" contact in xDB Normally I would use Tracker.Current.Session.Identify() to achieve this, but since I am not in a user context I cannot use the Tracker. Is there a different way to identify a contact and start a merge process?
The result your are trying to achieve is called folding. It needs a few fields with special values to link parent and child results together. It also needs UI components to alter the search query and display the results. All of this is supported by the Coveo index, Search API and JavaScript Search Framework. First, have a look at the required fields. If your related items are also Sitecore items, you will need to code your own Sitecore Computed Index Fields to fill those field values with the required information. If your related items are in an external system, it will be harder for you to fill the fields but doable. You will need to ensure your Coveo for Sitecore edition supports the type of external source you need. Enterprise editions include the Connector Framework (on-premises) or Push API (Cloud) for you to develop connectivity if no out of the box Coveo connector exists for your repository. Then, you will need to add a Folding component in your search interface to alter the search query. And finally, a ResultFolding component in your result templates to display the pages and their media library items together. While not Coveo for Sitecore specific, this blog post explains the process from A to Z.
How to index related (or linked) items in a page using Coveo and display them in the search results? How do I index related or linked items in a certain page and then use UnderscoreJS and OOTB Coveo features to display those items underneath the parent page in the results?
You need to use <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/remoteRebuild" /> strategy after your <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/onPublishEndAsync" /> It is needed if you have separated CM and CD servers. Because you do the pulbish on CM and it does not know about these by default. You need to also add this strategy to your CD servers.
Remote CD Indexing Not Working Republish All Items (Completed with no errors) Rebuild Indexes Using Control Panel (Completed with no errors) Inspect Data/indexes directory. (Date modified is from over a month ago) Verified correct Data Folder. Cleaned out the History, PublishQueue and EventQueue tables. Indexing is not working on my QA environment. It is using a backup from PROD which works fine. We have 1 CM server and 2 CD servers. The indexes are working on the 1 CM server. Here is the relevent XML from sitecore/contentSearch/configuration/indexes: <index id="ac_products_master_index" type="Sitecore.ContentSearch.LuceneProvider.LuceneIndex, Sitecore.ContentSearch.LuceneProvider" patch:source="xActiveCommerce.ContentSearch.config"> <param desc="name">$(id)</param> <param desc="folder">$(id)</param> <!-- This initializes index property store. Id has to be set to the index id --> <param desc="propertyStore" ref="contentSearch/indexConfigurations/databasePropertyStore" param1="$(id)" /> <configuration ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration" /> <strategies hint="list:AddStrategy"> <!-- NOTE: order of these is controls the execution order --> <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/syncMaster" /> <productCategoryStrategy type="ActiveCommerce.ContentSearch.Maintenance.Strategies.ProductCategorySynchronousStrategy, ActiveCommerce.ContentSearch"> <param desc="contentDatabase">master</param> <listening hint="list:AddPublishDatabase"> <web>web</web> </listening> </productCategoryStrategy> <variableProductStrategy type="ActiveCommerce.ContentSearch.Maintenance.Strategies.VariableProductSynchronousStrategy, ActiveCommerce.ContentSearch"> <param desc="contentDatabase">master</param> </variableProductStrategy> </strategies> <commitPolicyExecutor type="Sitecore.ContentSearch.CommitPolicyExecutor, Sitecore.ContentSearch"> <policies hint="list:AddCommitPolicy"> <policy type="Sitecore.ContentSearch.TimeIntervalCommitPolicy, Sitecore.ContentSearch" /> </policies> </commitPolicyExecutor> <locations hint="list:AddCrawler"> <crawler type="ActiveCommerce.ContentSearch.Crawlers.ProductCrawler, ActiveCommerce.ContentSearch"> <Database>master</Database> <Root>/sitecore/commerce/products</Root> </crawler> </locations> </index> <index id="ac_products_web_index" patch:source="xActiveCommerce.ContentSearch.config" type="Sitecore.ContentSearch.LuceneProvider.SwitchOnRebuildLuceneIndex,Sitecore.ContentSearch.LuceneProvider"> <param desc="name">$(id)</param> <param desc="folder">$(id)</param> <!-- This initializes index property store. Id has to be set to the index id --> <param desc="propertyStore" ref="contentSearch/indexConfigurations/databasePropertyStore" param1="$(id)" /> <configuration ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration" /> <strategies hint="list:AddStrategy"> <!-- NOTE: order of these is controls the execution order --> <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/onPublishEndAsync" /> <prodCatOnPublishEndAsync type="ActiveCommerce.ContentSearch.Maintenance.Strategies.ProductCategoryOnPublishEndStrategy, ActiveCommerce.ContentSearch"> <param desc="database">web</param> </prodCatOnPublishEndAsync> <variableProdOnPublishEndAsync type="ActiveCommerce.ContentSearch.Maintenance.Strategies.VariableProductOnPublishEndStrategy, ActiveCommerce.ContentSearch"> <param desc="database">web</param> </variableProdOnPublishEndAsync> </strategies> <commitPolicyExecutor type="Sitecore.ContentSearch.CommitPolicyExecutor, Sitecore.ContentSearch"> <policies hint="list:AddCommitPolicy"> <policy type="Sitecore.ContentSearch.TimeIntervalCommitPolicy, Sitecore.ContentSearch" /> </policies> </commitPolicyExecutor> <locations hint="list:AddCrawler"> <crawler type="ActiveCommerce.ContentSearch.Crawlers.ProductCrawler, ActiveCommerce.ContentSearch"> <Database>web</Database> <Root>/sitecore/commerce/products</Root> </crawler> </locations> </index> Here is the remoteRebuild key: <remoteRebuild type="Sitecore.ContentSearch.Maintenance.Strategies.RemoteRebuildStrategy, Sitecore.ContentSearch" /> EDIT: After adding XML keys for a remoteRebuild strategy. It seems like CD2 is getting indexed, but CD1 is not. The following error is showing in the CD1 logs: 9796 2016:11:17 20:03:45 FATAL [Index=ac_products_web_index] RemoteRebuildStrategy skipped. Full Rebuild was not detected. The next thing I tried was rebuilding the index from the developer tab. And, CD1 was successfully indexed. (http://www.bv02.com/rebuilding-the-search-index-on-remote-servers-with-sitecore-7/) It seems that a full rebuild is not initiated from the control panel, but it is initiated from the developer tab.
You can use MongoDB to achieve what you need. Just create a custom facet (Sitecore documentation: Create a custom contact facet) and store the information whether user chose to never show the message again inside the facet. That will make sure you can access this information every time user logs in again, even if they use different browser. And yes, you can use personalization for showing/hiding the component later.
Storing a user interaction with a page outside of session Alright, I will just dive into explaining the situation: On a page, we have a component called the Help Message. This component will render above most of the content and continue to show until the message expires (whether its thru un-publishing or some field driven expiration). The user (which will be logged in) also has the ability to click a Don't show this anymore button which will make the message hide/not render until a new message is published. Initially I thought storing this as a PageEvent and leveraging Personalization to hide the message was the right path, but (and I could be completely wrong) from what I can tell PageEvents are within the context of a Session. I want to be sure that if I go to another browser or come back 3 months from now, I will not see the message. I have also considered programmatically adding a bool|timestamp as a custom property on the user itself, but I feel there has to be a more Sitecore-idiomatic way to achieve this. I am hoping someone here can give me a nudge in the right direction, Thanks!
I solved it. I was missing a couple of key configuration steps: 1. Enable the remoting service in the SPE config In my App_Config\Include\Cognified.PowerShell.config file, I noticed the following (unrelated elements removed for brevity): <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <powershell> <services> <remoting enabled="false"> <authorization> <add Permission="Allow" IdentityType="Role" Identity="sitecore\PowerShell Extensions Remoting" /> <!-- example to disable specific user from an endpoint: --> <!--add Permission="Deny" IdentityType="User" Identity="sitecore\admin" /--> </authorization> </remoting> </services> </powershell> </sitecore> </configuration> Changing that enabled="false" to an enabled="true" enabled the service. To do that, I added the following patch config file: <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <powershell> <services> <remoting enabled="true" patch:instead="remoting"> <authorization> <add Permission="Allow" IdentityType="Role" Identity="sitecore\PowerShell Extensions Remoting" /> </authorization> </remoting> </services> </powershell> </sitecore> </configuration> 2. Give access to remote Sitecore users Add Sitecore users to the sitecore\PowerShell Extensions Remoting role in User Manager.
How to connect to a Sitecore instance with Windows PowerShell? I have reviewed the GitBook and the two blog articles (original and v2) about remoting with SPE, but I've not been successful in executing any commands. Here's an example script I've been trying to get to work: $session = New-ScriptSession -Username admin -Password b -ConnectionUri http://local.sitecore Invoke-RemoteScript -Session $session -ScriptBlock { Get-Item "master:\content\Home" } Stop-ScriptSession -Session $session The script runs without an error, but no text is output. Things I've tried: I have run this same script (Get-Item "master:\content\Home") in the PowerShell Console inside SPE in Sitecore and I get a result. I have changed the -ConnectionUri to gibberish and confirmed that I do get an error if the URL is incorrect (New-WebServiceProxy : The remote name could not be resolved). I have changed the username and password, too, but I do not receive an error if they are incorrect. I have run Invoke-RemoteScript without a session object (passing in the session parameters to that command) and also do not get an output. I feel like I'm missing something simple. Anyone have any ideas?
I figured out the answer. Embarrassingly enough the answer is that the user I created in the Mongo db was named incorrectly. Once I renamed it, everything worked properly and Sitecore created the necessary collections.
Error message - unable to connect to tracking_contact on a CD server I have a Sitecore 8.1 instance that was upgraded from v7.5. We are using hosted Mongo at ObjectRocket. I don't remember during the upgrade process any step that told me I was supposed to add a connection string for the tracking_contact database in Mongo. Now I am getting the following error in my log files: ManagedPoolThread #4 13:43:59 ERROR Unable to connect to server iad1-mongos0.objectrocket.com:12345: Invalid credential for database 'tracking_contact'.. Plus when I look in my Mongo db hosted at ObjectRocket I don't even see any tracking_contact database. Any ideas?
As pointed out by @michaelwest in the comments, this turned out to be a custom access right added to our solution. I need to dig into how we are using it but I think it is what @sandbeck is describing above - hiding an item from the user but allowing the application to still use it. Thanks for the comments!
Sitecore 8 Security Editor - Read vs Visibility In the Security Editor, I can set Read, Write, Delete, etc. permissions on an item. Can someone tell me the difference between Read and Visibility permissions? What's the proper use of Visibility? Sitecore 8.0 rev 150121
Calling Coveo.$('#search').off(Coveo.QueryEvents.buildingQuery) not only removes your event, but every other event bound to buildingQuery. Looking at the Pager code in the coveo-search-ui, its buildingQuery event updates the query like so: data.queryBuilder.firstResult = eventArgs.first; data.queryBuilder.numberOfResults = eventArgs.count; If this event is not triggered, firstResult and numberOfResults would not be updated, thus stalling the pager. I really think you should not call .off(Coveo.QueryEvents.buildingQuery) as I suspect it will disable every other events that were bound to it. I would instead suggest to bind your buildingQuery event once in your component initialization. If you needed that .off to temporarily disable your buildingQuery, put this condition directly in your createQuery instead to add your own information to the query only when needed.
Paging no longer works after off/on to redo "buildingQuery" I did a ham-handed way of building my own facets and resetting the query, by doing this: Coveo.$('#search').off(Coveo.QueryEvents.buildingQuery) Coveo.$('#search').on(Coveo.QueryEvents.buildingQuery, createQuery) Coveo.$('#search').coveo('executeQuery'); Where "createQuery" is my query that sets up all of the search criteria. The catch seems to be that when I do this, it knocks out pagination...I see the paging, but clicking a page number or the arrow to move forward just causes the section to fade out and in without changing pages. How can I either rebind pagination, or is there a way to quickly reset this to requery Coveo (call my "createQuery" function) without doing off/on?
The Committed Documents step in Coveo for Sitecore (referred to as Waiting for documents to be searchable... in the documentation) is simply querying the index to notify you when your documents are really accessible from a search page. 10/sec with 7k documents looks OK to me, but it looks like this step is not the one that is taking all of that "over an hour" time. I suspect the Deleted Documents step to be the culprit since it is usually the longest part in the indexing validation process. It validates that the old documents are deleted from the index. If you don't mind waiting for that visual feedback, you can simply close the dialog and your documents will be available at a later time. This slowest part could not be improved before because of technical issues, though the next Coveo for Sitecore version will contain such improvement to the process and should handle better the case you are currently experiencing. You could also try to rebuild one index at a time instead, or re-index small parts of the tree, it can only help :)
Coveo cloud indexing too slow Using Coveo cloud (Coveo for Sitecore 4.0.450.0), the rebuilding of just coveo_web and coveo_master indexes takes too long. Once all items are added, the Indexing Manager dialog is stuck for over an hour spinning. This is the status I see on the index in coveo cloud: Performing rebuild Started an hour ago - No items processed This is what is see in Indexing manager: Rebuilding... Job running: Index_Update_IndexName=Coveo_master_index [Items Added to Index: 6278] Job running: Index_Update_IndexName=Coveo_web_index [Items Added to Index: 6277] I've already opened up ports as described here: https://onlinehelp.coveo.com/en/cloud/granting_the_coveo_cloud_platform_access_to_your_on-premises_ces_index.htm
As you can't get the old password, you should use the reset functionality: var user = System.Web.Security.Membership.GetUser(@&quot;domain\username&quot;); var oldPassword = user.ResetPassword(); var newPassword = &quot;Mynewstrongpassword1!&quot;; user.ChangePassword(oldPassword, newPassword); To change the password, you need to work with the Membership user. But as Dražen mentioned, you can get use the Name property of the Sitecore.Security.Accounts.User object in the GetUser method.
Update user password programmatically I am working on forgot password functionality. I use default sitecore user provider. How I can update user password programmatically? Is it possible to change password by manipulation with object of Sitecore.Security.Accounts.User class?
No, it's not possible to get user by custom token field in Sitecore OOTB. You have 2 options: Special token containing encrypted user name. User uses link, user name is decrypted. You get user by username and checks if the whole token is same as what was in the url. Simple and fast. When user uses url with token, you retrieve ALL the users and finds the one you're interested in by comparing custom property. I don't like it but if you can't change how the token is generated, this can be the only option.
Get user by custom property I am working on forgot password functionality. I send email with link which contain special token to user to change password. This token is stored in Sitecore.Security.Accounts.User like custom property. Is it possible to get user by custom token field?
You can find the connection xml under C:\Users\Administrator\AppData\Local\Sitecore\Sitecore.Rocks.VisualStudio\Connections Open the xml file and edit the timeout attributes as needed. <binding hostName="sc81" useWindowsAuth="false" userName="sitecore\admin" password="b21d95ba8b8afb0d" dataService="Hard Rock Web Service" webRootPath="E:\SC81\Website" description="" isRemoteSitecore="false" automaticallyUpdate="true" isHidden="false" hostNameComparisonMode="StrongWildcard" receiveTimeout="00:10:00" sendTimeout="00:01:00" openTimeout="00:01:00" closeTimeout="00:01:00" maxReceivedMessageSize="16777216" maxBufferSize="16777216" maxBufferPoolSize="524288" maxStringContentLength="16777216" transferMode="Buffered" messageEncoding="Text" textEncoding="utf-8" bypassProxyOnLocal="false" useDefaultWebProxy="true" proxyAddress="" />
How to increase request timeout for rocks connection? I'm getting below error when trying to build package using Sitecore Rocks. While building package it takes some time so the connection is getting timed out. The request channel timed out while waiting for a reply after 00:00:59.9909995. Increase the timeout value passed to the request or increase the SendTimeout value on the Binding. localhost/.../service2.asmx has exceeded the allotted timeout of 00:00:59:998000 I have tried updating compilation to debug="true" and also tried updating timeout attributes on SitecoreApplicationCenter under <system.serviceModel> thinking it will work but still I get timeout.
I do not know of any version of Sitecore that supports Dependency Injection for Rules out of the box. Using dotPeek against 8.2 Sitecore.Kernel.dll it looks like you can override the default RuleFactory but you cannot in earlier versions. My suggestion would be to use the Service Locator pattern and overload the constructor. public class AccountHasProduct<T> : WhenCondition<T> where T : RuleContext { [NotNull] private readonly ICustomerContextFactory _customerContextFactory; public AccountHasProduct() : this(null) {} public AccountHasProduct([CanBeNull] ICustomerContextFactory customerContextFactory) { _customerContextFactory = customerContextFactory ?? Ioc.Resolve<ICustomerContextFactory>(); } ... ** Important note: Rule objects are NOT transient, meaning they are pulled across requests so whatever you inject must NOT have user/session/request specific state.
Dependency Injection for a Sitecore Rule I've got a Sitecore Rule, based on WhenCondition<T> where T : RuleContext Is there a way to use dependency injection on a sitecore rule? Currently having to use service locator pattern within protected override bool Execute(T ruleContext) :/ //Clarification// This is for Sitecore 8.1 update 3, but I'd be interested to know if was possible in future versions also.
This is an alternative method to @Kasaku's answer - it effectively gives the same result but can be a little more flexible, especially if you are following Helix guidelines. Instead of patching the physicalRootPath in the targetDataStore for the defaults, you can also do this in each configuration file. So that you only have one place to put the full path, create a zDeveloper.config file. In that add a new variable called sourceFolder: <?xml version="1.0"?> <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <sc.variable name="sourceFolder" value="C:\projects\myproject\src" /> </sitecore> </configuration> Now you can use that in your serialization configs. For example, here is a config for the Habitat Accounts feature: <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <unicorn> <configurations> <configuration name="Feature.Accounts" description="Feature Accounts" dependencies="Foundation.Serialization,Foundation.Assets" patch:after="configuration[@name='Foundation.Serialization']"> <targetDataStore physicalRootPath="$(sourceFolder)\feature\accounts\serialization" type="Rainbow.Storage.SerializationFileSystemDataStore, Rainbow" useDataCache="false" singleInstance="true" /> <predicate type="Unicorn.Predicates.SerializationPresetPredicate, Unicorn" singleInstance="true"> <include name="Feature.Accounts.Templates" database="master" path="/sitecore/templates/Feature/Accounts" /> <include name="Feature.Accounts.Renderings" database="master" path="/sitecore/layout/renderings/Feature/Accounts" /> <include name="Feature.Accounts.Core.Templates" database="core" path="/sitecore/templates/Feature/Accounts" /> <include name="Feature.Accounts.Media" database="master" path="/sitecore/media library/Feature/Accounts" /> </predicate> <roleDataStore type="Unicorn.Roles.Data.FilesystemRoleDataStore, Unicorn.Roles" physicalRootPath="$(sourceFolder)\feature\accounts\serialization\Feature.Accounts.Roles" singleInstance="true"/> <rolePredicate type="Unicorn.Roles.RolePredicates.ConfigurationRolePredicate, Unicorn.Roles" singleInstance="true"> <include domain="modules" pattern="^Feature Accounts .*$" /> </rolePredicate> </configuration> </configurations> </unicorn> </sitecore> </configuration> Notice that the targetDataStore is overwritten: <targetDataStore physicalRootPath="$(sourceFolder)\feature\accounts\serialization" ... /> Using this method, each of your Foundation, Feature and Project layers can have their Unicorn files in their own folder - keeping the Helix pattern. It's still all under the source folder in your repo, so you have no issues with source control.
Unicorn Serialized Files to Source Control? How should I approach getting serialized items into source control? I have Unicorn sync down to my ~/App_Data/serialization/ so auto-publish does the deed, but how do you get changes if you're developing outside the web root? I am currently using a gulp script to look out for changes to YML files and pull them back, but I wanted to make sure I wasn't missing something.
I was able to reproduce it and got a solution. You are probably missing one small thing. Open new tab: http://domain/sitecore/shell/default.aspx?xmlcontrol=RichText.InsertFloatImage&amp;la=en Right now it will be empty. Located the InsertFloatImage.xml file and open it Make sure you have changed RichText.InsertImage node to RichText.InsertFloatImage, like this: <?xml version="1.0" encoding="utf-8" ?> <control xmlns:def="Definition" xmlns="http://schemas.sitecore.net/Visual-Studio-Intellisense"> <RichText.InsertFloatImage> <FormDialog Header="Insert Float Media Item" Text="Navigate to or search for the image or media file that you want to insert." OKButton="Insert"> <!--control code --> </FormDialog> </RichText.InsertFloatImage> </control> Restart your application (this is super important! You have to do this to clean cache in Sitecore) Go back to: http://domain/sitecore/shell/default.aspx?xmlcontrol=RichText.InsertFloatImage&amp;la=en and refresh the page. Done. Now you should see your custom dialog. I was able to display my custom dialog (changed title) and after I clicked Insert I was able to hit the js breakpoint .
Adding a new button on the Sitecore rich text editor is not working I'm adding a new button to the Sitecore rich text editor. I've used this link as a reference. What I'm trying to do is have a button just like "Insert Sitecore Media" where when I click it I can add an image, but that image I want to add some inline styling to it(not something a content author will do but something I'll get done programmatically). If anyone have done something similar let me know. So here's what I have done: I have created the button on the core db with the click value as InsertFloatMedia Within /sitecore/shell/contros/rich text editor/ I have created a folder InsertFloatMedia Within that folder I copied and renamed the InsertFloatMedia.js and InsertFloatMedia.xml I have tried to reproduce the same xml described on the example I mentioned just changing what needed for InsertFloatMedia Have created a class and referenced it on the xml(this class is identical to the example) have changed the Rich Text Commands.js and added this: RadEditorCommandList["InsertFloatMedia"] = function (commandName, editor, args) { var d = Telerik.Web.UI.Editor.CommandList._getLinkArgument(editor); Telerik.Web.UI.Editor.CommandList._getDialogArguments(d, "A", editor, "DocumentManager"); //Retrieve the html selected in the editor var html = editor.getSelectionHtml(); scEditor = editor; //Call your custom dialog box editor.showExternalDialog( "/sitecore/shell/default.aspx?xmlcontrol=RichText.InsertFloatMedia&amp;la=" + scLanguage, null, //argument 500, //Height 180, //Width scInsertFloatMediaCallback, //callback null, // callback args "InsertFloatMedia", true, //modal Telerik.Web.UI.WindowBehaviors.Close, // behaviors false, //showStatusBar false //showTitleBar ); }; //The function called when the user close the dialog function scInsertFloatMediaCallback(sender, returnValue) { if (!returnValue) { return; } //You may retreive some code from your returnValue //For the example I add Hello and my return value in the Rich Text scEditor.pasteHtml("Hello " + returnValue.text, "DocumentManager"); } THE ERROR But when I try to execute this opening the RTE and clicking on the button a blank pupup shows up. inspecting the url of the iframe it looks like this: Based on the image I see the page is empty(look at the body tag) If I inspect the src for out of the box ones when I click, they show properly. Anyone know what I'm doing wrong?
It depends. I think you'll need to look into writing integration code for this, as there would rarely be anything that completely OOTB connects two systems like these. So something like Sitecore Commerce Connect linked to SAP Data Services / OData (discussed here). That said; if by chance your client is using SAP Hybris, there does seem to be a tool on the market that might be of use. EPAM Sitecore Commerce + SAP Hybris Connector.
Are there Sitecore e-commerce solutions that have native integration with SAP? I'm looking for an Sitecore e-commerce solution that can read pricing/inventory information out of SAP. Has anyone done this before or know of a platform that can support this kind of integration natively?
The first thing that you need to do is to go into the Maps Provider for your website. You can find that under the Settings node in the Content Editor. When you click on the Maps Provider node, you will see a screen that looks something like this: You just need to enter your Google Maps API Key into that box, save the item, and you'll instantly be able to render the maps.
How do I get the map component to work in SXA? I've got a new install of Sitecore 8.2 with the SXA add-on configured, and I'm trying to add a map component to my page. When I add it, I get the following error: I looked at the console, and it is complaining about not having an API key set. I went ahead and got an API key from Google, but now I can't figure out where to put it so that SXA/Sitecore will use it while it's generating the map. How do I get the map to show up correctly in SXA?
Styles from <body> tag added to Sitecore Body Css Style page field after import. That field is defined by its ID in SXA code: public static readonly ID BodyCssClass = new ID("{D4952280-2D7D-4BF4-A99A-EA36DAD0F0A7}"); Body Css Style field belongs to /sitecore/templates/Foundation/Experience Accelerator/Theming/_Styleable template. The problem is, SXA pages are not inherited from that template after site is scaffolded. To fix that, you need to open Page template for your tenant - /sitecore/templates/Project/My Tenant/Page and add _Styleable to Base templates. After that is done, reimport Creative Exchange package and you style will appear in Body Css Style field.
Creative Exchange does not import page <body> style in SXA With Creative Exchange styles can be edited in Components or in Page <body> tag. Components works fine out of the box. New styles are added to Sitecore and assigned to components after import as expected. Page body is not so easy. I added style to the page, but nothing was changed in Sitecore after importing package with that style. My changes are just ignored. What should I do to import custom style added to <body> tag in SXA? I am using SXA v1.1
UPDATE: Based on the updated stack trace, this actually looks like an issue with serializing an IEnumerable property exposed on one of your glass models (whether directly on your primary model, or indirectly as a child item's properties). One thing you can try to do is to replace all of your IEnumerable<T> definitions with a concrete collection type, like List<T>. Caveat Emptor: I have not tried this myself, but... Caching interface-based proxies should in theory work (see this reference) The interface-based models are backed by a dynamic proxy class, and Castle (the parent project of DynamicProxy) has ensured that proxies are serializable. However, if this is not working for you currently, it's entirely possible that this is a bug in Glass Mapper. I say this because even though the primary interceptor used in Glass Mapper (source here) is marked as [Serializable], the ProxyHook is not. If this seems like the problem to you, I would recommend opening an issue in GitHub to let Mike know.
Redis Cache with Glass mapper interfaces in Sitecore 8.1 and above I'm using Stackexchange.Redis for Redis cache on Azure with Glass mapper and Sitecore 8.1 - For Glass mapper implementation I'm using interfaces as models and maps configuration to get the data. Now the issue is that for Redis provider to work we should pass the object as serializable which can only happen in classes but I'm using interfaces as model with glass mapper. If I use classes as model and serialize it my redis implementation works just fine but then I'll be limited to have multiple inheritence in my template. Can anyone please suggest how to use Glass Mapper interfaces to be pushed into Redis cache or any work around for this? Below is the error I'm getting while serializing the Interface: Type 'System.Linq.Enumerable+WhereSelectEnumerableIterator`2[[Sitecore.Data.Templates.Template, Sitecore.Kernel, Version=8.1.0.0, Culture=neutral, PublicKeyToken=null],[System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' in Assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable. at System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type) at System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context) at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo() at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder) at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo) at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteArrayMember(WriteObjectInfo objectInfo, NameInfo arrayElemTypeNameInfo, Object data) at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteArray(WriteObjectInfo objectInfo, NameInfo memberNameInfo, WriteObjectInfo memberObjectInfo) at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo) at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck) at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck) at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph) at public class SampleItemMap : SitecoreGlassMap<ISampleItem> { public override void Configure() { Map(x => { ImportMap<IGlassBase>(); x.TemplateId("{21AB47FD-F264-48B4-ABF4-1FF5B10FB4A4}"); x.Cachable(); x.AutoMap(); }); } } And the Interface for Handling the Default SampleItem template is as below: public interface ISampleItem : IGlassBase { string Title { get; set; } string Text { get; set; } }
I have seen a similar behaviour and the reason was that the the type of the field I had set on my /buckets/facets was not compatible with the type of the facet I was using. What's the type your field is getting indexed as?
Field not showing up in coveo range facet dropdown I've defined a new facet Price in /sitecore/system/Settings/Buckets/Facets but it does not show up in the Field dropdown when I try to add a Coveo Range Facet View. I can only see 2 fields in the dropdown as opposed to 10+ fields that are defined in /sitecore/system/Settings/Buckets/Facets folder. I've already rebuilt the coveo indexes multiple times. The Price field does show up in regular Coveo Facet View's dropdown. Is there anything else I need to do? Update: seeing this warning in logs, WARN The item with ID 'Price' could not be found. The item ID will be returned instead of the list value.
I wrote a blog post on this here - here are the cliff notes. I'm going to assume Sitecore 8.2 for the version here, but the process is pretty much the same for earlier versions too, there would be some small tweaks. Registering your own IoC Container If you want to use your own container with 8.2 instead of the Sitecore out of the box one, or if this is pre 8.2 you should create a new custom pipeline for it. Create a new Foundation project, I called it Sitecore.Foundation.DependencyInjection, then create a new pipeline. I have called the pipeline IntializeDependencyInjection - this can be kicked off in the initialize pipeline. Patch it before the InitializeControllerFactory in 8.2 <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <pipelines> <initialize> <processor type="Sitecore.Foundation.DependencyInjection.Pipelines.Initialize.InitializeDependencyInjection, Sitecore.Foundation.DependencyInjection" patch:before="processor[@type='Sitecore.Mvc.Pipelines.Loader.InitializeControllerFactory, Sitecore.Mvc']" /> </initialize> </pipelines> </sitecore> </configuration> The pipeline makes use of the IServiceCollection interface from the new MS DI Abstractions. This allows us to register our dependencies in the collection from our projects without having to put a dependency on the container in the projects. It also means we stick closer to the CompositionRoot pattern for registering the dependencies. InitialiseDependencyInjection Pipeline The pipeline needs custom args to pass the IServiceCollection around: namespace Sitecore.Foundation.DependencyInjection.Pipelines.InitializeDepdencyInjection { using Microsoft.Extensions.DependencyInjection; using Sitecore.Pipelines; public class InitializeDependencyInjectionArgs : PipelineArgs { public IServiceCollection ServiceCollection { get; set; } public InitializeDependencyInjectionArgs(IServiceCollection serviceCollection) { this.ServiceCollection = serviceCollection; } } } Now run the pipeline and pass the args around. Once the pipeline has finished, you will have a populated collection of registrations. So you need to run through that and register each one with your container. It looks like CastleWindsor has a conforming container so you can populate the container with the IServiceCollection namespace Sitecore.Foundation.DependencyInjection.Pipelines.Initialize { using System; using System.Collections.Generic; using System.Linq; using System.Web.Mvc; using Microsoft.Extensions.DependencyInjection; using SimpleInjector; using SimpleInjector.Integration.Web.Mvc; using Sitecore.Diagnostics; using Sitecore.Foundation.DependencyInjection.Pipelines.InitializeDepdencyInjection; using Sitecore.Pipelines; public class IntializeDependencyInjection { public void Process(PipelineArgs args) { Log.Info("Start dependency injection initialization", this); var serviceCollection = new ServiceCollection(); // start the pipeline to register all dependencies var dependencyInjectionArgs = new InitializeDependencyInjectionArgs(serviceCollection); CorePipeline.Run("initializeDependencyInjection", dependencyInjectionArgs); var container = new WindsorContainer(); WindsorRegistration.Populate(container, services, app.ApplicationServices); var sp = container.Resolve<IServiceProvider>(); // TODO: Set the ASP.NET dependency resolver } } } NOTE* this part is untested and you still have to set the dependency resolver - I'm not familiar with how to do that using CastleWindsor. Register Your Dependencies in each Feature Finally you need to add processors to the pipeline to register your dependencies for the features. Create a new processor, call it RegisterServices, use the InitializeDependencyInjectionArgs that you created above: public class RegisterServices { public void Process(InitializeDependencyInjectionArgs args) { args.ServiceCollection.AddTransient<IAccountRepository, AccountRepository>(); // TODO: Add any other registrations here args.ServiceCollection.AddMvcControllersInCurrentAssembly(); } } Then register your dependencies for that feature - you would create one of these for each feature/foundation or even project that you have in your solution. Add the processor to your feature/foundation projects config: <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <pipelines> <initializeDependencyInjection> <processor type="Sitecore.Feature.Accounts.Pipelines.InitializeDependencyInjection.RegisterServices, Sitecore.Feature.Accounts" /> </initializeDependencyInjection> </pipelines> </sitecore> </configuration> So the cliff notes turned into a bit of a long post, but that should give you a good place to start.
IoC in Helix architicture I am using Castle.Windsor on my project which based on Helix principle. Where the best place to initialize IoC in Helix? Where I should register container? Foundation/Project layer(Common project or for each project in project layer)
Well there's probably a few approaches you could take with this. Ideally with a Helix pattern, you would build for example a blog that would exist within a feature module. If there's a project specific variation, moving the views to the project could present some challenges depending on how the renderings are defined. If you created View Renderings to represent your views, you would have multiple listings in the layout section of the same rendering. Ex. Blog Listing - Site A &amp; Blog Listing - Site B. I would avoid that. Alternatively if you were using a controller rendering, yes you could only have one rendering definition, but then your controller would need to render the correct view depending on the site. So you would need to make the Controller's more intelligent. You could also go a different approach, if you wanted to keep everything in one layer. You could build another feature/foundation element that could handle rendering variations. It would be like taking some of the implementation ideas from SxA, where they use rendering variants that allows you to have one rendering that for example is a blog listing display, but with the concept of a rendering variation, you could vary the rendering html (and fields used) for your rendering depending on the site it's on. And this would allow you to eliminate the need for multiple views per site.
Helix. Moving views to Project layer I am working on Helix based project. This one is multi-site project. The html for same features different so I've decided to move views to project layer to support html difference. Is it allowed to move views to project layer? What the consequences might be?
This exception can happen in at least 2 cases: There is already a redirect that has been initiated earlier during the page request. Your application wrote other headers to the response before WebUtil.Redirect was called. In both cases, you should get a clue about what's happening by setting a breakpoint on the line with WebUtil.Redirect and looking at the values stored in Response.Headers. If there's already a redirect header, the best thing to do is make sure your redirection logic is consolidated in one place—then there won't be room for such errors. If you can't control previous redirects, then you can guard against them: if (!Response.IsRequestBeingRedirected) { string returnUrl = "/sitecore/content/"; WebUtil.Redirect(returnUrl); }
WebUtil.Redirect - Cannot redirect after HTTP headers have been sent We have simple code below: string returnUrl = "/sitecore/content/; WebUtil.Redirect(returnUrl); However, the the last line above seems to throw an exception below: 6156 2016:11:18 06:41:01 ERROR Application error. Exception: System.Web.HttpException Message: Cannot redirect after HTTP headers have been sent. Source: System.Web at System.Web.HttpResponse.Redirect(String url, Boolean endResponse, Boolean permanent) at Sitecore.Web.WebUtil.Redirect(String path) Any idea what could be throwing this excpetion?
You should check the language as soon as possible - so I would do it in the HTTPRequestBegin pipeline at the languageResolver. <processor type="Sitecore.Pipelines.HttpRequest.LanguageResolver, Sitecore.Kernel" /> This is depending on what action your site should take, offcourse. But it sounds like, it should change to a different language.
protected languages -> Redirection I have requirement i.e. I have some protected languages like de-DE (German), when user browsing these language ex: http://www.xyz.com/de-DE then he must redirect to login page. Could you please let me know where to which is best pipeline to add this code. I am trying to add the code using Sitecore.Pipelines.RenderLayout.SecurityCheck.
The product team is working on the compatibility with Sitecore 8.2 first. That is expected in January. CC2017 connectors are slated shortly after that, but no firm timeline. From SC product team.
Availability of PXM Indesign connector for Indesign CC 2017? Does anyone has any idea on when there would be a PXM Indesign connector for Indesign CC 2017 available? I've noticed after an update that the plugin for 2015 did not work on 2017 and I had to reinstall the Indesign CC 2015 version (next to the updated one) to keep on using the plugin.
After a lot or research and getting in contact with Sitecore, I have concluded that EXM doesn't add anything to the list / segment builder, meaning that it's not possible to get the "current email" from the context when the list is being filtered. My goal can be achieved by handling the list and conditions by code. We must set the value for the condition with custom code; Based on our workflow, we'll do it at email creation, but I guess it could be done on email save, to keep it up to date. The value could be the actual email (as @ruud suggested), or the values we want to pick from the email, it depends on where we want to put the logic, but I prefer the actual values to keep the condition agnostic of the email. This solution is not as "clean and dynamic" as I would, but
How to build a condition for segment builder based on a EXM campaign is it possible to build a custom condition for the segment builder that receives an EXM campaign as parameter / context? How? I'm trying to find contacts where a specific facet has the same value as a field of the email, but I don't know how to pass the email as context when EXM uses the list, nor even if it's possible. Any idea or starting point?
When publishing with subitems and related items, there are two important aspects to keep in mind: related items of subitems will be published; related items of related items will not be published. Comparing two publishing scenarios Let's consider the relationships between your items: Home A (page item) -----------------------+ B (local content) | C (data source item) <--(link)--+ | Media library | D (image) <--(link)--+ Item C (data source item) will be considered both a related item and a subitem of item A (page item). When you publish item A, Sitecore will first publish all related items, including item C. The image item D will be treated as a related item of a related item, and hence will not be published. Even though item C is also a subitem of item A, it will be skipped when iterating over A's subitems, as it will have been published already. When you publish item B directly, item C will be published as its subitem. So all related items of C, including item D, will be published in this scenario. Conclusion This behavior is kind of by design, but I would consider it a bug. In my opinion, Sitecore should change this behavior to always publish all related items of subitems, even if a certain subitem has already been published in the ongoing publishing process. If you decide to submit this as a bug to Sitecore, please leave a comment here with the bug's reference number.
Image not published in data source item (Sitecore 8.1) Sitecore 8.1 update 2: Our content authors noticed that in a certain constellation newly uploaded images would not get published. So the content author is in Experience Editor, adds a component which is saved as a data source below page (content page -> local content -> data source item with image field), uploads an image, links it in component and publishes the whole page, with options sub items and related items. There are no workflows yet so nothing should get lost, right? :) Anyways. Everything is published (or in web database) except the image. If the component has a text field that is published as well. But when I publish the "local content" folder separately below the content page in content editor then the image will get published. I could reproduce this issue in a vanilla version with the sample rendering and was wondering if this is by design or if it is a bug? Update Correct answer to the question is of course Dmytro Shevchenko's. A fix to the problem is in my answer.
It turns out this had to do with Indexing. Go figure. The index database and the OnPublishEndAsync were pointing to different databases.
Package Installation Error - Install Version Null Reference Exception I created a Sitecore Package. I tested the package in a test environment and it worked fine. But, in the client's environment, one of the items in the package fails with this error: ManagedPoolThread #14 08:04:33 ERROR Error installing items/master/sitecore/templates/User Defined/Pages/Contact Us Form Page/{13B87AC4-38BD-43C6-A5D7-FCB1D081533F}/en/1/xml Exception: System.NullReferenceException Message: Object reference not set to an instance of an object. Source: Sitecore.Kernel at Sitecore.Install.Items.ItemInstaller.VersionInstaller.InstallVersion(Item version) at Sitecore.Install.Items.ItemInstaller.VersionInstaller.PasteVersion(XmlNode versionXml, Item target, VersionInstallMode mode, IProcessingContext context, Boolean removeOtherVersions) at Sitecore.Install.Items.ItemInstaller.InstallEntry(PackageEntry entry) ManagedPoolThread #14 08:04:46 ERROR Installation failed: System.NullReferenceException: Object reference not set to an instance of an object. at Sitecore.Install.Items.ItemInstaller.VersionInstaller.InstallVersion(Item version) at Sitecore.Install.Items.ItemInstaller.VersionInstaller.PasteVersion(XmlNode versionXml, Item target, VersionInstallMode mode, IProcessingContext context, Boolean removeOtherVersions) at Sitecore.Install.Items.ItemInstaller.InstallEntry(PackageEntry entry) at Sitecore.Install.Items.ItemInstaller.Flush() at Sitecore.Install.Framework.SinkDispatcher.Flush() at Sitecore.Install.Utils.EntrySorter.Flush() at Sitecore.Install.Framework.EntryBuilder.Flush() at Sitecore.Install.Zip.PackageReader.Populate(ISink`1 sink) at Sitecore.Install.Installer.InstallPackage(String path, Boolean registerInstallation, ISource`1 source, IProcessingContext context) at Sitecore.Install.Installer.InstallPackage(String path, ISource`1 source, IProcessingContext context) at Sitecore.Shell.Applications.Install.Dialogs.InstallPackage.InstallPackageForm.AsyncHelper.<Install>b__4() at Sitecore.Shell.Applications.Install.Dialogs.InstallPackage.InstallPackageForm.AsyncHelper.CatchExceptions(ThreadStart start) So it seems like a version failed, but the item only has one version in the source instance of Sitecore. I am not sure why this failed. Edit I have a posted a package with the item in question here: https://www.dropbox.com/sh/uzxls6mv68evoce/AAAkbtK8YAXi6QUWdlk28869a?dl=0 Edit 2 It has nothing to do with this particular item. I tried removing the item from the package and re-importing and I just get the same error on a different item.
We have done this for several clients. I have added the alternate tags to the sitemap but that caused the sitemap to be too large and I didn't want to create multiple sitemaps. So we added the tag in the header. Then created a sitemap of just the English content because English was the default language. This way Google will be able to get to all the links in the sitemap and then the alternate tags on the page will be crawled as well. The tags are similar <link rel="alternate" href="https://www.company.com/de/john-doe/" hreflang="de" /><br> <link rel="alternate" href="https://www.company.com/fr/john-doe/" hreflang="fr" /><br> <link rel="alternate" href="https://www.company.com/es/john-doe/" hreflang="es" /><br> <link rel="alternate" href="https://www.company.com/zh-CHS/john-doe/" hreflang="zh-Hans" /><br> <link rel="alternate" href="https://www.company.com/en/john-doe/" hreflang="en" /> Note the language code doesn't include the region. Only use the region if you are going to have the same language different based on region. Example French in Canada fr-ca or French in France fr-fr. If the same everywhere just use fr. Also include all the languages including the one you are currently on. Very important is to make sure the lang attribute on the HTML tag is correct for the language you are viewing the site in. If not set Google will try and interpret the language from the content on the page. When you have everything set up you can view any issue or how Google is viewing the tags by going to the Google Search Console and International Targeting. It will give you a count of what it found and some details on issues that you may need to resolve. Some good pages to find more information. https://support.google.com/webmasters/answer/189077 https://support.google.com/webmasters/answer/2620865
Advice on hreflang usage in page html vs. using in sitemap.xml file I wanted to ask for some advice on the best way to proceed with hreflang tags on a sitecore site. Currently, we have an English only site but we will be launching 11 more language sites localized in the local language. Our site is currently set up like www.abccompany.com/en. The other language sites will follow the same style like www.abccompany.com/fr for French, www.abccompany.com/de for German and so on. When dealing with hreflang tags, there are some options but we are not sure the best way to proceed. I copied the options directly from this page from Google Webmasters forum here: HTML link element in header. In the HTML <head> section of http://www.example.com/, add a link element pointing to the Spanish version of that webpage at http://es.example.com/, like this: <link rel="alternate" hreflang="es" href="http://es.example.com/" /> HTTP header. If you publish non-HTML files (like PDFs), you can use an HTTP header to indicate a different language version of a URL: Link: <http://es.example.com/>; rel="alternate"; hreflang="es" To specify multiple hreflang values in a Link HTTP header, separate the values with commas like so: Link: <http://es.example.com/>; rel="alternate"; hreflang="es",<http://de.example.com/>; rel="alternate"; hreflang="de" Sitemap. Instead of using markup, you can submit language version information in a Sitemap. ([more info here][2]) We also have a store site that is located on a subdomain like this: store.abccompany.com. We know that there is a sitemap module that could be used for creating Option #3 above which is the sitemap.xml file but in your opinion with dealing with Sitecore sites, which would you recommend? Setting up the html link element in the header and do an HTML header for PDFs (Options #1 &amp;2) or go with a sitemap module to add the hreflangs in the actual sitemap.xml file? Thanks in advance for any insight you can give on the topic.
ItemManager.AddFromTemplate method uses your current language. You can wrap your code into Language lang = Language.Parse("your-lang-name"); using (new LanguageSwitcher(lang)) { ItemManager.AddFromTemplate... } if you want to change the new item language.
ItemManager.AddFromTemplate. How to set language used I'm writing some code to migrate items using the ItemManager.AddFromTemplate method. I'm wondering how to set what language the item created from that method is created in. Does it default to the language set in the sites node in config?
Verify that your authentication mode is configured properly :) After helping him I can verify that the authentication provider was set to windwos and not Forms, after switching back to Forms it worked againg
default admin user not working I have problems with login using the default admin user. it wont let me login using /sitecore/admin/login.aspx If I login to the launchpad, I just get this It worked as expected after the clean install. But now the customer has changed the hostname, and the admin user is no longer working? The user is still in core db, with isApproved = true, isLockedOut = false, IsAnonymous = false. The password is still b What am i missing?
We had to do a similar job a while ago. We decided not to go for SPE this time as there was quite some logic involved in the placeholder replacement - we decided to write a custom page that starts a job in a long-running thread (as we had to go over a lot of items). I assume you know how to loop over all (needed) items, so I'll cover 1 item. For the replacement itself we had 2 options: use the item.Visualization.GetRenderings, loop over all renderings and set the Placeholder value to "content" (if needed) edit the __Renderings field of your item straight away (the placeholder names are in the xml as strings, so you could replace them) We edited the __Renderings field (because we could and it saved us a loop). This will only work if you know which placeholders to replace and which to keep. If you don't and need to get the available placeholders first (available is not same as used - "used" placeholders is easy to get from all renderings), your code would become a lot more difficult.. there is a blog here that describes how you could do that but I never tried it (and it seems to be webforms). If you would do it this way, add logging so you know what is happening ;)
How can I migrate all controls on all pages to a certain placeholder? The layout of our website has been completely overhauled. The old placeholders didn't make sense anymore, so they aren't used in the new layouts. As a result, most content pages are now empty. All pages still have controls set up in the presentation details, they are just not shown since they are mapped to old placeholders. What I need to do is go through all pages, take all controls mapped to non-existing placeholders in their current page layout, and move them to the "content" placeholder. This way, content editors will be able to see these controls in the Experience Editor and move them to other placeholders on the page. Note that some pages have already been worked on, so the controls that are mapped to valid placeholders should stay where they are. Is there an automated way of doing this? An SPE script, perhaps?
The Experience Editor (previously Page Editor) allows you to switch between devices. Also for the Preview mode. Ribbon > Experience > Click on current device > Select preferred device
Is it possible to show the website for a given device? We have implemented a custom device tablet in Sitecore, and to test it we wish to render the website as if that device was in use. How do we accomplish that? Using Sitecore 8.1
In your code, I can see that you are trying to add a new version of the item in the context language, as opposed to the language of the actual item. Remember that each instance of a Sitecore item is actually only a single language version of the item. Don't believe me? Have a look at your item.ItemUri and see for yourself! In order to add a new language version to an item, the first thing that you need to do is get the item in the language that you wish to add a new version for. As such, if your code had been the following, it would have worked: using (new LanguageSwitcher("en")) { var migratedItem = Sitecore.Context.Database.GetItem(migratedItemId); englishItemVersion = migratedItem.Versions.AddVersion(); } Of course, you can still do the above without a Switcher, if you want to: var migratedItem = Sitecore.Context.Database.GetItem(migratedItemId, "en"); englishItemVersion = migratedItem.Versions.AddVersion();
Create a new version of item, in different language This should be super simple but for some reason I can't get it to work. I am writing code for migrating data and the items has several versions in both English and Swedish. For some reason I cannot get Sitecore to create a version in English. I'm obviously doing something wrong. I'm not able to track down what is causing it? the migratedItem is the item I just migrated in Swedish and that I want to add a English version too. Item englishItemVersion; try { using (new LanguageSwitcher("en")) { englishItemVersion = migratedItem.Versions.AddVersion(); } }
Have you considered putting a custom action at the end of your primary workflow that will change the item's workflow after the first approval? This would allow you to maintain a separate workflow definition for these auto-approvals. Here's an idea of the flow: Item of 'certain template' enters normal workflow for first time. Item is approved through normal workflow to final state. Custom action triggers to change item to final state of 'Auto Approve' workflow. Next author edit triggers new version in 'Auto Approve' workflow. In this way, you won't have any conflicts with other actions from your normal workflow definition.
Workflow Routing Possibilities A new requirement came up that an item of a certain template should be automatically approved and a different email should be sent out IF the item has previous versions that have been approved in the past. I have a custom Workflow Action under the Draft Workflow State that does this logic and when appropriate places the item into an AutoApproved Workflow State and the actions under this state will send an email and then place the item into the Approved State. The problem is the code works but after the path is done of sending the email and setting it to the Approved State, the rest of the Actions under the Draft Workflow State still continue, meaning an email is sent to the appropriate approvers and the item is then put into Awaiting Approval State. Making the auto approve steps moot. Is there a way to abort the current workflow path and put an item on a different workflow path? Right now it seems I can only send the item on a different workflow path but when it is done with it's journey it picks back up on the original workflow path.
It turns out that there is a bug in Sitecore related to EXM and FXM files on the same instance. Sitecore Support pointed me to the following hotfix package that fixed the problem I was having: https://dl.sitecore.net/hotfix/Sitecore%20CMS%208.1%20rev.%20160519%20Hotfix%20119569-1.zip.
Federated Experience Manager (FXM) won't start I have a site that was recently upgraded from v7.5 to v8.1. When I click on Federated Experience Manager from the launchpad the page opens but I get the little Sitecore spinning square. Nothing ever loads. When I look in the logs I see an error that seems to indicate an indexing issue. My guess is that the main page of FXM first reads an index or something. Here is the error message in the log file. Exception: System.InvalidOperationException Message: [Index=sitecore_fxm_domains_web, Crawler=SitecoreItemCrawler, Database=web] Root item could not be found: /sitecore/system/Marketing Control Panel/fxm/. Source: Sitecore.ContentSearch at Sitecore.ContentSearch.SitecoreItemCrawler.get_RootItem() at Sitecore.ContentSearch.SitecoreItemCrawler.IsAncestorOf(Item item) at Sitecore.ContentSearch.SitecoreItemCrawler.IsExcludedFromIndex(IIndexableUniqueId indexableUniqueId, IndexEntryOperationContext operationContext, Boolean checkLocation) at Sitecore.ContentSearch.SitecoreItemCrawler.Update(IProviderUpdateContext context, IIndexableUniqueId indexableUniqueId, IndexEntryOperationContext operationContext, IndexingOptions indexingOptions) at Sitecore.ContentSearch.AbstractSearchIndex.<>c__DisplayClass16.b__10(IndexableInfo info, ParallelLoopState parallelLoopState) at System.Threading.Tasks.Parallel.<>c__DisplayClassf`1.b__c() at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask) at System.Threading.Tasks.Task.<>c__DisplayClass11.b__10(Object param0) It seems to be saying that it can't find the FXM root item: /sitecore/system/Marketing Control Panel/fxm/. Although when I look in my content editor that item is clearly there. I do notice that in my content tree the name of the item is capitalized FXM instead of all lower case fxm. Would that make a difference? I also notice that my Solr indexes for FXM (master and web) have nothing in them at all. Is that normal if you haven't set anything up yet for FXM? EDIT: In addition when I look in the browser console when trying to load FXM I see the following: Uncaught Failed to data-bind: ProgressIndicator - TypeError: Cannot read property 'attributes' of undefined - sitecore-1.0.2.js:2092
I created a custom Sitecore command to provide more flexible option for this issue. I looked into the Sitecore code related to system:publish command which was associated with this "Site publish" menu item and adjust it to support few options which can be changed using config setting. Basically this will provide you with a Sitecore setting which you can adjust by changing config include file, with options to Run the default sitecore publishing operation Display a warning message and ignore the publishing Hide the menu item from Content Editor Configuration file looks as follows <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <commands> <command type="SitecoreFootsteps.Modules.CustomEditorFullPublishOption.CustomCommand.CustomFullPublish,SitecoreFootsteps.Modules.CustomEditorFullPublishOption" name="scfootsteps:customfullpublish"/> </commands> <settings> <!-- values : enabled : works as default sitecore publishing disabled : display warning message and doesn't trigger publishing hidden : hide the full publish option --> <setting name="SitecoreFootsteps.EditorFullPublishOption" value="enabled" /> </settings> </sitecore> </configuration> So, if you set the above setting to "hidden", Content Editor "Site publish" option will get hidden And if you set the setting to "disabled", Content Editor will display "Site publish" option but will return a warning message once clicked and just ignore the publish operation. You can take a look at the code from following url https://github.com/chaturangar/sitecore-footsteps/blob/master/SitecoreFootsteps.Modules/SitecoreFootsteps.Modules.CustomEditorFullPublishOption/CustomCommand/CustomFullPublish.cs In that code, just only adjust few places including hiding and displaying message depending on the custom config setting introduced above. You can find more details from my blog post https://sitecorefootsteps.blogspot.com/2016/11/custom-sitecore-command-to-disable-or.html
How to prevent Site Publishing for everyone? We have a separate job for publishing items with some logic. We need to prevent users from accidentally clicking on Publish Site, even Administrators. The regular revoking of 'Publish' item in Core DB doesn't work for Admin.
I see two problems in your question. First of all, you do not have any results on your search. In order to tackle this, you will need to solve your second problem, which is being able to see the document's properties. To see documents properties, you will need to give yourself "Index Browser - Full Access" Permissions. You can do this in the the Coveo Administration Tools (CES7) by default on [coveoserver]:8081. Simply navigate to Configuration >> Security >> Roles. Then select your user and give the Full Access permission. For more information, please read: https://onlinehelp.coveo.com/en/ces/7.0/administrator/about_administration_roles.htm Also, a quick search on search.coveo.com would have told you everything: https://search.coveo.com/#q=you%20do%20not%20have%20permission&amp;sort=relevancy Now that this is solved, you will be able to see the permissions tab in the detail section of your document in the Index Browser, with this, you will be able to know who has access to your document. On the query side, use the CES Console to view the permissions on the user at query time, then compare with the information you have on the document in the index browser. Now a common issue is when no permissions are applied on the documents, this is a normal behavior of Coveo when it encounters a failure while refreshing the securities. It will simply deny everyone to avoid a security leak. What kind of failure you will ask? Well a security cache refresh failure is a common one. The cache refreshes by default every day at midnight server time. You can manually refresh it to test : https://onlinehelp.coveo.com/en/ces/7.0/administrator/refreshing_security_caches.htm Keep the good old CES Console open during the refresh an you will see the errors in bright red. From there you should be able to see the cause of your issue.
Coveo permission error - "You do not have the permissions to view the document properties" Currently Coveo is returning zero results. When I looked into Admin interface, I see all documents now say You do not have the permissions to view the document properties. Earlier this was not the case. Only difference I see is, we now have workflow/security roles applied on items. Although site is still accessible to anonymous user, only content editing security rules applied. Coveo indexing still uses admin login to index item as per configuration settings. How to troubleshoot this? Things I've tried so far: - Updated security cache - Deleted indexes and rebuild again from scratch Using Coveo for Sitecore 3.0 and CES 7.0 8388 with Sitecore 8.1 update 3.
This is possible - when creating a language you don't need to specify the region. You can pick a language, Sitecore will fill the region but you may clear it: When doing so, you will end with a language list similar to this:
Can a site's default language be something other than English, without specifying a region? Has anyone deployed a site with a default language other than English? That is, just the language w/o the region. I've only ever seen /en and all other languages appear to need language AND a region. We have multiple localised sites but would like to have a site that is the language ONLY (or country ONLY). For example, we have three sites translated into Arabic. But our regional contact would like these to be English by default with the option to choose Arabic. A simple solution to this would be to have a single Arabic site that these country sites can link to - www.oursite.com/ar - is this doable? Even Microsoft has specified in the past that language without country or region is valid: https://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo(vs.71).aspx We've already explored having English versions of these sites but as we discovered, this isn't an easy task since there are no pre-defined language options for these Arabic-speaking countries. One other idea we had was specifying a region such as the Middle East or Latin America as a site for the entire region with individual countries added as needed. It looks like Apple does something this for the Latin America region by having a Spanish site for all of Latin America: http://www.apple.com/la/ It also has an English version for this entire region: http://www.apple.com/lae/
A pretty simple solution would be to replace the OOTB webedit:addrendering command with your own custom command that automatically creates a datasource item at the specified datasource location. The command you are replacing is the below: <command name="webedit:addrendering" type="Sitecore.Shell.Applications.WebEdit.Commands.AddRendering, Sitecore.ExperienceEditor" patch:source="Sitecore.ExperienceEditor.config"/> Some considerations: You will want to prevent the Select Rendering Datasource dialog from popping up, since the datasource will have already been created To support multi-location Datasource Location field values, you may want to default your rendering to use the first specified location Anytime you use this command, you are forcing the author to create a new datasource without giving them the option to reuse an existing one, so you may want a way to turn that off or to limit your command to only run its custom logic for certain renderings. You may need to create a cleanup task for unused datasource items that were auto-created but never used, in case authors add renderings and then decide to change the datasource to an existing one
Create datasource when a rendering is added to the page I have seen in SXA that when I add a rendering to the page, it automatically creates a datasource item for the rendering when it adds it to the page. This helps the user not have to create a datasource item each time the rendering is added. Is there a simple way to accomplish this?
The root cause of the timeout was infrastructure related. At this moment the IT team within the client is working to pinpoint exactly what the problem was. SQL server was having difficulties to communicate well with the sitecore QA server(not yet sure why maybe firewall rules) but installing sql server within the QA server and running the upgrade package it took 10 minutes and completed without problems.
Problems while installing an update package I'm upgrading sitecore from 8.0 update 3 to update 7. I have already used this package while upgrading locally with no issues. when I install this package(Sitecore 8.0 rev. 160115.update) using the update installation wizard page on a QA server two strange things happen: When it's 10% of processing it starts taking a few seconds to process each item(it's almost 7240 items to process) so this is taking hours to process a package that I already installed locally and it took a few minutes. At some point it timeouts out. I guess the timeout one has to do with this slowness in processing so I guess the question here is how do we increase the timeout in this case? Also the CPU on the server is not reaching 10% of usage while processing the package. Anyone know possible reasons for both cases? UPDATE 1 Here is the log for when the installer times out (didn't find anything useful on it :|) : ManagedPoolThread #3 01:03:13 INFO Job ended: Core_Database_Agent (units processed: ) ManagedPoolThread #16 01:03:13 INFO Job started: Master_Database_Agent ManagedPoolThread #16 01:03:13 INFO Scheduling.DatabaseAgent started. Database: master ManagedPoolThread #16 01:03:13 INFO Examining schedules (count: 4) ManagedPoolThread #16 01:03:13 INFO Starting: __Task Schedule ManagedPoolThread #16 01:03:13 INFO Ended: __Task Schedule ManagedPoolThread #16 01:03:13 INFO Not due: Calculate Statistical Relevancy ManagedPoolThread #16 01:03:13 INFO Not due: Rebuild Suggested Tests Index ManagedPoolThread #16 01:03:13 INFO Not due: Try Finish Test ManagedPoolThread #16 01:03:13 INFO Job ended: Master_Database_Agent (units processed: 4) 4328 01:06:21 ERROR Application error. Exception: System.Web.HttpException Message: Request timed out. 5876 01:11:20 INFO HttpModule is being initialized 4216 01:11:20 INFO HttpModule is being initialized Heartbeat 01:13:05 INFO Health.PrivateBytes: 0 Heartbeat 01:13:05 INFO Health.CacheInstances: 117 Heartbeat 01:13:05 INFO Health.CacheTotalCount: 38,989 Heartbeat 01:13:05 INFO Health.CacheTotalSize: 90,721,502 Heartbeat 01:13:05 INFO Health.Counter(w3wp, Process\Private Byte UPDATE 2 RAM is around 35% of usage. Also the server which is running sql server has low cpu and memory usage while the installation happens. XDB has been disabled as well UPDATE 3 After increasing the ping as suggested by Hishaam it timed out here is the logs of when it happened: ManagedPoolThread #13 12:38:22 INFO Job started: Sitecore.ListManagement.Analytics.UnlockContactListsAgent ManagedPoolThread #13 12:38:22 INFO Job ended: Sitecore.ListManagement.Analytics.UnlockContactListsAgent (units processed: ) 6100 12:38:28 ERROR Application error. Exception: System.Web.HttpException Message: Request timed out. ManagedPoolThread #19 12:38:32 INFO Job started: Sitecore.ListManagement.Analytics.UnlockContactListsAgent Complete log here UPDATE 4 When it throws the timeout exception I noticed that right about it there is this message: Exception details: System.Exception: History path is not set at Sitecore.Update.InstallUpdatePackage.SaveInstallationMessages() at Sitecore.Update.InstallUpdatePackage.Install() at Sitecore.Update.InstallUpdatePackage.InstallPackage(MetadataView view) at Sitecore.Update.InstallUpdatePackage.OnLoad(EventArgs e) One interesting thing is that there is a link to download the log errors and when I hover it I see it pointing to a directory that does not exist(I'm within the server). But if I got to the website/temp/__UpgradeHistory/Upgrade_Failutre_dateoftoday, I see a folder with two files: 1 is the log of all items processed and the other one is a message.xml which is empty. Decompiling the Sitecure.Update.dll this is what it looks like: public string SaveInstallationMessages() { string installationHistoryRoot = base.InstallationHistoryRoot; bool flag = this.EnsureHistoryPath(ref installationHistoryRoot); string str = Path.Combine(installationHistoryRoot, "messages.xml"); FileUtil.EnsureFolder(str); using (FileStream fileStream = File.Create(str)) { (new XmlEntrySerializer()).Serialize(this.logMessages, fileStream); } if (!flag) { throw new Exception("History path is not set"); } return str; } Anyone see this? The file gets generated but without messages. maybe it has to do with the whole problem.
Find your theme item (/sitecore/media library/Project/Tenant/Site/Site Theme) and check following check boxes: This will add following css classes to the page body element: header-wide content-wide footer-wide so your footer, header, content placeholders will have full width.
How can I make a component take up the full width of the screen? I've got my content in my website, ready to be styled by my designer. The first thing that they want to do is make the menu take up the full width of the screen. The appears to be something in the 960 grid that keeps the page from consuming the full width of the available screen real estate. Here's an example of what my page currently looks like: (The background is white, but if you click on the image, you can see that the webpage is not using the full width of the screen.) My designer told me that they could fix it, but that they would have to override some of the built-in CSS classes that come with the 960 grid, or that I'd have to put the content that I want to be "full-width" outside of the standard <div> containers (i.e.<div id="header">, <div id="main">). I can't find a way to put my components outside of the main <div> containers, and I'm not sure that it using SXA the right way, even if I could do that. How are we supposed to allow for a component to span the full width of the screen?
This looks like a Sitecore Media Cache issue, and not a Glass.Mapper issue. The reason I say this is that the Glass.Mapper expression cache cannot persist between application recycles, as the cache is stored in an in-memory dictionary. By default, the Sitecore Media Cache is stored on disk, so those entries can persist for a while (and by default, it looks like they last for 90 days before being cleaned up) My recommendation would be to clear out the media cache, (located here Website\App_Data\MediaCache\) and see if that solves your issue.
How to clear Glass lambda cache? We have an issue with resizing images where the old dimensions are getting cached--I think in Glass' lambda cache. I'm trying to figure out how to clear it once we update an image. The cached value has persisted across multiple app pool recycles, recompiles, and iisresets. So say we have an image that's 1400x700 pixels. We get a new source image that's a more reasonable 500x250, so we go into the media library and attach the new version. This updates the Height and Width fields on the Sitecore item as expected. We publish the new image and view the page to discover it now has a black box around it. The image is the new 500x250 version, but the cached lambda expression is still passing the old dimensions to the .ashx. The RenderImage call was originally in the format RenderImage(x => c.CurrentItem.Image, ...), which we then changed to RenderImage(x => Model.CurrentItem.Image, ...) and then RenderImage(Model.CurrentItem, x => x.Image). All three exhibited the same behavior, even with an iisreset in between. I've also tried disabling the cache per Mike Edwards' answer here: Disabling the Glass lambda cache. Which, of course, makes me wonder if it's the lambda cache at all, although I'm at a complete loss for another explanation. I am using Sitecore 8.1.
Rendering parameters are stored in Sitecore as a query string eg: param1=value1&amp;param2=value2 etc.... And this query string is stored as an attribute on an XML node in the __Renderings or __Final Renderings field on the context item, like this: <r uid="{91C058E4-4307-4391-98B2-A7629FF9C729}" p:before="r[@uid='{6717EAA7-0931-46D9-8E89-21678756C012}']" s:id="{2152C804-3AD4-44B4-BC3E-9215018C8B17}" s:par="Advert Placement=%7B6F568FE1-FBD3-4685-B133-4EFACC0192FE%7D" s:ph="main" /> Because of this, it makes it not a good place for fields like a Rich Text field. It really should be limited to simple fields/links etc... It is not a good idea to store page or module content in those fields either. You will not be able to reuse the content anywhere else. It would only be available to that one component. Also if you removed the component, the content would get removed also. You can already edit the rendering parameters via the Edit Component Properties dialog - so your fall back is in place. To be able to edit the parameters in line, you would have to add elements to your markup when PageMode.IsExperienceEditor is true. You would then also need to hook into the save button in the Experience Editor and use the values in your custom fields to build a query string and store that in the __Final Renderings field of the current context item against the correct component XML node. From a content editors POV, I would say it makes more sense keeping the rendering parameters on the component properties dialog and not using many at all. For me, rendering parameters should only be used to define unique presentation variants for the component being added to the page and not have anything to do with the content being rendered.
Inline editing of rendering parameters in Experience Editor I'm investigating multiple solutions for being able to dynamically build a page using multiple blocks of HTML, and other non-structural content. I'm trying to optimise the editing experience and minimise any creation of superfluous Items in the tree. My more general question this and other approaches to this problem can be found here: What is the recommended pattern for dynamic paragraph systems in Sitecore? I'm currently looking into versioned rendering parameters, but I'm not able to find any documentation on in place editing of those parameters on the page. Ideally, I'd like to use the Rich Text Editor in place, just like the field editing experience. Having a dialog would a less desirable fallback. Does anyone know if this is possible? I am using Sitecore 8.1.
You could use Plain HTML rendering for that. Example datasource content: Result: Summary: This is the easiest way to inject small js parts (I would not call this elegant way). However if you want make true rendering you should consider creating it from the beginning. Good start is to take a look how Facebook Comments and Disqus renderings were implemented. There are already few answers which covers renderings: Adding new section in SxA toolbox Create controller rendering in SXA Anyway, creating rendering with that specific requirements is not necessary SXA related. SXA doesn't blocks you from using your standard approaches. I would say it is easier as you already have theming in place where you can add css and js files.
How do I embed a custom audio player on my SXA website? I have a requirement to play audio files on my website. I need to use a custom player (called by JavaScript) in order to make that happen. I don't see any way to create a component that allows me to push out custom javascript. Is there a pre-built component that allows me to insert a custom javascript/player? If not, what is the recommended way to create this in code?
I can tell you that List Manager has issues. There is a Hot Fix for List Manager that assists with many of these issues, but the one I'm thinking of is for EXM 3.3. I would be surprised if Sitecore support didn't have a hotfix for 3 4. I would log a Sitecore Ticket and ask if there is a fix for EXM 3.4 that is similar to hotfix EXM 3.3 135707. Reasons why the list gets stuck Large lists over 200K recipients take hours to complete. It actually takes only about an hour or two to actually get to the point where the list is indexed (assuming [email protected] usable by EXM) But a bug in Sitecore (assuming for now) either doesn't update the count appropriately (an index 0 vs 1 issue maybe) or the last step is extremely inefficient. If during the list creation process, Sitecore restarts, there is no restart logic built into List Manager for picking the creation of a list back up. And the list stays "locked" forever. You can fix this by using raw values in Content Editor to empty the Bulk Operation Field, and then setting the Recipients field equal to the number indexed, which is showing in the list (in List manager). Benefits of the Hotfix Provides ability to disable list locking. This can improve the overall experience of List Manager Numerous bug fixes to EXM. Better memory utilization of List Manager. List Completion Issue is still Open My ticket to Support for why this process takes so long is still open. Once I know of a resolution or have a reference number, I'll edit this answer.
Building contact list does not complete I'm exploring EXM 3.4 on an 8.2 rev. 160729 instance and for a simple test mail I imported an existing CSV file which threw constantly an error about an empty listId. Then I manually created a new list and created a contact in the ListManager application. Now the list is being built but never completing. The message it displays is 'Currently building list. Contacts will be viewable when complete". Please note that this list is currently being built and is locked. Please note that contacts in the list are currently being indexed, so not all contacts are available to view at this time. 1 out of 1 contacts are currently indexed. Any ideas where it might be stuck? I don't see anything special in the log files.
I eventually found the source of the mapping problem. I was unaware that we were using a GlassMapper extension that automatically handles spaces in fields names. For example: public virtual string ItemTitle { get; set; } Would automatically try to map to the field Item Title. By naming my fields without spaces in my template I inadvertently broke the logic in the GlassMapper extension so the fields were never able to resolve correctly. By changing the fields in my template to add spaces, I fixed the issue.
Glassmapper Fields always map to NULL for one model I have a series of Infographic Items being added to a Infographic Container. The Infographic Container Model is as follows and works just fine: namespace MyNamespace { [SitecoreType(AutoMap = true)] public class InfographicContainerViewModel : BaseTemplateViewModel { public virtual string InfographicTitle { get; set; } public virtual string Description { get; set; } } } For my Infographic Item Model I've done essentially the same thing, but the fields are always mapping to null. Stepping through the debugger, I can see that the item itself is being mapped to correctly (Correct IDs, name, ect.) and the item is in the correct language. My first ideas were to add in the Template ID to the SitecoreType attribute and place the names of the fields in the SitecoreField attributes, but neither resulted in a correct mapping. Here is my Infographic Item Model as it stands now: namespace MyNamespace { [SitecoreType(TemplateId = "{5E6DF63A-0327-4587-8E72-AB35A7184200}", AutoMap = true)] public class InfographicItemViewModel : BaseTemplateViewModel { [SitecoreField("ItemTitle")] public virtual string ItemTitle { get; set; } [SitecoreField("ExpandedTitle")] public virtual string ExpandedTitle { get; set; } [SitecoreField("ExpandedDescription")] public virtual string ExpandedDescription { get; set; } } } Here is a screenshot of the debugger where you can see the fields mapping to null: And here is a screenshot of the template as it exists in Sitecore: Does anyone know what could be going on here?
When you create the item directly from the model GlassMapper has no way of knowing if the values of the item's properties are to be overwritten by the standard values or if you intended them to be null/empty. What you want is to first create the item by specifying a parent and a name for the new item. var itemName = "My new item"; var item = SitecoreContext.Create<IItem, IParentItem>(parent, itemName); The model of the new item is the first type parameter. The template for the new item is also inferred from this type parameter (IItem in this case) assuming it has been mapped correctly specifying its template ID (or branch ID) - otherwise you will get an exception. This new item will now have any standard values set and you can change any values as you please and then save those changes. item.SomeProperty = "Some value"; SitecoreContext.Save(item);
Creating Glassmapper Models Programmatically with Standard Values Is there no standard way to incorporate/ consider a template's standard values when creating a Glassmapper model programmatically? This is all I can find online, but it seems that you have to rename an object just to consider standard values: https://stackoverflow.com/questions/26674102/how-to-apply-standard-values-to-an-item-created-with-glass-mapper
With no obvious way of making Sitecore do our bidding, and me not finding any IIS configuration way of achieving this - I opt for a third solution. Enter a HttpModule to achieve this. Function is fairly simple. Outgoing, any SC_ANALYTICS_GLOBAL_COOKIE will get removed and our own MY_COOKIE added, with the same value. Ingoing, any incoming MY_COOKIE will result in a SC_ANALYTICS_GLOBAL_COOKIE getting added. Code looks like this: namespace Website.CookieRenamer { public class CookieRenamerModule : IHttpModule { public void Init(HttpApplication context) { context.BeginRequest += Context_BeginRequest; context.PostRequestHandlerExecute += Context_PostRequestHandlerExecute; } public void Dispose() { } private void Context_BeginRequest(object sender, EventArgs e) { var application = (HttpApplication) sender; var context = application.Context; var trackingCookie = context.Request.Cookies["MY_COOKIE"]; if (trackingCookie != null) WebUtil.SetCookieValue("SC_ANALYTICS_GLOBAL_COOKIE", trackingCookie.Value); } private void Context_PostRequestHandlerExecute(object sender, EventArgs e) { var application = (HttpApplication) sender; var context = application.Context; var trackingCookie = context.Response.Cookies["SC_ANALYTICS_GLOBAL_COOKIE"]; if (trackingCookie != null) { WebUtil.SetCookieValue("MY_COOKIE", trackingCookie.Value); context.Response.Cookies.Remove("SC_ANALYTICS_GLOBAL_COOKIE"); } } } } It gets configured in the <system.webServer> section of Web.config like this: <add type="Website.CookieRenamer.CookieRenamerModule, Website" name="CookieRenamer" /> And the desired end result comes out like this. Rename cookie as appropriate.
Rename SC_ANALYTICS_GLOBAL_COOKIE Is there a way to rename the Sitecore cookie SC_ANALYTICS_GLOBAL_COOKIE? Wappalyzer identifies a Sitecore site via this cookie, and we would like to stop it from doing so, whilst retaining the behaviour associated with the cookie.
If your controller inherits fromt the GlassController<T> then you have access to several properties and methods to access either the context item or the datasource item. Item ContextItem Item DataSourceItem Item LayoutItem ContextItem just returns Sitecore.Context.Item. DataSourceItem returns the specified data source item. LayoutItem returns the data source item if it isn't null, otherwise the context item. Besides those you have the following matching methods and properties. The properties casts to the type parameter specified in GlassController<T> while you can specify the type for the methods. // Properties T Context T DataSource T Layout // Methods T GetContextItem<T>() T GetDataSourceItem<T>() T GetLayoutItem<T>() GlassController<T> also has a RenderingContextWrapper property where you have access to the current data source value and rendering parameters. You of course also have access to the SitecoreContext property.
Best practice for implementing a controller rendering using GlassController I'm looking for best practices to implement a Controller Rendering using glass mapper and TDS code-generation. I've read and liked this approach https://www.akshaysura.com/2016/08/01/tihidi-implement-a-simple-controller-rendering-in-sitecore-mvc/ but I'm wondering if GlassController has a native way to access the rendering context as Sitecore API does with RenderingContext.Current.Rendering.Item How are others creating the Controller Renderings using glass?
You should try to avoid denying access (just because of the fact that deny gets preference over all) - it's not a good practice. It's better to break the inheritance to remove access. This way, your "grant" will work again as there is no "deny" anymore to remove it. You can find more information here and specifically on the use of inheritance here. That last page should be very interesting for your case as it covers that (and similar) scenario's with examples.
Security setup - member of two roles with different access I have an extranet where, by default, I've denied permissions to the whole tree to the anonymous account to ensure a login. One of the subitems is content only for staff who have access, rather than general members. However, people can be assigned to both the Member and Staff roles. On my item, I've got Members denied access and Staff granted access, which means if you're assigned to both, you're denied access. Is there any way to invert this, or another way of doing the permissions to accomplish the goal? I would think this a common scenario...
You can follow the steps on this link. But basically this is what you need to do: Navigate to IIS, and open the Sitecore site. Browse the folders and select Coveo’s main folder. With the Coveo folder selected, click Authentication on the right side. Choose Windows Authentication and select disable, then choose Anonymous and select enable. Go back to the left panel, navigate to modules > Web > Coveo folder And do the same thing. This should take care of your issue
Coveo with windows authentication on sitecore site I have Windows Authentication on the IIS of sitecore site (for limited external access). Coveo is running remotely on another server. When trying to run Coveo diagnostic tool, I see the 401 error in Coveo Security Service. System.Net.WebException: The remote server returned an error: (401) Unauthorized. at System.Net.HttpWebRequest.GetResponse() at Coveo.SearchProvider.Applications.StateVerifier.<>c__DisplayClass16.<GetWebServiceState>b__15() at Coveo.SearchProvider.Applications.BaseVerifier.VerifyComponent(Func`1 p_VerifyMethod, String p_ComponentName) I've tried to follow this other post on how to configure this but I am running into same issue. The CES service is running on an AD account (domain/username) that has access to sitecore site's IIS. I am able to login using the same AD account. Any ideas what else I should be configuring to make this work?
The MediaRequestProtection is there for good reason - so I would go out of your way to ensure that it's used (otherwise your site is vulnerable to an attack vector). The media protection uses the width, height and other properties to calculate the hash (so they're tied to the hash you have) so it's not a surprise that modifying the URL doesn't work. You need to generate the whole URL in code. RenderImage is Glass I think? You can add width and height etc using the Glass mapper method: @RenderImage(x=>x.Image, new {w = 50, width=50}, outputHeightWidth:true) For more details about GlassMapper's parameters see here - if GlassMapper isn't generating your hash - check you're on the latest version and then let the guys at GM know :) Is there a chance that (with MediaRequestProtection disabled) - the image is already cached on your machine from looking at it with MRP enabled? I would try it without the hash value at all when you're testing with MRP disabled. By default - the following parameters are protected (so you can't change them without regenerating the hash: <protectedMediaQueryParameters> <parameter description="width" name="w"/> <parameter description="height" name="h"/> <parameter description="max width" name="mw"/> <parameter description="max height" name="mh"/> <parameter description="scale" name="sc"/> <parameter description="allow stretch" name="as"/> <parameter description="background color" name="bc"/> <parameter description="database name" name="db"/> <parameter description="ignore aspect ratio" name="iar"/> <parameter description="language code" name="la"/> <parameter description="thumbnail" name="thn"/> <parameter description="version number" name="vs"/> <parameter description="content database" name="sc_content"/> <parameter description="content language name" name="sc_lang"/> <parameter description="context site" name="sc_site"/> <parameter description="grayscale filter" name="gray"/> </protectedMediaQueryParameters> There's some information about how you can generate a new hash on this useful blog post. Notably: in C# code, you can use HashingUtils.ProtectAssetUrl(url) to get the full media URL with hash included.
Image Not Being Resized Properly (Sitecore 8.1 rev 160519) We are in the beginning stages of a site and so there is very little custom code introduced at this point. I've noticed that images are not being resized properly. I originally thought the hash was not being applied properly, but that turned out to not be the case. I've tested this in two ways: Disabled Media Request Protection Altered a generated URL After disabling Media Request Protection, I assumed I could simply alter an image by appending h or w to the query string as such: http://URL/-/media/Home-Page/images/careers-icon.ashx?h=200&amp;mh=175&amp;mw=175&amp;w=175&amp;hash=BAB30E6E5E518F898DFE7D3C726658814B46BA46 However, the image is not resized. When I leave Media Request Protection turned on and modify a URL, e.g.: http://URL/-/media/Home-Page/images/careers-icon.ashx?h=200&amp;mh=10&amp;mw=175&amp;w=175&amp;hash=BAB30E6E5E518F898DFE7D3C726658814B46BA46 I receive the proper log message: 6720 12:46:46 ERROR MediaRequestProtection: An invalid/missing hash value was encountered. The expected hash value: AE578A561DA323EEC4F7324CB154DBB9BA6B8924. Media URL: /-/media/Home-Page/images/careers-icon.ashx?h=200&amp;mh=10&amp;mw=175&amp;w=175&amp;hash=BAB30E6E5E518F898DFE7D3C726658814B46BA46, Referring URL: (empty) As you can see, I've also tried setting the max width and max height attributes as well, to no avail. Is this a known bug in our Sitecore version? As stated, this is a pretty vanilla install at this point.
You could do something like the following: Sitecore.Context.PageMode.IsNormal &amp;&amp; Sitecore.Context.Site.Name == "website" Obviously, you would want to replace "website" with the name of the site that you are looking for, if different. You could, of course, enhance this solution to support comparing the sites in another way, as well or you could invert the solution by saying: Sitecore.Context.PageMode.IsNormal &amp;&amp; Sitecore.Context.Site.Name != "shell" This will resolve the issue you described, by returning false if in the Content Editor, but the better solution would be to match directly against the site you are looking for, if possible.
Most reliable way to detect if running in live site? Normally we do things like Sitecore.Context.PageMode.IsExperienceEditorEditing to detect if the experience editor is running. I want to do something similar, but detect if the live site is running instead. I found Sitecore.Context.PageMode.IsNormal, but this also returns true from within Content Editor. What's the best way to achieve this?
I ended up doing the following: Create a separate IIS site pointing to original site's directory. Allow anonymous access on it Update ServerUrl path in Coveo.SerchProvider.config to new site Set hostname on the server appropriately On CES server, added hostname for new site With this when indexing, Coveo is able to bypass authentication on sitecore instance by hitting the 2nd site. And since they share same DBs and files, it seems to be indexing correctly.
"The remote server returned an error: (401) Unauthorized" Error while accessing item binary data in Coveo with Windows Auth I have Windows Authentication on the IIS of sitecore site (for limited external access). Coveo is running remotely on another server. When trying to access item binary data p_Args.CoveoItem.BinaryData from <coveoPostItemProcessingPipeline> I get 401 error. Is there a way to pass credential when accessing this item? Error thrown my processor: ManagedPoolThread #10 17:35:49 ERROR An exception occurred while trying to fetch the HTML content of the document http://ca.site.com/en/page-to-index. Exception: System.Net.WebException Message: The remote server returned an error: (401) Unauthorized. Source: System at System.Net.HttpWebRequest.GetResponse() at Coveo.SearchProvider.Processors.HtmlItemContentFetcher.FetchItemContent(String p_Url) at Coveo.SearchProvider.Processors.HtmlContentInBodyWithRequestsProcessor.Process(CoveoPostItemProcessingPipelineArgs p_Args)
Here is a low complexity way of checking using Sitecore PowerShell Extensions. The solution is not very polished, but gets the job done. First I wrote a script to check inheritance and saved it to a script library. X-Demo/Content Editor/Context Menu/Check Inheritance Close-Window function Get-SiteConfiguration { param( [string]$Name ) [Sitecore.Sites.SiteManager]::GetSite($Name).Properties } function Get-SiteName { param( [item]$Item ) $itemName = $Item.Name [Sitecore.Configuration.Factory]::GetSiteInfoList() | Where-Object { $_.RootPath -eq "/sitecore/content" -and $_.StartItem -eq "/$($itemName)" } } $sites = Get-SiteName -Item (Get-Item -Path .) $inheritedName = $null $siteName = $null foreach($site in $sites) { $siteName = $site.Name $siteConfig = Get-SiteConfiguration -Name $site.Name foreach($setting in $siteConfig) { if($setting.Key -eq "inherits") { $inheritedName = $setting.Value break } } } if($inheritedName) { Show-Alert "The item has a parent site of '$($siteName)' which inherits from '$($inheritedName)'." } else { Show-Alert "The item has a parent site of '$($siteName)'." } Second I added a simple rule so the check only works when you select the home item. Now when I see this context menu script and alert message. Checking /homeinherited Checking /home Perhaps not the most elegant solution, but for zero downtime and in the time it took to eat a bowl of cereal it gets the job done; looking for an icon may have taken all night though. This solution is essentially what Dmytro suggested but without the need to deploy compiled code on the server.
How to Check Site Configuration Inheritance I often use the inherits attribute of the <site> configuration node to make one site inherit another. Today, another SSE question made me ask myself how I can check to see if the context site inherits a specific site. I tried to find something in the Sitecore API for this but came up empty. Does anyone know if there is a way to check if a site inherits another, aside from directly grabbing the Node from configuration and checking the attribute manually?
I believe that this has been possible out of the box since Sitecore 7.2 (I've seen it in use but never implemented it myself). The Sitecore article for this for Sitecore 7.2 is here - a more up to date version can be found here. Notably: A workflow state definition item has a 'Preview publishing targets' field, designating the targets an item may be published to before the final state If no publishing targets are selected, items in the state cannot be published ahead of the final state. Publishing targets have a new 'Preview publishing target' checkbox. Items checked with this will be available as options in the workflow state (default unchecked) If an item is not in the final workflow state but is in a state which has one or more preview publishing targets set, the editor warning informs the user what targets the item may be published to.
How to use workflow to control which targets an item is publishable to Is it possible to use workflow to control which publishing targets an item can be published to? I guess you could write a custom workflow action which would programmatically alter the publish targets, but is there some built-in way, or perhaps a better solution? Ideally, I would like a preview workflow state which would allow publishers to the web DB and then a final state which allows publishing to the webCD DB.
The best way to do this is for each element on the page to be a separate rendering with its own data source item. The page item should have minimal content from its own fields. Things like the Title and Meta, include in sitemap or robots.txt rules. When a rendering is added to a page (Can be as simple as a single 'content' placeholder in the main Layout) the datasource can be selected or created at that time. Renderings can include their own inner placeholders to provide more flexibility. I would recommend using Dynamic Placeholders in these cases. If your data is organized into template specific folders and your renderings have the appropriate Data Source Template and Data Source Location values, this operation is actually pretty smooth. Workflow of rendering data source items can be managed with this module: https://marketplace.sitecore.net/Modules/D/Data_Source_Workflow_Module.aspx?sc_lang=en I also set up my renderings with some extra help text or formatting when Sitecore.Context.PageMode.IsExperienceEditorEditing == true so it is easier to edit a newly created item within Experience Editor. You can also set the presentation of the page template standard values to give it some default renderings and data sources.
What is the recommended pattern for dynamic paragraph systems in Sitecore? It's not at all uncommon to have an article page designed that is intended to be dynamically formed from a number of components: <rich text> <left image with additional comment> <rich text> <image gallery> <rich text> ... etc The gallery might be reusable, and thus point to an existing item, but the rich text certainly is not intended to be. This can't be approached out of the box, since the rich text field needs to render a field, so each instance will simply render the same text. What is the recommended pattern to achieve this? I see three possible solutions: Create a data source item for each component This can be done out of the box if the author creates the data source items manually, but doing so is so arduous that it's no longer worth using the Experience Editor at all. It's possible to automate this, which is effectively what Adobe Experience Manager does, but in Sitecore it involves custom code to dynamically create the item when a rendering is added to the page. There's also no way to skip the "select data source" dialog, so the editing experience is disjointed. Having implemented this method, I can also vouch for it being particularly painful with regard to workflow and publishing since the state of each data source needs to be kept in sync with the page. Allow selection of renderings within the Rich Text Editor This method was outlined by John West back in 2010 and involves using custom pipelines to include renderings embedded within a Rich Text Editor. I'd say this approach would take a fair amount of work to get right to avoid the WYSYWG editor accidentally allowing, for example, a rendering inside a <p><strong> tag. Considering there has been not much discussion of this method since that blog post, and John takes pains to state that it's not supported, it's safe to assume that this is not considered best practice. There are almost no upsides to this approach. Include the rich text as a Rendering Parameter In this approach the rich text is kept in a rendering parameter via a Rendering Parameter Template. This is, more or less, how Umbraco 7 solves this problem. In theory this could work, since Final Layout in SC8+ is versioned so it can be localised. It makes it impossible to share the content elsewhere, and may require index customisations, but those might be acceptable. Richard Seal recommends against this approach in my question around this approach. Restrict the UX This is the "Sitecore can't do that" option. Obviously not ideal, since people pay for expensive CMSs so they can have flexible control over their site's content.
If I understood your question right, you want to handle a particular rendering R1 based on the underlying Sitecore layout selected for the page item The below screenshot shows how to get the layout information from the current rendering: Here's a code sample that gets the current layout name: Guid layoutId = Sitecore.Mvc.Presentation.RenderingContext.CurrentOrNull.Rendering.LayoutId; Item item = Context.Database.GetItem(new ID(layoutId)); string layoutName = item["Name"];
Is there a way to identify current layout details with renderings? I got a scenario where I have different layouts Layout1, Layout2, so on...I have a renderings which is shared among this layouts. Layout1- Rendering -R1 Layout2-Rendering-R1 and so. Now I have situation where I want to identify the layout name or details within this rendering R1. I know this is not good idea still is there any way to refer the details of layout within renderings.
As Hdvti mentioned I've seen this when you have xDB enabled. As a workaround disable it in short term using the following patch file and then re-move the patch file after you have installed any modules: <?xml version="1.0" encoding="utf-8"?> <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <settings> <setting name="Xdb.Enabled"> <patch:attribute name="value" value="false" /> </setting> <setting name="Xdb.Tracking.Enabled"> <patch:attribute name="value" value="false" /> </setting> </settings> </sitecore> </configuration>
Sitecore Update Installation Wizard never ends Currently I have Sitecore 8.0 Update-1 and I want it to upgrade to 8.2. So as per the 8.2 upgrade guide, prerequisites for running this update is Sitecore 8.1 rev. 151003 (Initial Release) or later. So I first decide to upgrade my current Sitecore 8.0 to 8.1. As per the 8.1 upgrade guide, I have started to install the Sitecore Update Installation Wizard 1.0.0 rev.150930 but this update installation wizard never ends. I have tried 3 times. One wizard took more than 24 hrs but it never ends. I am following the upgrade guide (Sitecore 8.1) step by step but still facing this issue. Please help me on this.
The obvious answer would be, to just update the field to NVARCHAR - from an application layer perspective, nothing in Sitecore should really care about this. That said; I understand the reasons for not wanting to do this. Your alternative then, becomes to convert in and out of Unicode when adding and getting keys. There are a number of ways to achieve this; I propose BASE64. Encode public static string Base64Encode(string plainText) { var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText); return System.Convert.ToBase64String(plainTextBytes); } Decode public static string Base64Decode(string base64EncodedData) { var base64EncodedBytes = System.Convert.FromBase64String(base64EncodedData); return System.Text.Encoding.UTF8.GetString(base64EncodedBytes); } And you would then need to update your code. IDTableProvider provider = GetProvider(); var entry = new IDTableEntry(prefix, Base64Encode(key), id, parentID, customData); provider.Add(entry); And also when getting, obviously. Base64 snippet sourced here: https://stackoverflow.com/questions/11743160/how-do-i-encode-and-decode-a-base64-string edited to add You could of course write your own version of Sitecore.Data.SqlServer.SqlServerIDTable and configure it here. I've never done it, and it seems way too much work for what it would be worth. <IDTable type="Sitecore.Data.$(database).$(database)IDTable, Sitecore.Kernel" singleInstance="true"> <param connectionStringName="master" /> <param desc="cacheSize">2500KB</param> </IDTable> You would need to override the following methods: public override void Add(IDTableEntry entry) public override void Add(IDTableEntry entry) public override IDTableEntry GetID(string prefix, string key) public override IDTableEntry[] GetKeys(string prefix, ID id) public override IDTableEntry[] GetKeys(string prefix) public override void Remove(string prefix, string key) Doesn't seem worth it, in my opinion.
Storing URLs with greek characters in the IDTable I have some code which stores custom URLs in the IDTable. I am experiencing an issue with a site using the Greek language (el-GR) when part of the URL contains Greek characters e.g. χρώμα. My code contains the following where the variable key contains the string "χρώμα": IDTableProvider provider = GetProvider(); var entry = new IDTableEntry(prefix, key, id, parentID, customData); provider.Add(entry); When reading the IDTable entry back out of the table I get "???µa". I looked at the code in dotPeek and found that Sitecore is doing a regular insert from the add method, so I tried doing something directly in SSMS: UPDATE [dbo].[IDTable] SET [Key] = 'χρώμα' WHERE ID = '{205DBEAC-B679-4CC8-804C-90AF6201EDB2}' And I got the same result, so the issue must be in SQL Server. I noticed that the field type is varchar(255) rather than nvarchar(255) which I'm assuming is the reason for the problem. Is there any way to work around this limitation, perhaps encoding the string before saving/adding to the IDTable?
Configuring a dedicated Content Management server Normally, pure CM servers should not read and write interactions and contacts in the collection database. See this official documentation page for more information: Configure a content management server The easiest fix for you would be to disable the Sitecore.Analytics.Tracking.Database.config. In any case, make sure to follow the configuration documentation to the letter. Combined server roles Your CM can also be combined with another server role. In that case, keep in mind that if the CM doesn't share session databases with your CDs, then it must be considered a part of a separate cluster. This means that it should have the setting Analytics.ClusterName set to a different value. Further reading: Configure a content delivery server Clustered server environments
Cannot finish Analytics page tracking I have the following exception appearing in my log files at a rate of 2-3 per second. ERROR Cannot finish Analytics page tracking Exception: Sitecore.Analytics.Exceptions.ContactLockException Message: Failed to extend contact lease for contact c276821d-a524-419c-8bb5-7a952d1bb319 Source: Sitecore.Analytics at Sitecore.Analytics.Tracking.ContactManager.SaveAndReleaseContact(Contact contact) at Sitecore.Analytics.Pipelines.EndAnalytics.ReleaseContact.Process(PipelineArgs args) at (Object , Object[] ) at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) at Sitecore.Analytics.Pipelines.EndAnalytics.EndAnalyticsPipeline.Run() at Sitecore.Analytics.Pipelines.HttpRequest.EndAnalytics.Process(HttpRequestArgs args) The contact Guid is the same every time. I've found a blog post that describes a similar error, but we're not calling Tracker (or any Sitecore.Analytics code) explicitly in our solution.
No, Sitecore doesn't provide it out of the box, but it's designed to be extended for this purpose. I usually use save actions to send data to third parties: It's pretty simple, as wffm gives you the values of the form, and you just has to implement you logic there. You can find out how here You need to create a class that implements ISaveAction. The entry point will be the method Execute. Then create an item under System/Modules/Web Forms for Marketers/Settings/Actions/Save Actions and add the class and dll Usually, I check: Can I make it asynchronous? I don't want the users to be waiting for the third party. Do I need to support errors? In this case, it must be syncronous and handle error messages. Do I need to interact with the third party with different calls? I try to use it for simple calls, if we have to implement several calls or a lot of logic, I just get the values in the actions and queue it to be processeed somewhere else.
With WFFM can you post to an external url? I know WFFM can save data internally, but I need to post data to a third party provider, does WFFM support this out of the box, or do you need to extend WFFM? Are there any concerns with WFFM and posting to an external system?
Thanks for the answers. Turns out the issue was down to configuration on the Dynamics side. I tried with a free trial of Dynamics 365 and was able to connect successfully with the connection string I displayed originally
Sitecore CRM Connect 1.1 Issues connecting to MS Dynamics I'm currently following the configuration guide for Crm Connect v1.1 and the instructions seem to cover connecting to a web based instance of Dynamics but not an on premise instance via AD. The following link runs through setting the connection string http://integrationsdn.sitecore.net/DynamicsCrmConnect/v1.1/getting-started/add-crm-connection-string.html I've set my connection string accordingly and now have connectionString="url=http://{server_ip}:{port}/XRMServices/2011/Organization.svc;Domain={AD_Domain};user id={username};password={password};authentication type=2" When testing the connection string, I receive the following error The request for security token could not be satisfied because authentication failed. The previous documentation on CRM Connect indicated that the authentication type for AD should be 0, but this goes against the recommendation in the docs (and doesn't work anyway) Anyone have an example of a connection string that works for CrmConnect 1.1 when connecting via AD ?
In your code, $site will be of the type Sitecore.Data.Items.BaseItem, so it has all the standard API available. You can achieve the desired behavior like this: $settings = $site.Axes.GetDescendants() | ? { $_.TemplateName -eq "Settings" } | select -first 1 if($settings -eq $null) { # create settings etc } If performance is important for you, you can use Fast Query: $query = "fast:" + $site.Paths.Path + "//*[@@templateid='{your-template-id-here}']" $settings = Get-Item master: -Query $query | select -first 1 Note that I used the ID of the template instead of its name. This reduces the need for SQL joins and makes the query much faster.
Sitecore PowerShell Extensions get descendant of an item using a template I'm writing an SPE script and am looping over my site nodes. For each site node, I want to check if a particular descendant exists and if not then create it. I have the list of top-level nodes, but cannot figure out how to query each of those nodes for a descendant. If I was writing in regular query syntax, I could write something like this: var sites = database.SelectItems("fast:/sitecore/content/Master/*[@@templatename='Website']"); foreach (var site in sites) { var settingsItem = site.Axes.SelectItem("descendant::*[@@templatename='Settings']"); //now check if SettingsItem is null, if so create etc } What I have in my SPE script: #get the list of top-level site nodes $sites = Get-Item master: -Query "fast:/sitecore/content/Master//*[@@templatename='Website']"; foreach ($site in $sites) { # get descendant of each $site item that inherits from "Settings" template $settings = ??? if ($settings == null) { #create settings item etc... } }
Reports are not a part of default SPE module package. To get it: go to marketplace Sitecore Powershell Extensions module download: Authorable Reports for SPE 4.2 (assuming you are using SPE 4.2) Once you install this package you will see additional button in the PowerShell Toolbox You will find more info about this feature in this video: Unofficial Sitecore 8 Training Webinar Series - Session 5, where Michael West describes what you can do with that and why this is not a part of default package.
Turning on Index Viewer for SPE I have really given it a go before I posted here, but I am trying to turn on the Index Viewer for SPE. The gitbook doco says it exists, shows it not being in the menu, but no info on how to put it in the menu. Can someone lead me in the right direction to enable it. Thank you. https://doc.sitecorepowershell.com/modules/integration-points/toolbox
You can try using the following project with your Sitecore solution. https://github.com/olegburov/Sitecore-Azure-Diagnostics/ It adds a custom logger to log4net, which writes Sitecore's diagnostic data into Azure Blob Storage using Append Blob. Another option is to upgrade to the latest and greatest Sitecore XP 8.2 Update-1, where a new logger powered by Azure Application Insights comes out of the box.
Sitecore Logging into azure blog storage in JSON format We have a requirement to log all the errors/warnings on to Azure Blog Storage in JSON format (with specific structure) including the sitecore generated ones. This will enable us to use any third party log analyzer such as sumo logic. I had a look at this Sitecore Logging (Log4Net) Log to Database as Well as Text Files which is specific to SQL Database. Would be good if you could share the solutions that's been implemented in production as there were performance issues with storing logs on to blog storage a while ago (2 years).
By the time the below code is accessed in Controller/View Rendering, any personlization rules are applied. So, the DataSource and Item properties point to the the datasource are the personalized ones configured for the rule that is applied. Sitecore.Mvc.Presentation.RenderingContext.Current.Rendering.DataSource Sitecore.Mvc.Presentation.RenderingContext.Current.Rendering.Item Below code shows how to get the RuleList xml and pull the default DataSource out of it. string text = rendering.Properties["RenderingXml"]; if (string.IsNullOrEmpty(text)) { var renderingReference = new RenderingReference(XmlExtensions.ToXmlNode(XElement.Parse(text)), <contextlanguage>, <contextdatabase>); var DefaultDataSource = renderingreference.Settings.DataSource; } Once the Rendering reference is obtained, the default datasource can be pulled from its Settings.DataSource property. The order of DataSource for the rendering will be DataSource selected in the Action section of Rule that is applied The order of Default DataSource will be DS selected in the Action section If Action Section is empty, then DS selected from Rendering Parameters If none of them are set then RenderingReference.Settings.DataSource is empty. But the actual Rendering DataSource set to PageItem
Is it possible to fetch datasource and personalized content of context item? Context Item- mypage -- Presentation ----Controller Rendering -R1 with datasource value -D1 -----R1- Personalize Content.D2 How do I refer both these data content and get it rendered in given page context? Let me know if queries or require more explanation.
As the relationship between Microsoft and Sitecore gets closer and closer, I think its definitely in the road map. The first person I heard about doing it was Sitecore George. https://twitter.com/sitecoregeorge/status/784151818385457152 https://blogs.perficient.com/microsoft/2016/10/using-azure-documentdb-with-sitecore-xdb/ I think its definitely in the future. Some bits for you to try https://github.com/mathieu-benoit/azure-documentdb-for-sitecore
Documentdb in sitecore future release as xdb and analytics database Is there any direction sitecore going to support documentdb as analytics database platform and go away from mongodb?
DISCLAIMER: This is possible, yet untested and is a very non-standard way of using xDB. It may potentially lead to strange errors and you'll have no idea where they are coming from or how to fix them. Use at your own risk. End the session First, you'll need to end the current session: Session.Abandon(); This will make ASP.NET start from scratch by allocating a new session on the user's next request. The current session will be ended and the current interaction will be saved to the collection DB. Unlock the contact Note that, although the xDB contact will be saved to the xDB after the previous step, it will not be immediately unlocked in the collection database. There will be a certain time period before the xDB shared session expires. If you want that to happen immediately, try using the following code: Guid contactId = Tracker.Current.Contact.ContactId; // ... defer ... ContactManager contactManager = Factory.CreateObject("tracking/contactManager", true) as ContactManager; contactManager.SaveAndReleaseContactToXdb(contactId); Make sure that you don't execute this code directly in a page request, as xDB's request and session end pipelines will expect the contact to still be present in the shared session. So, to be on the safe side, you'll need to defer the execution of SaveAndReleaseContactToXdb until ~30 seconds later. Unset the contact cookie Finally, you'll need to make sure that the user is not recognized as the same contact on the next request. The recognition is done based on the cookie SC_ANALYTICS_GLOBAL_COOKIE that holds, among other values, the ID of the contact. You can invalidate this cookie by setting its expiration date in the past: HttpCookie contactCookie = new HttpCookie("SC_ANALYTICS_GLOBAL_COOKIE"); contactCookie.Expires = DateTime.Now.AddDays(-1); Response.Cookies.Add(contactCookie);
Sitecore xDB logout contact and continue browsing as anonymous I'm trying to logout the current visitor/contact from the website. What I want to achieve is to save all the current information into xDB and then let the visitor to continue on the website as Anonymous. What are the steps to achieve this?
If you haven't made any changes to the default config files (which you shouldn't - patch them with your own configs instead), then yes, that should be fine. Changes to Web.config would probably still have to be done manually, as you usually make some changes to that file depending on your solution. With upgrades I like to just delete the whole App_Config/Include folder and add all the configs from a clean Sitecore install. This way you also get rid any files that should be delete, if any, and start clean. Then deploy/publish your solution afterwards.
Config files change while upgrade sitecore 8.0 Currently, I have Sitecore 8.0(update 1) site and I want it to upgrade it to update 2. I am following the 8.0 Update-2 Upgrade Guide. In this guide, there is a step of Apply the configuration file changes described in Sitecore 8.0 rev. 150223 (Update-2) Configuration File Changes document. Except following this step(making changes in the config file as per Configuration File Changes document) can we just replace config files with the files which we get from Config Files for Sitecore XP 8 Update2.zip folder from https://dev.sitecore.net/Downloads/Sitecore_Experience_Platform/8_0/Sitecore_Experience_Platform_8_update2.aspx
The default scope With Microsoft DI, the Scoped lifetime will default to a request scope in ASP.NET. https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection#service-lifetimes-and-registration-options Scoped Scoped lifetime services are created once per request. ... Scoped objects are the same within a request, but different across different requests Sitecore reinforces this behavior in a custom HTTP module defined in the Web.config: <add type=&quot;Sitecore.DependencyInjection.SitecorePerRequestScopeModule, Sitecore.Kernel&quot; name=&quot;SitecorePerRequestScopeModule&quot; /> So the biggest scope in Sitecore is a request scope. That is the scope used by Sitecore.DependencyInjection.ServiceLocator and by Scoped services injected into your controllers and processors. Custom scopes If you wish, you can manually define smaller scopes: using Microsoft.Extensions.DependencyInjection; using Sitecore.DependencyInjection; // ... IServiceScopeFactory scopeFactory = ServiceLocator.ServiceProvider.GetService<IServiceScopeFactory>(); using (IServiceScope scope = scopeFactory.CreateScope()) { // request and use services here using scope.ServiceProvider ISomeContract service = scope.ServiceProvider.GetService<ISomeContract>(); } The IDisposable.Dispose() method ends the scope lifetime. Once Dispose() is called, any scoped services that have been resolved from scope.ServiceProvider will be disposed.
Sitecore Dependency Injection - Registering services with the lifetime of a web request How can I register a service with "PerWebRequest" lifetime using the native Sitecore DI? I can imagine I need to play around the Scoped lifetime and set the default scope to Web Request somehow? Did anyone try to do that?
Sitecore Powershell Extensions comes with a script which will return you all the items with security information on them. You can filter the data to specific path and select one account you are interested in. You will get the information in form of a report. You can also have a sneak peak into the script which should be in /sitecore/system/Modules/PowerShell/Script Library/Content Reports/Reports/Content Audit/Items with security for an account More information about the cmdlets UPDATE In case you would like to do this programmatically you can execute SQL query on the database: SELECT * FROM [Sitecore_master].[dbo].[SharedFields] where fieldid = '{DEC8D2D5-E3CF-48B6-A653-8E69E2716641}'
Determine Access rights for a role I'm having trouble finding a good way to determine the Access Rights for a given role. Is there a easy way to get a list of items, that a given role have been granted access to, without iterating the entire content tree?
There is already a notification bar show in Experience Editor mode when editing the Shared Layout of the page, but you have to select the Presentation tab before the notification will show. In any case, you can use the IsEditAllVersionsTicked() helper available in Sitecore.ExperienceEditor.Utils.WebUtility to return whether Shared Layout is being edited. Custom Editor Notification You can create a custom editor notification to always show the current layout mode, similar to the existing notification: using Sitecore.Diagnostics; using Sitecore.ExperienceEditor.Utils; using Sitecore.Globalization; using Sitecore.Pipelines.GetPageEditorNotifications; namespace MyProject.CMS.Custom.Pipelines { public class GetPageEditorNotifications : GetPageEditorNotificationsProcessor { public override void Process(GetPageEditorNotificationsArgs arguments) { Assert.ArgumentNotNull(arguments, "arguments"); if (arguments.ContextItem == null) return; bool editingSharedVersion = WebUtility.IsEditAllVersionsTicked(); if (editingSharedVersion) { arguments.Notifications.Add(new PageEditorNotification(Translate.Text("You are editing the SHARED layout of this page. All the changes you make to the shared layout will be applied to all versions of this page in every language."), PageEditorNotificationType.Warning)); } else { arguments.Notifications.Add(new PageEditorNotification(Translate.Text("You are editing the FINAL layout of this page. Any changes you make to the final layout will only be applied to the current version of this page in the current language."), PageEditorNotificationType.Information)); } } } } Patch this into your config: <pipelines> <getPageEditorNotifications> <processor type="MyProject.CMS.Custom.Pipelines.GetPageEditorNotifications, MyProject.CMS.Custom" /> </getPageEditorNotifications> </pipelines> Removing Existing Editor Notification You need to deal with the existing rendering information bar displayed for Shared Layout. You can do this by editing /sitecore/shell/client/Sitecore/ExperienceEditor/Commands/SelectLayout.js and updating the canExecute method to return false: canExecute: function (context) { return false; }, Alternatively, override the pipeline responsible for checking the Layout mode when switching to the tab and set the return value to false. <sitecore.experienceeditor.speak.requests> <request name="ExperienceEditor.IsEditAllVersionsTicked" type="Sitecore.ExperienceEditor.Speak.Ribbon.Requests.Common.IsEditAllVersionsTicked, Sitecore.ExperienceEditor.Speak.Ribbon" /> ... </sitecore.experienceeditor.speak.requests>
Show Info is Shared or Final Layout in The Experience Editor on the Site For usability issues I would like to show in the Experience Editor (Sitecore 8.1 rev. 151207) if the User is currently working in the Shared or Final Layout because it is only visible in the Presentation Menu which layout is selected at the moment. Is there a easy way to get the value which is obviously available in the ribbon?
This is a known issue and it was fixed in version 3.3 Please check the release note of EXM 3.3 https://dev.sitecore.net/Downloads/Email%20Experience%20Manager/Email%20Experience%20Manager%2033/Email%20Experience%20Manager%2033%20Initial%20Release/Release%20Notes Tokens are encoded in email subject. (75647)
Ampersand in email subject line appears encoded The name of my client's company contains an ampersand, they use EXM for an email campaign. The issue they are having is that the ampersand appears as &amp;amp; instead of &amp; Tries to enter the following in the subject line field of EXM: Tom &amp; Jerry Tom &amp;amp; Jerry Tom %26 Jerry Tom &amp;amp;#38 Jerry all render as: Tom &amp;amp; Jerry Any idea?
If all of your sites point to different items, here's what you can do: $sitePath = $site.Paths.FullPath.Trim().ToLower() $siteInfo = [Sitecore.Configuration.Factory]::GetSiteInfoList() | ? { ($_.RootPath.Length -gt 0) -and $sitePath -eq ($_.RootPath + $_.StartItem).ToLower() } | select -first 1 if($siteInfo -ne $null) { $language = $siteInfo.Language # ... } If your $site items can have multiple site definitions bound to them, then you have to use the language of the item: $language = $site.Language.Name
Sitecore PowerShell Extensions switch context language based on site context language I have a script which loops over different sites in a Sitecore instance. For each site some tasks are done, such as creating and moving items. How can I set the language context for these operations based on the language set in the config for the current site (if this is not feasible, I would settle for using the language of the current item). $sites = Get-Item master: -Query "fast:/sitecore/content/Master//*[@@templatename='Website']"; foreach ($site in $sites) { #determine the correct language of the $site item based off the sites configuration setting }
The purpose of this file is allow clients who are operating on Oracle to have a default installation file for connecting to these databases. Unlike Sitecore 'Include' patch files, it does not need to be disabled/enabled because it's use is driven by the reference in the Web.config file (as mentioned by @Dražen Janjiček). There will be no issue if you leave this file in your App_Config folder, unless you update the Web.config file to point at it.
Why ConnectionStringOracle.Config Enable by default in sitecore We are using MSSQL db for all the databases(core,master,web) in sitecore, but I can see the ConnectionStringOracle.Config is enabled by default in App_config folder. Sitecore 8.1 Update-2 <?xml version="1.0" encoding="utf-8"?> <connectionStrings> <!-- Sitecore connection strings. All database connections for Sitecore are configured here. --> <add name="core" connectionString="user id=sccore;password=sccore;Data Source=XE" /> <add name="master" connectionString="user id=scmaster;password=scmaster;Data Source=XE"/> <add name="web" connectionString="user id=scweb;password=scweb;Data Source=XE"/> </connectionStrings> Is there any purpose for this and if we leave this like this will there be any issue?
This is a normal behaviour in Sitecore, you need to add agents for schedule task on CD. You need to add in your config files : <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> <!-- adjust the value according related infrastructure --> <sitecore> <scheduling> <agent name="Web_Database_Agent" type="Sitecore.Tasks.DatabaseAgent" method="Run" interval="24:00:00"> <param desc="database">web</param> <param desc="schedule root">/sitecore/system/tasks/schedules</param> <LogActivity>true</LogActivity> </agent> </scheduling> </sitecore> </configuration>
Sitecore Scheduled Task not working on a CD server I am accessing Sitecore from staging and configured a schedule task. Staging has the following databases configured: master, web --> for staging live --> db for cd1/cd2 server. The scheduled task is working on staging but not on cd1. How can I solve this?
However, I've recently saw instances identical to mine where the name of the item stayed the same as the original item and the display name was set to what was entered in the dialog box. This is confusing to users as they then have 2 items with the same name. from the above text you have mention in your question, what I understand was you are expecting Content Editor Tree should display the Name of the item. But, by default it is displaying the "Display Name" of the item if it exists. for example, when I enter a display name to my home item, it will look like below And when a duplicate item is created, the Name entry box value will be used as Item Name of new Item. "Display Name" of the new item will remain same. Is that the issue you are taking about ??
Duplicating an item sets the name but display name stays the same When duplicating an item in the content tree, a modal box appears to define the Name of the new item. From my experience, the text typed in this box is set as the Name of the new item. However, I've recently saw instances identical to mine where the duplicate item had the same text as the original item in the content tree. The only difference being the text between brackets ([]) in the right panel. This is confusing to users as they are not sure which item to choose from the content tree. The setup I am using is Sitecore 8.0 Update-5 + Launch Sitecore 8012 WebForms. This is the same setup on which I've seen the display name behavior. What can explain this behavior of the duplicate item command? EDIT/solution: I was confused between the Name and the Display Name at the time of asking the question. I edited the original question for clarity. It included the following sentence originally: I've recently saw instances identical to mine where the name of the item stayed the same as the original item and the display name was set to what was entered in the dialog box. It turns out the Name was really set to what the user entered in the dialog box. The name of the item is displayed between brackets in the right panel when selecting an item from the content tree. What was identical between the 2 items is really the Display Name, displayed in the content tree. As you can see in the accepted answer, the reason for the different behavior is that I did not have a Display Name on the original item but the other people had one.
Answers 1) Yes, that will get out of control. You are actually implementing your own implementation for faking the Sitecore database. There already exists a solution for this: https://github.com/sergeyshushlyapin/Sitecore.FakeDb. I really recommend using this. From the github page: This is the unit testing framework for Sitecore that enables creation and manipulation of Sitecore content in memory. It is designed to minimize efforts for the test content initialization keeping focus on the minimal test data rather than comprehensive content tree representation. edit: added extra information on how FakeDb works: FakeDb substitutes Sitecore providers with fake "in-memory" providers to avoid calls to database or configuration. The providers do not replicate real Sitecore behavior, but are used mainly as stubs with minimal logic. They can be replaced with mocks in unit tests using the provider switchers. So you can just write your code like you want it to. And don't have to implement an interface. 2) Your assert is ok. I don't know what type PathId is. If it is an int then its definitely ok. Important note You are using a Setting called FolderId. For your unit tests to work you must either: 1) add your configuration to the App_Config folder of your unit test project which could be a hassle to maintain configs in your actual website project and your unit test project. 2) mock the setting as shown in the code example below. General tips: When Unit Testing for Sitecore, I would recommend starting with these packages to make your life a little bit easier: FluentAssertions (.NET extension methods) XUnit (Unit testing tool) Sitecore.FakeDB. Please note that when using FakeDB, you'll need to apply a license.xml file: https://github.com/sergeyshushlyapin/Sitecore.FakeDb/wiki/Installation The listed packages can all be installed through Nuget. Also, instead of referencing Sitecore dll files directly, you could use Nuget to fetch the package with the depenencies you need. You can read more about this on the Sitecore Documentation site: https://doc.sitecore.net/sitecore_experience_platform/developing/developing_with_sitecore/sitecore_public_nuget_packages_faq I create my unit tests with the AAA pattern: Arrange: setup, initialize everything Act: invoke method(s) Assert: validate result Example code public class NameUtility { private readonly string _folder = Settings.GetSetting("FolderId"); public virtual Path FindById(long id) { var folder = Database.GetItem(new ID(_folder)); var paths = folder.GetChildren().Select(child => child.GlassCast<Path>()); return paths.SingleOrDefault(path => path.PathId == id); } } [TestClass] public class NameUtilityTests { //XUnit Fact attribute [Fact] public void FindById_WithId_ReturnsPath() { //Create your database for the test with the Sitecore.FakeDb.Db class using (var db = new Db { //Arrange //create an item with a name (and optionally an id and template id) new DbItem("FolderName") { //you can set specific fields for the item, all values are strings. //You'll need to set the PathId here! { "Title", "Testing the Id" }, { "PathId", "123456789" } } }) { //Setup configuration db.Configuration.Settings["FolderId"] = Guid.NewGuid().ToString(); //Create instance var sut = new NameUtility(); //Act sut.FindById(123456789); //Assert Xunit.Assert.Equal(sut.PathId, 123456789); } } } Possible additional improvements rename method to FindByPathId: you are searching by PathId, not just an id folder variable could be null and your code will fail when calling GetChildren. You can write a unit test for this. SingleOrDefault could return null. You can write a unit test for this. Hope this helps!
How to get started with Sitecore Unit Testing with SitecoreFakeDb I'm trying to find the correct approach to begin unit testing the piece of code below: public class NameUtility { private readonly string _folder = Settings.GetSetting("FolderId"); public ISitecoreDatabase Database {get;set;} = new SitecoreDatabase(); public virtual Path FindById(long Id) { var folder = Database.GetItem(new ID(_folder)); var items = folder.GetChildren().Select(child => child.GlassCast<Path>()); return paths.SingleOrDefault(path => path.PathId == Id); } } I'm quite new to unit testing so I chose the simplest utility I could find in order to test. This is the start of what my unit test looks like: [TestFixture] public class NameUtilityTests { [Test] public void FindById_WithId_ReturnsPath() { var nameUtility = new NameUtility(); nameUtility.Database = new FakeSitecoreDatabase(); var path = nameUtility.FindById(1); Assert.AreEqual(1, path.PathId); } internal class FakeSitecoreDatabase : ISitecoreDatabase { public Item GetItem(ID id) { throw new System.NotImplementedException(); } } } //Code below is from the Code Under Test assembly. public interface ISitecoreDatabase { Item GetItem(ID id); } public class SitecoreDatabase : ISitecoreDatabase { private readonly Database _database; public SitecoreDatabase() { _database = Sitecore.Context.Database; } public SitecoreDatabase(Database database) { _database = database; } public Item GetItem(ID id) { return _database.GetItem(id); } } So I have a couple of questions and I'll explain my thought process first. FindById currently depends on Sitecore.Context.Database which wouldn't work for Unit Tests so we've used SitecoreFakeDb instead. I haven't implemented the GetItem method, but the idea would be that I setup an instance of SitecoreFakeDb with the item(s) and then the CUT should be able to fetch the item by id. 1) However to test this code I need to be able to substitute Sitecore.Context.Database with an instance of the FakeDb. For this, I've created ISitecoreDatabase and then it has methods like GetItem() and all its overloads that the default (actual) Sitecore db would implement as well as the FakeDb. Wouldn't this begin to get out of control as far as how many methods that interface would have? 2) When asserting against the final object, in this case I'm asserting that the object returned has a field with the same Id as what I expect. Is this a valid approach, or is the better approach to compare the entire actual object with an expected object?
In Sitecore, the best fit for your requirements would be to use item hierarchies. Define 3 data templates: Event, Event Date and Event Session. Restrict what can be inserted under items of each template. Under an Event, you'd only want to insert Event Date items. Under an Even Date, only Event Session items. This can be restricted using Insert Options on each template's Standard Values. The Event rendering you'll create should take an Event item as its data source. You'll be able to traverse the item hierarchy and display the event, it's dates, and all sessions. You can also make all of their fields editable in the Experience Editor. As a result, content authors will be able to create events with multiple dates, with multiple sessions in each date.
Sitecore 8 is it possible to have multiple/dynamic fields in one template I am developing a dynamic calendar application within a Sitecore instance, and the User case would be.. Creation of Event (from and Event Template), Choose multiple dates, and multiple sessions on that date from within the creation of that Event item. My question is simply... Using an Event Template, is it even possible to create multiple and even dynamic fields for the Content Author to choose from ? (I am mostly looking to learn if Sitecore has the capacity and if so how)
Unit testing Your question says that your tests are unit tests, so first I'll talk about a proper unit testing approach. Such tests should be run in isolation, meaning that your module shouldn't rely on data coming from a Sitecore database. You should provide mocks for all data consumed by code under test. To make this possible, you'll need to ensure that the module does not rely on static context. Instead, it should employ Dependency Injection to obtain dependencies. In this case, the module should be injected with Glass.Mapper.Sc.ISitecoreContext and use it for all Glass operations. Here's an example: public class SomeModule { private readonly ISitecoreContext _sitecoreContext; public SomeModule(ISitecoreContext context) { this._sitecoreContext = context; } public void SomeMethod() { // ... IEnumerable<Item> pathItems = ...; var paths = pathItems.Select(child => this._sitecoreContext.Cast<Path>(child)); // ... } } Then in the Unit test code you will instantiate the module with a mock implementation of ISitecoreContext passed into its constructor. You can either create your own mock implementation (it's pretty easy), or you can use mocking frameworks, such as NSubstitute, Moq, FakeItEasy or Rhino Mocks. Integration testing Tests that actually get data from an external storage are not considered unit tests, they are called integration tests. To make tests run outside of a Sitecore page context, you will need to manually create some dependencies, such as the Glass ISitecoreContext, and pass them into the module being tested. This means you should still apply exactly the same approach (as if you were unit testing) to the design of SomeModule—it should accept ISitecoreContext as a constructor argument and use it for accessing Sitecore data. The only difference will be that your test code will inject a real context instance into the module. Here's how you can do it: // Prepare the environment if (Glass.Mapper.Context.Default == null) { var config = new Glass.Mapper.Sc.Config(); var dependencyResolver = new Glass.Mapper.Sc.IoC.DependencyResolver(config); Glass.Mapper.Context.Create(dependencyResolver, "Default", true); } // Create the Sitecore context Database db = Factory.GetDatabase("master"); var sitecoreContext = new SitecoreContext(db); // Instantiate the module and use it var module = new SomeModule(sitecoreContext); module.SomeMethod();
Glass Mapper set Sitecore Context I am receiving the following error using Glass Mapper System.Collections.Generic.KeyNotFoundException : The given key was not present in the dictionary. at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at Glass.Mapper.AbstractService..ctor(String contextName) at Glass.Mapper.Sc.SitecoreService..ctor(Database database, String contextName) at Glass.Mapper.Sc.ItemExtensions.GlassCast[T](Item item, Boolean isLazy, Boolean inferType) Here are the details of my configuration. I'm using a unit test project that has the same Glass Mapper version installed as the project it tests. My GlassMapperScCustom.cs in the Unit Test Project is below: public static class GlassMapperScCustom { public static void CastleConfig(IWindsorContainer container) { var config = new Config(); container.Install(new SitecoreInstaller(config)); } public static IConfigurationLoader[] GlassLoaders() { return new IConfigurationLoader[] { }; } public static void PostLoad() { } } Additionally, I have GlassMapper.Sc.Mvc.config in the App_Config folder and that is the only one. The exception above occurs when the Code Under Test (CUT) calls the following line: var paths = pathFolder.GetChildren().Select(child => child.GlassCast<Path>()); Based on what I've searched online, I need to be able to set the SitecoreContext in order for GlassMapper to work correctly. How and where would I do that; in the unit test project or the CUT project? Or is this some other issue entirely? Edit: Here are the Glass Mapper versions: <package id="Glass.Mapper" version="3.0.13.25" targetFramework="net461" /> <package id="Glass.Mapper.Sc" version="3.2.2.45" targetFramework="net461" /> <package id="Glass.Mapper.Sc.CastleWindsor" version="3.2.1.23" targetFramework="net461" /> <package id="Glass.Mapper.Sc.Mvc-5" version="3.2.1.42" targetFramework="net461" />
I can think of two options to solve your issue: Create some custom code to make a "query" possible together in the datasource. Luckily for you that is already been done and well documented. Unfortunately as Jammykam correctly pointed out, this won't completely fix your as the TreeList can only accept one parent node. So this would actually come down to a complex version of option2. You could however try to write your own field (based upon a treelist), but that might take some more customization. But you're lucky again! There is another Kam, and he shared some code to do exactly that: a multi-root treelist. Use the ootb options, with one path but by using the IncludeTemplatesForDisplay and IncludeTemplatesForSelection. This might get a good result, but it depends on the templates used in folder1 and folder2. Assuming your template1 and template2 are used for folder1 and folder2 (and no others on that level), you could set Datasource=/sitecore/content/home&amp;IncludeTemplatesForDisplay=template1,template2,datasourcetemplate&amp;IncludeTemplatesForSelection=datasourcetemplate. Note that I included datasourcetemplate (the template of the source you want to be selected) in templates to display and to select (to make them visible and selectable). Remark: option "1" was edited after jammykam's comments (thx for the correction). I'll kept part of the text to make the comments not completely weird. And then shifted the solution from one kam to the other :)
Set sitecore treelist datasource from multiple paths Trying to set datasource for a treelist field in Sitecore. Need to set two different folders as path. DataSource=/sitecore/content/home/folder1|/sitecore/content/home/folder2 It does not work, it sets home node as starting path. Also tried IncludeTemplatesForSelection=template1,template2 Datasource=/sitecore/content/home&amp;IncludeTemplatesForSelection=template1,template2
An alternative to @Gatogordo's option is to use a modular approach to JavaScript using something like requirejs. I wrote a post about using requirejs to organize your js with Sitecore a while a go. The basics are: Setup RequireJS Setup require, this uses a pretty standard require config. The main.js can be: require.config({ baseUrl: "/assets/js", paths: { jquery: "vendor/jquery.min", "jquery.migrate": "vendor/migrate", "jquery.mobile.events": "vendor/mobile.events", "jquery.royalslider": "vendor/jquery.royalslider", }, shim: { "jquery.migrate": { deps: ["jquery"] }, "jquery.mobile.events": { deps: ["jquery"] }, "jquery.royalslider": { deps: ["jquery"] }, } }); // Now run any initialization javascript for the site: require(["jquery"], function($) { // Init code here }); Here I have added some dependencies that were used on my project. You can customize those dependencies as you need too. Now add the script to the top of your layout. Its important that its at the top. Note this will not cause blocking because of the nature of how requirejs loads the js files async. <script src="path-to-requirejs-main-file/require.js"></script> <script src="/assets/js/main.js"></script> Now you can create your components by creating a require AMD module. The basics for a require module is that you define the dependencies and return the function. E.g: define(["jquery", "jquery.royalslider", "jquery.mobile.events"], function($) { var BasicSlider; return BasicSlider = (function() { function BasicSlider(options) { this.options = options; this.options = $.extend({}, this.defaults, this.options); this.initSlider(); } DetailCarousel.prototype.defaults = { element: "#basicSlider", }; DetailCarousel.prototype.initSlider = function() { // TODO: Initialise the slider here }; return DetailCarousel; })(); }); Now in your razor script for your Sitecore rendering you can simple require that module in: <div class="slider"><!-- Slider Html Structure Here --></div> <pre> <script> require(["jquery", "modules/slider"], function($, Slider){ new Slider({ element: '.slider' }); }); </script> Pros/Cons of this method The main benefits of this method are that your js is loaded modularly, just like your Sitecore components are. Only the JS needed for the particular page is downloaded to the client, so it can save some bandwidth and some processing on the browser as it doesn't need to parse anything that is not being used. In Http 1.1 this method can be problematic. If you have lots of modules, you can get delays while the files are downloaded the first time. With Http/2 this is not so much of an issue. RequireJS is not the only JavaScript module loader out there. In ES6 modules are becoming part of the language and there are pros/cons to each module loader so you would have to work out what works best for your project. For more information on why AMD Modules are good, look here Why AMD?. Should you use it? TLDR; If you have a small site with minimal JavaScript - webpack it all into a single file and minify that. If you have a large complex site with many JS modules, RequireJS can make maintaining and writing the client side much easier.
How to Render Javascript per page or component? So I have renderings that depend on specific CSS or specifically Javascript. Do you load the same Javascript on all pages even if the Javascript is for a specific page/rendering, or do you pull in the resource dependencies a different way? What if you want the page to bundle and minify all the javascript/css, would you use the same method?
Coveo does not offer grouped search results. It offers facets to drill down search results. Folding is used when you have a parent and child search results (model/variants, email thread, business/locations...) which is not your case. Coveo is a relevance platform. Coveo believes the most relevant information will be returned in the first 3 search results, whatever its template, type or source. This, of course, requires proper indexing with the content of the documents. It can also require a few query ranking expressions (QRE) to boost the content you want to highlight if it's not returned first. If you have your index in Coveo Cloud, you should really use Coveo Reveal Automatic Relevance Tuning (ART) feature which will automatically boost/insert search results based on previous visitors' successful searches. This basically eliminates the need to manually analyze click-through rate, click rank, queries without results and queries without clicks and manually adjust the indexing/boosting from time to time. It learns from previous visitors and improves the relevancy of search results for future visitors. If I failed to convince you against separating the result templates and you really really need to do it, you can do it with multiple Omnibox Result List components. Each will filter the results on a specific template and ask for fewer results (e.g.: 3 each). But then, each time a user types in the search box, multiple queries will be triggered. It will perform slower, will put more load on your index (may need more resources if you are on-premises) and will use your monthly query limit faster.
Group results using OmniboxResultsView How to get grouped results with SearchBoxView and OmniboxResultListView? I've added those 2 components on the page along with SearchViewResources and was able to get results as I type in SearchBoxView. Now I need to get these results grouped by template so that I can style them accordingly in OmniboxResultsView. I've looked into Folding but I am confused as to how to use it with OmniboxResultsView. Any tips or examples will be really helpful.
You cannot. When Sitecore executes any job, it runs <job> pipeline defined in Sitecore.config (or web.config in older versions). This pipeline has SignalStart and SignalEnd processors, but the only thing they do is logging the information that job started or finished: public static void SignalStart(JobArgs args) { Job job = args.Job; job.Status.LogInfo("Job started: {0}", job.Name); } public static void SignalEnd(JobArgs args) { Job job = args.Job; string str = string.Empty; if (job.Status.Processed > 0L) str = job.Status.Processed.ToString(); job.Status.LogInfo("Job ended: {0} (units processed: {1})", job.Name, str); } You can do what you need manually by analyzing the log files (see https://sitecore.stackexchange.com/a/1234/277 ) or you can add your own custom processors to the pipeline mentioned above and store this information in some other place / database / whatever suits you best.
Get last time job ran date/time I have a very basic question and only because I haven't been able to find any reference or source for it. In Sitecore, how can I programmatically get the last run date/time of a job that is configured in the web.config or another config file? I had opened another question like this 2-3 years ago but the suggestions there don't really provide any help. Any help or guidance is appreciated!
The Problem You cannot. Not out of the box at least. What happens is; your branch template looks like this: Branch Root (ID1) |_Subitem (ID 2) |_Subitem (ID 3) And on the Branch Item, you select 1 or more of the Subitems. This means, on Branch Item, the Multilist field holds ID 2 and ID 3 as value. Now you go and create content based on this Branch. Your new content will get created, and look like this: Concrete Item (ID4) |_Subitem (ID 5) |_Subitem (ID 6) But - and here's the kicker - The Multilist field will still hold ID 2 and ID 3 as value. Sitecore does not remap internal references on this field (or any) when creating the branch. The Sitecore &quot;out of the box&quot; story ends here. The Solution To solve it, you need a job that replaces references when creating items based off of Branch Templates. And you only want references replaced, when the items being referenced are within scope of the Branch Template items themselves. Fortunately, this is what Alen Pelin's SmartCommands does (reference: https://bitbucket.org/sitecore/sitecore-smart-commands) - except these only work for Copy, Clone and Duplicate. They can be extended however. Set it up Create a file, BranchCommand.config and place it in App_Config\Include. <configuration xmlns:patch=&quot;http://www.sitecore.net/xmlconfig/&quot;> <sitecore> <events> <event name=&quot;item:added&quot;> <handler type=&quot;Website.Events.ItemAdded.UpdateLinks, Website&quot; method=&quot;OnItemAdded&quot;> <param desc=&quot;async&quot;>false</param> </handler> </event> </events> </sitecore> </configuration> Then some code to bind this event into SmartCommands (you must have the SmartCommand code in your project as well, download from above). UpdateLinks.cs public class UpdateLinks { private readonly bool isAsync; public UpdateLinks() { isAsync = false; } public UpdateLinks([NotNull] string async) { Assert.ArgumentNotNull(async, &quot;async&quot;); isAsync = string.Equals(async, &quot;true&quot;, StringComparison.OrdinalIgnoreCase); } [UsedImplicitly] public void OnItemAdded([CanBeNull] object sender, [NotNull] EventArgs args) { Assert.ArgumentNotNull(args, &quot;args&quot;); var contentItem = Event.ExtractParameter(args, 0) as Item; Assert.IsNotNull(contentItem, &quot;targetItem&quot;); var branchItem = contentItem.Branch; if (branchItem == null) { return; } var item = branchItem.InnerItem; Assert.IsTrue(item.Children.Count == 1, &quot;branch item structure is corrupted: {0}&quot;.FormatWith(AuditFormatter.FormatItem(item))); var branch = item.Children[0]; if (isAsync) { ReferenceReplacementJob.StartAsync(branch, contentItem); } else { ReferenceReplacementJob.Start(branch, contentItem); } } } And from here, the SmartCommands ReferenceReplacementJob takes care of the rest. The code for that and the rest of SmartCommands would be too extensive to include here. Source for ReferenceReplacementJob. I've used exactly this approach on a number of production solutions - it is tested and it does work as expected - but it will require some elbow grease to get working in your solution.
Pre-selected multi list fields in Branch Templates I have created a template with multi list type field. I have create a branch template to enforce child element to this multi list. I have set data source query:./* to populate children in this multi list field. My requirement is when I create content from branch template the child element should appear in selected list box (right side box). How to do this?
You don't need to set in this way DataSource, you just need to set DataSource on template field to : media library path (ex: "/sitecore/media library/Images/Social/Connector") When you will open you will see : One small issue that I remarked is Search tab is before Browse tab.
Set File datasource property to restrict start folder I am using the File field type to allow a content editor to upload a new file, or select an existing file. I wish to restrict where a file can be chosen from, so I have set the datasource of the field to a folder in my Media Library: DataSource=/sitecore/Media Library/Images/ Now, when I click Open File on a content item, I get the error: How can I specify a 'start folder' for the File control to point at? Thanks
Sitecore does not provide any translation support out of box. You can use probably use ClayTablet (http://www.clay-tablet.com/products/cms-connectors/sitecore) or GlobalLink (http://www.translations.com/globallink/). The translate button is to help you when you enter field values for a different language. It provides one field for current language and one for reference (e.g. english).
Default translation support in Sitecore I am looking for translation features in Sitecore. Does Sitecore provide translation support out of box? I saw translate button in version tab but not sure what does it do.
To answer your question: branch templates are the way to go, here. However, branch templates, alone will not give you all you need. I have actually written a rule to provide this &quot;branch preset&quot; functionality, and it is currently in use on a Production site. Branch Presets The term Branch presets refers to creating a branch template with the purpose of storing a reusable presentation configuration, complete with datasources that may or may not live within the branch itself. What Sitecore Does and Does not Provide Sitecore only provides support for using branch templates to create the item hierarchy. This means that you can use Sitecore OOTB tools alone to create your datasource items. However, Sitecore does not &quot;relink&quot; your datasources for you. What does this mean? Consider the following example: Branches |--News # Has 'News Detail' rendering |--Components |--News Details # Datasource of 'News Detail' rendering In this example, if we have only OOTB functionality, when we add an instance of this branch template, we will get the following result: Content |--News # 'News Detail' rendering datasource: branches/news/components/news details |--Components |--News Details # NOT datasource of 'News Detail' rendering Notice that the problem here is that the News Detail rendering is still pointing at the News Details component in the Branch definition, not the instance of the branch. As such, we need to write some logic of our own to relink any datasources that live within the branch, itself. Relinking Datasources As before, in order for our branch presets to work, we need to write some logic to &quot;relink&quot; the datasources for any renderings on items in the branch that point to other items in the same branch. These datasources should be relinked to point at the items in the branch instance that correspond to the datasource items in the branch definition. Triggering our Custom Logic Triggering our custom logic is not as straightforward as you might think. Unfortunately, the item:added event has technically been deprecated and the item:created event is raised before create item's &quot;master&quot; (the reference to its branch template) has been set. We also don't want to pollute our item:saved and item:saving events, since these can have a big impact on performance. Fortunately, however, Sitecore's new item provider pipelines give us an excellent mechanism by which to trigger our logic: the <addFromTemplate> pipeline. The <addFromTemplate> pipeline differs from the <uiAddFromTemplate> pipeline in that the <addFromTemplate> pipeline is called whenever an item is created, regardless of whether or not is created in the UI or where from in the UI. Note that the <addFromTemplate> pipeline only runs once when adding an item from a branch template rather than running once for each item in the branch. As such, we will want to recurse over the sub-items of our &quot;item&quot; (branch instance root) being added and relink the datasources for each. Executing our Logic So we now know where, what and why, but we now need to figure out &quot;how&quot;. Anyone who knows me at all will know what I'm about to suggest: the Rules Engine! The Rules Engine is an awesome mechanism that provides not only a highly extensible and flexible solution, but also one that is maintainable and low-effort to implement and add to. Sales-pitch, done - here is what you want to do: You are going to want to first write some conditions to check to see if the item was created from a branch template. Be sure not to add conditions to only call your logic in the content section of the tree. If you do, you will not be able to support branch templates that include instances of other branch templates. The next thing that you will want to do is write an action to relink the branch datasources for item and its descendants. You can use string comparison on the relative paths from the datasource instance root to the relative paths from the datasource definition root to figure out which item linked to which. The only down-side is that this doesn't support items with duplicate names (which you really should try to avoid, anyway). Enough Chat! Let's Code! Full disclosure, all of the code, below, will work, but this is a pretty complex feature and I can't put the entire CSPROJ into this solution. As such, I am highlighting the important parts and providing you a link to a working repo that includes this rule. The repo also includes a TDS project that has all of the items necessary to run the solution. I most recently testing this in an 8.1u2 solution. Configuration: Calling the Trigger <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?> <configuration xmlns:patch=&quot;http://www.sitecore.net/xmlconfig/&quot;> <sitecore> <pipelines> <group name=&quot;itemProvider&quot; groupName=&quot;itemProvider&quot;> <pipelines> <addFromTemplate> <processor mode=&quot;on&quot; type=&quot;Delphic.Platform.Sc.Rules.Processors.AddFromTemplate.AddFromTemplateRulesProcessor, Delphic.Platform.Sc.Rules&quot;> <ruleFolderId>92F757EA-FB27-466C-937A-D44755BBBE7D</ruleFolderId> </processor> </addFromTemplate> </pipelines> </group> </pipelines> </sitecore> </configuration> Trigger: AddFromTemplate Processor using System; using Delphic.Platform.Sc.Rules.Contexts; using Sitecore; using Sitecore.Configuration; using Sitecore.Data; using Sitecore.Diagnostics; using Sitecore.Pipelines.ItemProvider.AddFromTemplate; using Sitecore.Web.UI.Sheer; namespace Delphic.Platform.Sc.Rules.Processors.AddFromTemplate { public class AddFromTemplateRulesProcessor : AddFromTemplateProcessor { #region Public Properties /// <summary> /// Gets or sets the rule folder id. /// </summary> [CanBeNull] [UsedImplicitly] public string RuleFolderId { get; set; } #endregion #region Public Methods and Operators /// <summary> /// Processes the specified upload arguments. /// </summary> /// <param name=&quot;args&quot;> /// The arguments. /// </param> public override void Process([NotNull] AddFromTemplateArgs args) { // this is managed in configuration (runIfAborted=true would have to be set to override the value) if (args.Aborted) { return; } Assert.IsNotNull(args.FallbackProvider, &quot;FallbackProvider is null&quot;); try { var item = args.FallbackProvider.AddFromTemplate(args.ItemName, args.TemplateId, args.Destination, args.NewId); if (item == null) { return; } args.ProcessorItem = args.Result = item; } catch (Exception ex) { Log.Error(&quot;AddFromTemplateRulesProcessor failed. Removing partially created item if it exists.&quot;, ex, this); var item = args.Destination.Database.GetItem(args.NewId); item?.Delete(); throw; } ID id; if (string.IsNullOrWhiteSpace(RuleFolderId) || !Settings.Rules.ItemEventHandlers.RulesSupported(args.Destination.Database) || !ID.TryParse(RuleFolderId, out id)) { return; } var ruleContext = new PipelineArgsRuleContext<AddFromTemplateArgs>(args); RuleManager.RunRules(ruleContext, id); } #endregion } } Note that I route all of my rules through a RuleManager class to centralize logging/error-handling logic. (Credit to Matt Gramolini and Juozas &quot;Jimbo&quot; Baltika for their contributions to this structure and the code). Action 1: Relink Datasources for Item: using System.Runtime.InteropServices; using Delphic.Platform.Sc.Rules.Actions.Base; using Delphic.Platform.Sc.Rules.Utils; using Sitecore; using Sitecore.Rules; namespace Delphic.Platform.Sc.Rules.Actions.BranchDatasources { [UsedImplicitly] [Guid(&quot;4B439446-C6FD-4635-8282-147CA80A4CA5&quot;)] public sealed class RelinkItemBranchDatasources<TRuleContext> : RuleAction<TRuleContext> where TRuleContext : RuleContext { /// <summary> /// The apply rule. /// </summary> /// <param name=&quot;ruleContext&quot;> /// The rule context. /// </param> protected override void ApplyRule(TRuleContext ruleContext) { BranchDatasourceUtils.RelinkDatasourcesInBranchInstance(ruleContext.Item); } } } Action 2: Relink Datasources for Descendants: using System.Runtime.InteropServices; using Delphic.Platform.Sc.Rules.Actions.Base; using Delphic.Platform.Sc.Rules.Utils; using Sitecore; using Sitecore.Data.Items; using Sitecore.Rules; namespace Delphic.Platform.Sc.Rules.Actions.BranchDatasources { [UsedImplicitly] [Guid(&quot;8E804F7A-77FF-4074-9BAC-7EEE0CFA89C6&quot;)] public sealed class RelinkDescendantsAndSelfBranchDatasources<TRuleContext> : RuleAction<TRuleContext> where TRuleContext : RuleContext { /// <summary> /// The apply rule. /// </summary> /// <param name=&quot;ruleContext&quot;> /// The rule context. /// </param> protected override void ApplyRule(TRuleContext ruleContext) { BranchDatasourceUtils.RelinkDatasourcesInBranchInstance(ruleContext.Item, true); } } } BranchDatasourceUtils: using System; using Sitecore.Data.Items; using Sitecore.Diagnostics; using Sitecore.Layouts; using Sitecore.StringExtensions; namespace Delphic.Platform.Sc.Rules.Utils { public class BranchDatasourceUtils { /// <summary> /// Utility method for relinking branch datasources /// </summary> public static void RelinkDatasourcesInBranchInstance(Item item, bool descendants = false) { RelinkDatasourcesForItemInBranchInstance(item, item); if (!descendants) { return; } foreach (var descendant in item.Axes.GetDescendants()) { RelinkDatasourcesForItemInBranchInstance(descendant, item); } } /// <summary> /// Utility method for relinking datasources for an item within a branch instance /// </summary> /// <remarks> /// Adapted from original code, written by Kam Figy: /// https://github.com/kamsar/BranchPresets/blob/master/BranchPresets/AddFromBranchPreset.cs /// </remarks> public static void RelinkDatasourcesForItemInBranchInstance(Item item, Item instanceRoot) { Action<RenderingDefinition> relinkRenderingDatasource = rendering => RelinkRenderingDatasourceForItemInBranch(item, instanceRoot, rendering); LayoutUtils.ApplyActionToAllRenderings(item, relinkRenderingDatasource); } /// <summary> /// Utility method for relinking the datasource for the supplied rendering on an item in the branch instance /// </summary> /// <remarks> /// Adapted from original code, written by Kam Figy: /// https://github.com/kamsar/BranchPresets/blob/master/BranchPresets/AddFromBranchPreset.cs /// </remarks> /// <param name=&quot;item&quot;>Item that contains the rendering</param> /// <param name=&quot;instanceRoot&quot;>Root item of the branch instance</param> /// <param name=&quot;rendering&quot;>Rendering to be relinked</param> public static void RelinkRenderingDatasourceForItemInBranch(Item item, Item instanceRoot, RenderingDefinition rendering) { var branchBasePath = item.Branch.InnerItem.Paths.FullPath; if (string.IsNullOrWhiteSpace(rendering.Datasource)) { return; } var database = item.Database; // note: queries and multiple item datasources are not supported var renderingTargetItem = database.GetItem(rendering.Datasource); Assert.IsNotNull( renderingTargetItem, &quot;Error while expanding branch template rendering datasources: data source {0} was not resolvable.&quot; .FormatWith(rendering.Datasource)); // 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; } // get the path relative to the branch item var relativeRenderingPath = renderingTargetItem.Paths.FullPath.Substring(branchBasePath.Length); // replace $name Sitecore tokens in path relativeRenderingPath = relativeRenderingPath .Replace(&quot;$name&quot;, instanceRoot.Name); var newTargetPath = instanceRoot.Parent.Paths.FullPath + relativeRenderingPath; var newTargetItem = 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 rendering.Datasource = newTargetItem?.ID.ToString() ?? &quot;INVALID_BRANCH_SUBITEM_ID&quot;; } } } LayoutUtils: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Sitecore; using Sitecore.Data; using Sitecore.Data.Fields; using Sitecore.Data.Items; using Sitecore.Layouts; using Sitecore.SecurityModel; namespace Delphic.Platform.Sc.Rules.Utils { /// <summary> /// Layout Utilities class /// </summary> /// <remarks> /// Adapted from original code, written by Kam Figy: /// https://github.com/kamsar/BranchPresets/blob/master/BranchPresets/AddFromBranchPreset.cs /// </remarks> public static class LayoutUtils { /// <summary> /// Invokes Action on all Renderings on item /// </summary> public static void ApplyActionToAllRenderings(Item item, Action<RenderingDefinition> action) { ApplyActionToAllSharedRenderings(item, action); ApplyActionToAllFinalRenderings(item, action); } /// <summary> /// Invokes Action on all Shared Renderings on item /// </summary> public static void ApplyActionToAllSharedRenderings(Item item, Action<RenderingDefinition> action) { ApplyActionToLayoutField(item, FieldIDs.LayoutField, action); } /// <summary> /// Invokes Action on all Final Renderings on item /// </summary> public static void ApplyActionToAllFinalRenderings(Item item, Action<RenderingDefinition> action) { ApplyActionToLayoutField(item, FieldIDs.FinalLayoutField, action); } /// <summary> /// Invokes Action on all Final Renderings on item /// </summary> private static void ApplyActionToLayoutField(Item item, ID fieldId, Action<RenderingDefinition> action) { var currentLayoutXml = LayoutField.GetFieldValue(item.Fields[fieldId]); if (string.IsNullOrEmpty(currentLayoutXml)) { return; } var newXml = ApplyActionToLayoutXml(currentLayoutXml, action); if (newXml == null) { return; } using (new SecurityDisabler()) { using (new EditContext(item)) { // NOTE: when dealing with layouts its important to get and set the field value with LayoutField.Get/SetFieldValue() // if you fail to do this you will not process layout deltas correctly and may instead override all fields (breaking full inheritance), // or attempt to get the layout definition for a delta value, which will result in your wiping the layout details when they get saved. LayoutField.SetFieldValue(item.Fields[fieldId], newXml); } } } private static string ApplyActionToLayoutXml(string xml, Action<RenderingDefinition> action) { var layout = LayoutDefinition.Parse(xml); // normalize the output in case of any minor XML differences (spaces, etc) xml = layout.ToXml(); // loop over devices in the rendering for (var deviceIndex = layout.Devices.Count - 1; deviceIndex >= 0; deviceIndex--) { var device = layout.Devices[deviceIndex] as DeviceDefinition; if (device == null) { continue; } // loop over renderings within the device for (var renderingIndex = device.Renderings.Count - 1; renderingIndex >= 0; renderingIndex--) { var rendering = device.Renderings[renderingIndex] as RenderingDefinition; if (rendering == null) { continue; } // run the action on the rendering action(rendering); } } var layoutXml = layout.ToXml(); // save a modified layout value if necessary return layoutXml != xml ? layoutXml : null; } } }
Automatically creating data sources for renderings on a new page In a project, I have been working on before we had a solution in which when a content editor created a page of a certain type a Components folder was created and the renderings of that page would create their data sources in that folder. For example: I have a news page type containing a news details rendering. When I create a News page called News the following structure would be created. Content |--News |--Components |--News Details Is this something that can be done using the presentation details of the standard values of the page type? Or do I really need to use branches here (not what I remember)
This is a bug in the current version of Sitecore (8.2). You can contact Sitecore Support with the reference number 127149 and get a patch that fixes this. This happens when users are not in the sitecore domain. The bug exists in Sitecore.Data.Archiving.SqlArchive in Sitecore.Kernel. The issue is in the GetEntryCount(User) method which does not have a check on the Recycly Bin/Can See All Items policy. The sitecore\Everyone role is denied access to the policy, but users with another domain than sitecore is not a member of this role and can therefore see all items.
Recycle Bin shows all deleted items In Recycle Bin, the user (not super admin) can see all deleted items by other users. It should be shown only deleted items by him/her. (I guess it is already sitecore's default setting) The user has general member of default sitecore roles and there is no special events regarding this Recycle Bin. Do you have any idea about how I can figure out?
Dan, a very good question. Bringing back error messages through the SPE Remoting is quite tricky because of the way PowerShell handles streams of data. Script output is handled one way, and errors (or informational messages) are handled in a different way. Here are some possible ways for you to troubleshoot. Example: Run script without the use of asynchronous jobs. If the script turns fairly quickly then it won't be an issue in your testing. Running as a scheduled task, however, may be more suitable for async jobs. The ErrorRecord object is returned in the output. Import-Module -Name SPE $session = New-ScriptSession -Username michael -Password b -ConnectionUri http://spe Invoke-RemoteScript -Session $session -ScriptBlock { $templatesPath = "master:/sitecore/content/pathdoesnotactuallyexist" Remove-Item "$($templatesPath)"-Force -ParameterDoesNotActuallyExist } Stop-ScriptSession -Session $session Using the above example you will see this in the Windows PowerShell ISE (remotely). Now you may be thinking, "Well what if the job does take a while to run?" Example: Run script asynchronously. A string version of the error is returned. Import-Module -Name SPE $session = New-ScriptSession -Username michael -Password b -ConnectionUri http://spe $jobId = Invoke-RemoteScript -Session $session -ScriptBlock { try { $templatesPath = "master:/sitecore/content/pathdoesnotactuallyexist" Remove-Item "$($templatesPath)"-Force -ParameterDoesNotActuallyExist } catch { $_ } } -AsJob Wait-RemoteScriptSession -Session $session -Id $jobId -Delay 1 Stop-ScriptSession -Session $session Using the above example you will see this int he Windows PowerShell ISE (remotely). This currently looks a little less polished but still gets the job done. Update If you desire for your script to return an error message for commands that normally continue, add $ErrorActionPreference = "Stop" in your ScriptBlock. Example: Run script asynchronously and stop on any error. Import-Module -Name SPE $session = New-ScriptSession -Username michael -Password b -ConnectionUri http://spe $jobId = Invoke-RemoteScript -Session $session -ScriptBlock { $ErrorActionPreference = "Stop" try { $templatesPath = "master:/sitecore/content/pathdoesnotactuallyexist" Get-Item "$($templatesPath)"-Force } catch { $_ } } -AsJob Wait-RemoteScriptSession -Session $session -Id $jobId -Delay 1 Stop-ScriptSession -Session $session Update 2 Version 4.4.1+ should include support for Write-Verbose and other Write- commands. You can read more about it here.
Displaying Errors from Sitecore PowerShell Using Remoting Using the remoting capabilities in Sitecore PowerShell Extensions, I'm trying to execute some PowerShell remotely and ensure that any errors that occur display in the local console. How can I do that? Here's what I have: Import-Module -Name SPE $session = New-ScriptSession -Username "admin" -Password "b" -ConnectionUri "http://sitecore.local" $jobId = Invoke-RemoteScript -Session $session -AsJob -ScriptBlock { $templatesPath = "master:/sitecore/content/data/tempdata" if (Test-Path $templatesPath) { if ((Get-Item $templatesPath).HasChildren -eq "True") { $children = Get-ChildItem $templatesPath foreach ($childItem in $children) { "Deleting temp content at $($childItem.FullPath)" # I recognize this next line does not work # It's wrong on purpose to test what happens when an error occurs Remove-Item "$($childItem.FullPath)" -Force -Recurse } } } } Wait-RemoteScriptSession -Session $session -Id $jobId -Delay 1 -Verbose Stop-ScriptSession -Session $session If I check the logs after execution I see that an error occurred, but I don't see the error in the console where I executed the script.
The reason you are getting No parameterless constructor error is because Sitecore cannot create an instance of your controller that takes parameters. Without dependency injection working correctly, Sitecore is looking for a controller that takes not inputs like this: public ActionResult MyController() { //stuff } What you do have is one that takes parameters, like a service or a repository. private readonly IAccountService _accountService; public ActionResult MyController(IAccountService accountService) { _accountService = accountService; } Your IoC container is responsible for resolving these input parameters for Sitecore, but that seems to not be working now in your solution. Which IoC container you are using is not known yet, but in Sitecore 8.2 an IoC container is available by default. You may consider making the investment to move to that to resolve your issue. http://kamsar.net/index.php/2016/08/Dependency-Injection-in-Sitecore-8-2/ http://www.sitecorenutsbolts.net/2016/09/17/Habitat-Dependency-Injection-with-Sitecore-8-2/
"No parameterless constructor defined for this object" after upgrade to Sitecore 8.2 We have upgraded our platform to Sitecore 8.2 recently and in the preview we are getting below error. We disabled all glass mapper related config. No parameterless constructor defined for this object. Description: An unhandled exception occurred. Exception Details: System.MissingMethodException: No parameterless constructor defined for this object. Stack Trace: [MissingMethodException: No parameterless constructor defined for this object.] System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean&amp; canBeCached, RuntimeMethodHandleInternal&amp; ctor, Boolean&amp; bNeedSecurityCheck) +0 System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark&amp; stackMark) +113 System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark&amp; stackMark) +206 System.Activator.CreateInstance(Type type, Boolean nonPublic) +83 System.Activator.CreateInstance(Type type) +11 System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +55 [InvalidOperationException: An error occurred when trying to create a controller of type 'xxxxxxxxx.xxxxxxxxx.Website.Controllers.HomeController'. Make sure that the controller has a parameterless public constructor.] System.Web.Mvc.DefaultControllerActivator.Create(RequestContext requestContext, Type controllerType) +178 System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) +76 System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +88 Sitecore.Mvc.Controllers.SitecoreControllerFactory.CreateControllerInstance(RequestContext requestContext, String controllerName) +184 Sitecore.Mvc.Controllers.SitecoreControllerFactory.CreateController(RequestContext requestContext, String controllerName) +68 [ControllerCreationException: Could not create controller: 'Home'. The context item is: '/sitecore/content/xxxxxxxxx/xxxxxxxxx-xxxxxxxxx-brand/xxxxxxxxx-xxxxxxxxx/home'. The current route url is: '{*pathInfo}'. This is the default Sitecore route which is set up in the 'InitializeRoutes' processor of the 'initialize' pipeline. ] Sitecore.Mvc.Controllers.SitecoreControllerFactory.CreateController(RequestContext requestContext, String controllerName) +121 Sitecore.Mvc.Controllers.ControllerRunner.CreateControllerUsingFactory() +53 Sitecore.Mvc.Controllers.ControllerRunner.CreateController() +5 Sitecore.Mvc.Controllers.ControllerRunner.GetController() +17 Sitecore.Mvc.Controllers.ControllerRunner.Execute() +36 Sitecore.Mvc.Presentation.ControllerRenderer.Render(TextWriter writer) +95 Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Render(Renderer renderer, TextWriter writer, RenderRenderingArgs args) +15 Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Process(RenderRenderingArgs args) +52 (Object , Object[] ) +59 Sitecore.Pipelines.PipelineMethod.Invoke(Object[] parameters) +36 Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +365 Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists) +162 Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +18 Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args) +18 Sitecore.Mvc.Pipelines.PipelineService.RunPipeline(String pipelineName, TArgs args) +138 Sitecore.Mvc.Helpers.SitecoreHelper.RunRenderRenderingPipeline(Rendering rendering, TextWriter writer) +77 Sitecore.Mvc.Helpers.SitecoreHelper.<.ctor>b__0(Rendering rendering, StringWriter writer) +5 Sitecore.Mvc.Helpers.SitecoreHelper.RenderRendering(Rendering rendering) +42 Sitecore.Mvc.Helpers.SitecoreHelper.Rendering(String pathOrId, Object parameters) +92 Sitecore.Mvc.Helpers.SitecoreHelper.Rendering(String pathOrId) +12 ASP._Page_Views_xxxxxxxxx_xxxxxxxxx_xxxxxxxxx_Corporate_xxxxxxxxx_xxxxxxxxx_Layouts_LayoutMain_cshtml.Execute() in c:\inetpub\wwwroot\LeicaLocal8.1\Website\Views\xxxxxxxxx\xxxxxxxxx xxxxxxxxx Corporate\xxxxxxxxx xxxxxxxxx\Layouts\LayoutMain.cshtml:7 System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +198 System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +105 System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +90 System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +234 System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +107 System.Web.Mvc.HtmlHelper.RenderPartialInternal(String partialViewName, ViewDataDictionary viewData, Object model, TextWriter writer, ViewEngineCollection viewEngineCollection) +280 System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) +91 Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer) +244 [InvalidOperationException: Error while rendering view: '/Views/xxxxxxxxx/xxxxxxxxx xxxxxxxxx Corporate/xxxxxxxxx xxxxxxxxx/Layouts/LayoutMain.cshtml' (model: 'Sitecore.Mvc.Presentation.RenderingModel, Sitecore.Mvc'). ] Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer) +513 Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Render(Renderer renderer, TextWriter writer, RenderRenderingArgs args) +15 Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Process(RenderRenderingArgs args) +52 (Object , Object[] ) +59 Sitecore.Pipelines.PipelineMethod.Invoke(Object[] parameters) +36 Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +365 Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists) +162 Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +18 Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args) +18 Sitecore.Mvc.Pipelines.PipelineService.RunPipeline(String pipelineName, TArgs args) +138 Sitecore.Mvc.Presentation.RenderingView.Render(ViewContext viewContext, TextWriter writer) +216 System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +291 System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +56 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +420 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +420 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +52 System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +173 System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +36
This problem is best addressed with CSS, where you are trying to control the size of a rendered string, because 100 characters measures a different length depending on what characters they contain. Trite example: 100 x i is a very different size to 100 x W. In the event you're actually doing a "more" break, the best thing is to get content authors to place an HTML comment into the text to identify the appropriate place to break. I believe this technique is used widely in blogging systems like WordPress. A simple example is <!-- #More -->. Truncating the text is fraught with danger. Using the HtmlAgilityPack for this is only going to double your pain. Edit: use the RadEditor snippet functionality to make it easier for authors!
display only 100 symbols from rich text I need to cut rich text field value to render only 100 first symbols and '...' at the end. The issue is rich text field value looks like <strong style="background-color: #ffffff; margin: 0px; padding: 0px; text-align: justify;">Lorem Ipsum</strong><span style="background-color: #ffffff; text-align: justify;">&amp;nbsp;is<em><strong> simply dummy text of the printin</strong></em>g and typesettin<a href="http://https://sitecore.stackexchange.com/">g indust</a>ry. Lorem Ipsu<em><strong>m has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It </strong></em>has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum</span> So if I use a simple substring function I will have <strong style="background-color: #ffffff; margin: 0px; padding: 0px; text-align: justify;">Lorem I => Lorem I instead of <strong style="background-color: #ffffff; margin: 0px; padding: 0px; text-align: justify;">Lorem Ipsum</strong><span style="background-color: #ffffff; text-align: justify;">&amp;nbsp;is<em><strong> simply dummy text of the printin</strong></em>g and typesettin<a href="http://https://sitecore.stackexchange.com/">g indust</a>ry. Lorem Ipsu<em><strong>m has been the => Lorem Ipsum&nbsp;is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the Probably sitecore libraries has a functionality to complete it?
You can try searching for it here: https://kb.sitecore.net The dll will have a reference number associated with it Sitecore.Support.xxxxx.dll. For example: https://kb.sitecore.net/SearchResults#term=442487 If you can't find it just raise a ticket with Sitecore and they will provide you with the dll. Also recently released is this Github project containing source code for support fixes https://github.com/SitecoreSupport
How to download support dll I've found the necessary answer on my question. But answer provide the name of sitecore support dll. How I can download necessary files if I know support dll name?
UPDATE: as of Nov 2018 the MVP applications can be saved and edited on the form before finally submitting the information. There is no way to edit your nomination and please do not reapply. You can email your problem to [email protected] and the team there would be really happy to help you.
How to edit Sitecore MVP nomination? I have recently applied for Sitecore MVP nominations 2017. When i looked at my confirmation email, I found I made a mistake. Is there a way to edit it? Is it better to reapply for the MVP nominations? Is reapplying going to affect in any negative way? Any suggestions are appreciated.
There is no need to disable the DFS. Because the Job Server (publishing/task) will mainly deals with Sitecore Items while the DFS is used for the files synchronization. One thing to keep in mind is that when using the DFS, you will have a master server along with slave servers. So, file deployment should be performed on the Master Server so that it gets synchronized on the slave servers.
Configuring multiple CM servers with DFS synchronisation I have a setup with two CM servers (I know, 3 would be better...) and want to designate one as the publishing/task server. I have read this question and answer Setting up multiple CM servers but my scenario is slightly different in that the CM servers use DFS to synch the file systems. Must I disable DFS and use different configs for each server, or is it possible to use the same config on both servers (they are named CM01 and CM02): <setting name="Publishing.PublishingInstance"> <patch:attribute name="value">CM02</patch:attribute> </setting>
What you need is an "or"-based expression that has a separate condition for every search term: using Sitecore.ContentSearch.Linq.Utilities; // ... IEnumerable<string> keywords = new string[] { "my", "value" }; Expression<Func<IndexedContact, bool>> keywordsPredicate = keywords.Aggregate( PredicateBuilder.False<IndexedContact>(), (current, keyword) => current.Or( c => base.GetCompareExpression(c["contact.myfield"], keyword))); return keywordsPredicate; Please note that GetCompareExpression() may return different operators. It's up to you what to do when the operator is not "equals".
How to avoid double quotes for is equal to when using segment builder I'm creating a condition for the segment builder inheriting from TypedQueryableStringOperatorCondition. I'm overriding the method GetResultPredicate to apply my filter like this return base.GetCompareExpression((IndexedContact c) => c["contact.myfield"], "myvalue"); This is translated into the following query: contact.myfield:myvalue So good so far, but if the value I'm looking for has more than one word or pipe to split terms it adds double quotes to the query: return base.GetCompareExpression((IndexedContact c) => c["contact.myfield"], "my value"); This is translated into the following query: contact.myfield:"my value" In my case the query I'm trying to get is: contact.myfield:my value To get result containing "my" or "value" I have tried using the Operator contains, but it has been translated into a massive spanNear([SpanWildcardQuery. Any idea how to achieve the query: contact.myfield:my value Trying to make it easier or clearer what I'm really trying to do is to find contacts containing any of the "words" in that field. It's fine If I have to change the approach.
It is a bug introduced with the October package (4.0.450) happening when upgrading and changing the Sitecore account. We are looking for solutions on our side.
Coveo error when accessing index manager: No SecurityProviderConversionHelper found for index: Coveo_master_index I've installed Coveo (pro cloud edition with the October 2016 package), and after installation I went and changed the farm name and Sitecore account it was using (the account I switched to is still an administrator account). When I tried to access the diagnostic page, I got a YSOD message with "No SecurityProviderConversionHelper found for index: Coveo_master_index." Looking around, I thought it could be because I hadn't kicked off an initial index yet, but when I go to the indexing manager, I get the same error. I don't see this message around the developer or answers sites on Coveo, so assistance appreciated.