output
stringlengths 34
25.7k
| instruction
stringlengths 81
31k
| input
stringclasses 1
value |
---|---|---|
I am not sure whether it is possible or not but it is not a good idea to run the DEF pipeline batches in one of the CD servers as there are lots of limitations based on best practices such as the master and web database will not be available on CD server, a publish can override the Sitecore changes. But with regards to your original problem, you can use Data Exchange Framework Remote SDK.
Data Exchange Framework Remote SDK allows pipeline batches, pipelines, and other framework components to run outside of the Sitecore server. This can significantly reduce the load on your Sitecore server by moving much I/O and other processing to a separate machine.
When using the remote SDK, Sitecore’s role in synchronization processes is limited to the configuration. Sitecore items are used to configure framework components, but the framework components themselves run within the application domain that is using the remote SDK.
There are some limitations to using DEF Remote SDK, which you need to take care of before using it-
The component must not have any dependencies on APIs that are only available on the Sitecore server.
Can not run Sitecore pipelines (Data Exchange Framework provides its own pipeline implementation that can be used instead)
Can not read anything from Sitecore configuration files
Can not use any type defined in Sitecore assemblies (Sitecore.Services.Core.dll is the one exception)
For implementing a remote client use this reference - https://doc.sitecore.com/xp/en/developers/def/v1.4.1/remote-sdk/implementing-a-remote-client/index.html
Reference - https://doc.sitecore.com/xp/en/developers/102/platform-administration-and-architecture/data-exchange-framework-remote-client.html
| Can DEF Pipeline Batches run outside the CM?
I have DEF tenant configured to pull contacts from D365 and push activities to D365. Trying to figure out High Availability solution to keep these processes running. Can we run the pipeline batches in one of the CDs, instead of the CM? Trying to avoid having a HA option for the CM.
| |
It has been quite a while since I worked on this, but I did get it working. If I recall correctly, the issue was in the code and not in DEF settings items, and the reason it wasn't getting picked up was because a reference to an interface or class needed to be updated. This combination of code worked:
public class EventDefinitionIdValueExpressionBuilder : BaseEventDefinitionTypeExpressionBuilder<Guid>
{
public IValueAccessor RightValueAccessor { get; set; }
public Guid EventDefinitionType { get; set; }
protected override Expression<Func<Event, bool>> BuildEventExpression(
ExpressionContext expressionContext)
{
Guid eventDefinitionType = this.GetValue(expressionContext);
switch (this.ExpressionType)
{
case ExpressionType.Equal:
return (Expression<Func<Event, bool>>)(ev => ev.DefinitionId.Equals(eventDefinitionType));
case ExpressionType.NotEqual:
return (Expression<Func<Event, bool>>)(ev => !ev.DefinitionId.Equals(eventDefinitionType));
default:
throw new NotSupportedException(string.Format("Condition operator is not supported. (Condition operator: {0})", (object)this.ExpressionType));
}
}
protected override Guid GetValue(
ExpressionContext expressionContext)
{
if (this.RightValueAccessor?.ValueReader != null)
{
ReadResult readResult = this.RightValueAccessor.ValueReader.Read((object)expressionContext, new DataAccessContext());
if (readResult.WasValueRead)
{
return readResult.ReadValue as Guid? ?? Guid.Empty;
}
}
return this.EventDefinitionType;
}
}
public class EventDefinitionIdValueExpressionConverter : BaseItemModelConverter<IEventExpressionBuilder>
{
public const string FieldNameConditionOperator = "ConditionOperator";
public const string FieldNameValue = "Value";
public const string FieldNameRightValueAccessor = "RightValueAccessor";
protected readonly ExpressionTypeConverter ExpressionTypeConverter;
public EventDefinitionIdValueExpressionConverter(IItemModelRepository repository) : this(repository, new ExpressionTypeConverter())
{
}
public EventDefinitionIdValueExpressionConverter(
IItemModelRepository repository,
ExpressionTypeConverter expressionTypeConverter)
: base(repository)
{
this.ExpressionTypeConverter = expressionTypeConverter ?? new ExpressionTypeConverter();
}
protected override ConvertResult<IEventExpressionBuilder> ConvertSupportedItem(ItemModel source)
{
string conditionOperator = this.GetConditionOperator(source);
ExpressionType expressionType;
if (!this.TryGetExpressionType(conditionOperator, out expressionType))
{
return this.NegativeResult(source, "Cannot convert string condition operator to expression type. (condition operator: " + conditionOperator + ")");
}
Guid eventDefinitionId = this.GetEventDefinitionId(source);
IValueAccessor rightValueAccessor = this.GetRightValueAccessor(source);
EventDefinitionIdValueExpressionBuilder expressionBuilder = new EventDefinitionIdValueExpressionBuilder();
expressionBuilder.EventDefinitionType = eventDefinitionId;
expressionBuilder.ExpressionType = expressionType;
expressionBuilder.RightValueAccessor = rightValueAccessor;
return this.PositiveResult((IEventExpressionBuilder)expressionBuilder);
}
protected virtual IValueAccessor GetRightValueAccessor(ItemModel source) => this.ConvertReferenceToModel<IValueAccessor>(source, "RightValueAccessor");
protected virtual Guid GetEventDefinitionId(ItemModel source)
{
return this.GetGuidValue(source, "Value");
}
protected virtual string GetConditionOperator(ItemModel source) => this.GetReferenceAsModel(source, "ConditionOperator")["ItemName"].ToString();
protected bool TryGetExpressionType(string conditionOperator, out ExpressionType expressionType)
{
return Enum.TryParse<ExpressionType>(conditionOperator, true, out expressionType);
}
}
public class EventDefinitionIdValueReaderConverter : BaseItemModelConverter<IValueReader>
{
private static EventDefinitionIdValueReader _reader = new EventDefinitionIdValueReader();
public EventDefinitionIdValueReaderConverter(IItemModelRepository repository): base(repository)
{
}
protected override ConvertResult<IValueReader> ConvertSupportedItem(
ItemModel source)
{
return this.PositiveResult((IValueReader)EventDefinitionIdValueReaderConverter._reader);
}
}
public abstract class BaseEventDefinitionTypeExpressionBuilder<TValue> : IEventExpressionBuilder
{
public ExpressionType ExpressionType { get; set; }
public Expression<Func<Event, bool>> Build(ExpressionContext expressionContext)
{
Expression<Func<Event, bool>> expression = this.BuildEventExpression(expressionContext);
return Expression.Lambda<Func<Event, bool>>(expression.Body, (IEnumerable<ParameterExpression>)expression.Parameters);
}
protected abstract Expression<Func<Event, bool>> BuildEventExpression(ExpressionContext expressionContext);
protected abstract TValue GetValue(ExpressionContext expressionContext);
}
For supplementary material, I have more code examples and explanations on these posts:
https://sitecore.marcelgruber.ca/posts/data-exchange-framework-dynamics-connector-overview
https://sitecore.marcelgruber.ca/posts/storing-full-urls-in-page-view-events
| Custom Expression Converter never called
In DEF 4.0 and SC 9.3, using this Sitecore guide I created a custom Value Expression Converter for a new filter so that I can filter generic Events based on the DefinitionId, in this case Print events:
This custom expression converter was based off a similar converter that ships with DEF:
I have confirmed that the library reference in the Converter Type field is valid, and when I run the pipeline, I see the base constructor getting called inside of my custom converter (first break point), but I never see any other code being called (second break point). This is obvious because Events are being synced that shouldn't be based on the filters that I have specified.
The high level flow is this:
Pipeline: Process Single Interaction from xConnect
Pipeline Step: Read Page Events from Interaction
Source Object Value Accessor: "Data Access/Value Accessors/Providers/xConnect/Page Events from Interaction"
Filter: "Filter Expressions/Event Filter Expressions/Print Event Expression"
Condition Operator: “Equal”
Right Value Accessor: "DefinitionId on xConnect Event"
Value: "Page Events/Print" ({CD52B756-21B4-4028-8BA5-E981B8A96F95})
Converter Type: "Client.Foundation.DataExchange.Providers.xConnect.Expressions.GenericEventDefinitionTypeValueExpressionConverter, Client.Foundation.DataExchange"
| |
Here are two attributes you need to take care of for Sitecore.Tasks.CleanupAgent to delete the log files and folders -
pattern = Use regex for deleting the files since you want to delete the folder then you need to pass the * as a wildcard. <patch:attribute name="pattern">*log.*.tx*</patch:attribute> will just delete files with matching pattern and pattern="*.*" will delete all the files but not folders.
recursive = Use this attribute to delete files and folders on a deep level(recursively), generally we don't need to set this attribute if we are using the * wildcard value in the pattern but we had some issues in PaaS long time back where it work after set it's value to true.
try below configration to fix this issue -
<remove folder="$(dataFolder)/logs">
<patch:attribute name="pattern">*</patch:attribute>
<patch:attribute name="maxAge">2.00:00:00</patch:attribute>
<patch:attribute name="recursive">true</patch:attribute>
</remove>
| Does anyone know how to delete the Log files FOLDERS
Ok so I have a patch that looks like below, it does a good job of deleting 2 day and older logs but however it just leaves the folder itself. I tried adding the section above which is bolded but it does not work. Any idea how to get rid of the dynamically generated folder. They have names like (log/RD0003FFA1230E and logs/RD0003FFA12729), but my script does delete all the logs inside those just not these folders.
<scheduling>
<agent type="Sitecore.Tasks.CleanupAgent">
<files hint="raw:AddCommand">
**<remove folder="$(dataFolder)/logs" pattern="*.*" maxAge="2.00:00:00"/>**
<remove folder="$(dataFolder)/logs">
<patch:attribute name="pattern">*log.*.tx*</patch:attribute>
<patch:attribute name="maxAge">2.00:00:00</patch:attribute>
<patch:attribute name="recursive">true</patch:attribute>
</remove>
| |
It is not possible OOTB but you can perform this by creating your custom crawler by inheriting the OOTB crawler (This customization is not recommended for Sitecore's OOTB indexes i.e sitecore_master_index, sitecore_web_index and sitecore_core_index.)
I have given a similar answer for creating a separate index for each language also you can modify this code a little for excluding some of languages from indexing - Sitecore Index - Separate index for each language
| Index English language item version only
I have two versions of every item (English and Chinese).
While indexing, I have noticed both the versions (English and Chinese) of every item is indexed.
How can I only index the English version.
Any recommendation would be appreciated.
Thanks in advance
| |
I contacted Sitecore support and they gave me a zip file - they noted that this is not an officially tested method and do not guarantee it will work without causing any issues.
Looking at the zip file it contains:
Example xml config on how to configure:
<Settings>
<Serilog>
<Using>
<FileSinkAssembly>Serilog.Sinks.File</FileSinkAssembly>
<RollingFileSinkAssembly>Serilog.Sinks.RollingFile</RollingFileSinkAssembly>
<SerilogFiltersExpressionsAssembly>Serilog.Filters.Expressions</SerilogFiltersExpressionsAssembly>
</Using>
<MinimumLevel>
<Default>Information</Default>
</MinimumLevel>
<WriteTo>
<FileSink>
<Name>RollingFile</Name>
<Args>
<pathFormat>App_Data\\Logs\\xconnect-log-${MachineName}-${InstanceName}-{Date}.txt</pathFormat>
<retainedFileCountLimit>7</retainedFileCountLimit>
<buffered>False</buffered>
</Args>
</FileSink>
</WriteTo>
<Filter>
<Filter1>
<Name>ByExcluding</Name>
<Args>
<expression>(@Message like '%Failed to locate activity%' or @MessageTemplate like '%Sitecore.XConnect.Operations.SetFacetOperation%') and (@MessageTemplate not like '%Sitecore.XConnect.Operations.PatchFacetOperation%') and (@Exception like '%KeyBehaviorCache%'or @Exception like '%InteractionsCache%' or @Exception like '%ExmKeyBehaviorCache%' or @Exception like '%EngagementMeasures%' or @Exception like '%ContactBehaviorProfile%' or @Message like '%KeyBehaviorCache%'or @Message like '%InteractionsCache%' or @Message like '%ExmKeyBehaviorCache%' or @Message like '%EngagementMeasures%' or @Message like '%ContactBehaviorProfile%')</expression>
</Args>
</Filter1>
</Filter>
<Properties>
<Application>XConnect</Application>
</Properties>
</Serilog>
</Settings>
Looks like the Serilog.Filters.Expressions.dll dll from here and its dependency Superpower.dll.
So you can try those dll's, or you might want to contact sitecore support for them to provide the dll's for you.
| How to configure Serilog filters in xConnect?
I would like to filter out some messages from being logged in xConnect - for example 'Failed to locate activity...'.
I have tried this configuration but it does not seem to take effect:
<Settings>
<Serilog>
<Using>
<FileSinkAssembly>Serilog.Sinks.File</FileSinkAssembly>
<RollingFileSinkAssembly>Serilog.Sinks.RollingFile</RollingFileSinkAssembly>
</Using>
<MinimumLevel>
<Default>Error</Default>
</MinimumLevel>
<WriteTo>
<FileSink>
<Name>RollingFile</Name>
<Args>
<pathFormat>App_Data\\Logs\\xconnect-log-${MachineName}-${InstanceName}-{Date}.txt</pathFormat>
<retainedFileCountLimit>7</retainedFileCountLimit>
<buffered>False</buffered>
</Args>
</FileSink>
</WriteTo>
<Filter>
<Args>
<Name>ByExcluding</Name>
<expression>StartsWith(@Message, 'Failed to locate activity')</expression>
</Args>
</Filter>
<Properties>
<Application>XConnect</Application>
</Properties>
</Serilog>
</Settings>
| |
I just did a quick test on one of our environments (SC 10.1), where we have the blob storage module installed.
Uploaded an image (2446 kb) to media library.
This is stored with value 'blob://5299fadc-a496-4629-8361-4ddc3d145f76' (The 'blob://' prefix tells sitecore to get the blob from azure storage),
Created a package to include the new image. Package includes the usual (properties, items, meta, installer) as well as a 'blob' folder, with a single blob (2446 kb).
Installed the package to sitecore instance without blob storage module installed.
The item appears in media library and is stored with the value '5299fadc-a496-4629-8361-4ddc3d145f76'.
The lack of the 'blob://' prefix means the blob is stored in the blob table in corresponding database (master/web).
I'm guessing other types of serialisation tools would therefore act in the same way. Package up media, then upon deserialisation, store in the defined way for that environment.
| Creating media library packages when using Azure Blob Storage
We are working on an upgrade project and are considering using the Azure Blob Storage module to store media outside of the database. Since the media is no longer stored in the database and is instead stored externally in Azure, we are not sure what happens when you create an item package using the Sitecore Package Designer.
This becomes important for development, debugging and also syncing content across environments. For example, we may wish to bring this down to our local environment to debug a problem, or sync it down to the QA environment so we are testing against something more Production like.
Ideally, we also need to consider automated syncs using a tool like RAZL, SideKick or SPE Content Migrator too.
Does anyone know how the Blob Storage module works when creating packages or using any of the content sync tools?
| |
When we specifically check which table is having a huge amount of records and data, we got to know that it was the CommerceEntities.
CommerceEntities table can keep growing with the product changes - a new version is added for each product updates. And that is because journaling is enabled for those entities.
This feature can cause rapid DB size growth. We can simply disable this journling feature by removing relevant configuration from environment config file like..
wwwroot\CommerceAuthoring_Sc\wwwroot\data\EnvironmentsPlugIn.Habitat.CommerceAuthoring-*.*.*.json
Just remove this section wherever you find. This will disable journling. However, disabling this will not remove existing records from the table. It will just not add new records whenever entity is updated in future.
"$type": "Sitecore.Commerce.Plugin.Journaling.EntityJournalingPolicy, Sitecore.Commerce.Plugin.Journaling",
"EntityFullName": "Sitecore.Commerce.Plugin.Customers.Customer",
"Journal": "CustomersJournal"
You can find more detailed information on this topic here.
https://doc.sitecore.com/xp/en/developers/93/sitecore-experience-commerce/entity-journaling.html
| Commerce database size keep on drastically increased in every 3 months. i.e. 500GB
We have commerce in place for one of our project. On dev and UAT environment, commerce db file keep on drastically increased in every 3 months. i.e. 500GB in every 3rd month. I don't think, it is a expected behavior but would like to know if someone else had faced similar kind of issue earlier or any proper solution for this problem.
| |
If you are setting up Sitecore Demo Edge website on your local, to login to Sitecore CMS use the below credentials:
User name: superuser
Password: the password you set in the .env file (eg. 'b')
If you are spinning up, the Demo Edge website on Sitecore Demo Portal, you will get the user name and password in the details section:
| Unable to login to the sitecore.demo.edge site after installing
https://github.com/Sitecore/Sitecore.Demo.Edge This is a docker demo site from Sitecore using JSS and Next.js
Unable to log in to the sitecore.demo.edge site after installing, the value in the .env file for the admin password is b, and tried resetting in the SQL core DB. It redirects identity and keeps saying invalid username and password. I also tried sitecore\admin as well. Are there any issues with this demo site? No errors in the identity logs or cm logs.
| |
Sitecore Experience Edge is a cloud-based CDN, it's not something you run locally. In basic terms, it is a CDN which is used as a replacement for your CD instances and Web database. You can read more about it on the docs site: https://doc.sitecore.com/xp/en/developers/101/developer-tools/sitecore-experience-edge-for-xm.html
When running XM Cloud locally using Docker as you mentioned, Edge is not involved. You're locally running the Sitecore CM instance and the Rendering Hosts. The Rendering Hosts run against the CM instance and Master database, so there is no publishing action to be performed when running locally in this way.
| XM Cloud content delivery in local machine without any Edge url or config change?
I have cloned the repository XM-Cloud intro, and deploy it successfully in my local docker.
I haven't configured anything yet for Edge so i am assuming Edge is not being utilized yet. Now the question is, in this case, where Edge is not available, where exactly publishing is happening and how sites are still available for public user as neither we have web and nor edge?
| |
Adding the this.chrome.openingMarker().attr("phkey") with OR condition in PlaceholderKey function in
\sitecore\shell\Applications\Page Modes\ChromeTypes\PlaceholderChromeType.js
file solved my issue. The code snippet is as follows.
placeholderKey: function()
{
return this.chrome.openingMarker().attr("key") ||
this.chrome.openingMarker().attr("phkey");
}
| Unable to add components in layout in Sitecore 10.2 Experience editor
We have upgraded our site from Sitecore 9.1 to Sitecore 10.2. Post upgrade we started facing issue on the Experience editor as follow,
Problem statement: Whenever we tried to add a new component to the Experience editor, we are getting an Error Occurred popup with the following error stack.
15728 11:18:28 ERROR Application error.
Exception: System.Web.HttpUnhandledException
Message: Exception of type 'System.Web.HttpUnhandledException' was thrown.
Source: System.Web
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Nested Exception
Exception: System.InvalidOperationException
Message: placeholderKey
Source: Sitecore.ExperienceEditor
at Sitecore.Pipelines.ExecutePageEditorAction.InsertRendering.Process(PipelineArgs args)
at (Object , Object )
at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)
at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
at Sitecore.Pipelines.ExecutePageEditorAction.ExecutePageEditorActionPipeline.Run(ExecutePageEditorActionArgs args)
at Sitecore.Shell.Applications.WebEdit.Palette.OnPreInit(EventArgs e)
at System.Web.UI.Page.PerformPreInit()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
| |
If you want GraphQL to work for you, you need either a GraphQL extender or a custom Form component.
It will be hard to achieve exactly the same output by GraphQL that you get with Layout Sevice. (You have a specific Contents Resolver for forms, you will need to get exactly the same output).
You will not be able to get Form JSS React component work if you don't exact the same input from GraphQL. If you have different input, you need to write different Form components. It is also will take a lot of effort.
These options are possible, but quite hard.
The 2 easy options to use Forms are:
Use SSR
Turn off the anti-forgery token. Depending on the type of forms that you have, it might be acceptable
Conclusion:
All options that your write are achievable. But some are easy, some are complex.
| Sitecore Forms in with JSS and Next.js with SSG
Hello Sitecore friends,
I am currently working on a project on Sitecore 10.1 with JSS v19 and nextjs v11.
The page is configured to use SSG, so markup is created on build time.
I am trying to integrate Sitecore Forms but have some problems to fully understand, how it should work.
In the documentation it is written, that the form has to be rendered server side (SSR), which makes sense to me, since e.g. the anti forgery token changes with each request.
Also from this page I understand, that even if the whole pages markup is generated statically, I can fetch data dynamically from the server on a component base, which I want to do for my form component.
Now I see two options that are not 100% clear to me, how I can fetch the data from server side: Use GraphQL or use the Layout Service.
GraphQL
Would make sense to me, because I only need the data for one component and could save traffic.
But I don't understand, how I would get the same data as from the layout service (again like anti forgery token like on the screenshot below).
Layout Servie
For the layout service it is basically the other way around. I would have the data, that I need but I only see the option, to request data for the whole page again, which seems counterintuitive to me, as it would mean, that the page will be rendered statically and then the data for everything will be fetched again only for the form and even multiple times, if there were multiple forms on one page.
Does anyone have any experience with this scenario and could give me a nudge into the right direction? Have I made any wrong assumptions here?
For now, I would lean to the Layout Service, since I have no idea, how I could get all the data from the GraphQL api.
Cheers, Simon
| |
The article you are following is working with the Multilist field, not with the Multilist with Search.
I have checked this using this class.
namespace TEST.Foundation.Common.CustomSitecore
{
public class Multilist: IDataSource
{
public Item[] ListQuery(Item item)
{
item = SitecoreData.Context.ContentDatabase.GetItem("/sitecore/content/Home");
return item.Axes.GetDescendants().ToArray();
}
}
}
Here is what I used in Sitecore
| Adding custom data source to multilist with search field not working
After creating a class to get desired sorted items to populate list, after making sure to type in the source correctly in the source field as code:namespace.classname, assemblyname , still results didn't come up as expected, any idea what am i missing ? is there is any config files to be added for the class for example?
| |
Ensure that your instance is Standalone or ContentDelivery, as if you review Sitecore.Analytics.Tracking.RobotDetection.config the robot detection pipelines don't run on the ContentManagement role.
| Robot Detection not working?
I have set the robot detection on form as true following the doc on https://doc.sitecore.com/xp/en/users/93/sitecore-experience-platform/work-with-robot-detection-for-forms.html
Then I created a selenium python script to submit the form. Its able to submit form without any issue.
My question here is how to validate/verify if robot detection is actually working or not?
| |
As per the discussion, you need to update the user.json and verify that you are using HTTPS in host and authority. So they should look like this.
"host": "https://sitecoretestsc.dev.local",
"authority": "https://sitecoretestidentityserver.dev.local",
Also, you need to verify that the path variable that you have provided in the module.json contains the correct Sitecore content tree path.
This will resolve the issue.
| Sitecore CLI integrate with Visual Studio error
Poweshell error when trying to run dotnet sitecore ser push
This is my folder structure
| |
This issue is finally resolved with the help of sitecore support!
The root cause was this error -
ERROR Could not update device detection database
Exception: System.NullReferenceException
Message: Object reference not set to an instance of an object.
Source: Sitecore.CES.DeviceDetection
at Sitecore.CES.DeviceDetection.Providers.FiftyOneDegrees.FiftyOneDeviceDetectionClient.GetNewerVersion()
at Sitecore.CES.DeviceDetection.Providers.FiftyOneDegrees.FiftyOneDeviceDetectionClient.DoUpdate(String serviceName, String& newDatabasePath, String& newDatabaseVersion)
at Sitecore.CES.DeviceDetection.Providers.DeviceDetectionClient.Update()
WARN [Experience Analytics]: Device detection component failed to resolve device information with error: Can not get device information: provider is not initialized.
This error could be caused by the Device Detection database corruption in the "App_Data\DeviceDetection" folder or the absence of it there.
To resolve the above error, sitecore suggested -
This error could be caused by the Device Detection database corruption
in the "App_Data\DeviceDetection" folder or the absence of it there.
In case there is some database downloaded it could be that some
network issues occurred while the database is downloaded, so the file
became corrupted. If so, please delete all files from the
"App_Data\DeviceDetection" folder and restart the instance once more.
Sitecore will download the Device Detection database again.
We looked into the App_Data of processing instance but DeviceDetection folder was not present. On further investigation we found that proxy setting needs to be applied to the processing server so that it can download the DeviceDetection database.
After applying proxy settings, DeviceDetection database got downloaded successfully. After a day, data started showing in Experience Analytics and new visits were also getting tracked.
Thank you so much Sitecore Support and sitecore stackexchange users who helped in resolving the issue.
| Reporting database stopped collecting data after certain date
We are working on Sitecore 9.3.
I see that the data in reporting database tables are present only till date - 27 May 2022. After that, no data has been collected.
In the experience profile, latest visits are getting updated but Experience Analytics is also not showing latest interactions.
Can anybody please suggest how to troubleshoot this issue?
Update 1 - Added screenshot of analytics dashboard
Update 2 -
After careful inspection of logs of last 3 months (time duration during which interactions are not showing), I found below 3 kinds of errors in logs -
1.
3940 03:07:55 ERROR [Path Analyzer] Interaction Interaction {5f4a2423-cdd3-0800-0000-066df7680cf5} could not be collected due to error
Exception: System.AggregateException
Message: One or more errors occurred.
Source: mscorlib at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification) at Sitecore.PathAnalyzer.Processing.TreeAggregator.GetContact(IEntityReference`1 contactReference) at Sitecore.PathAnalyzer.Processing.TreeAggregator.GetFullInteraction(Interaction interaction) at Sitecore.PathAnalyzer.Processing.TreeAggregator.Aggregate(ItemBatch`1 batch)
Nested Exception
Exception: Sitecore.XConnect.XdbCollectionUnavailableException
Message: An error occurred while sending the request.
Source: Sitecore.XConnect.Client at Sitecore.XConnect.Client.WebApi.CollectionBatchWebApiClient.<ExecuteBatch>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.XConnect.Client.Operations.HttpOperationInvoker.<Execute>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.XConnect.XdbContext.<ExecuteBatchAsyncInternal>d__101.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Sitecore.XConnect.XdbContext.<ExecuteBatchAsyncInternal>d__101.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.XConnect.XdbContext.<ExecuteAsync>d__68.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.XConnect.XdbContext.<GetAsync>d__62`1.MoveNext()
Nested Exception
Exception: System.OutOfMemoryException
Message: Exception of type 'System.OutOfMemoryException' was thrown.
Source: mscorlib at System.IO.MemoryStream..ctor(Int32 capacity) at System.Net.Http.HttpContent.LimitMemoryStream..ctor(Int32 maxSize, Int32 capacity) at System.Net.Http.HttpContent.CreateMemoryStream(Int64 maxBufferSize, Exception& error) at System.Net.Http.HttpContent.LoadIntoBufferAsync(Int64 maxBufferSize) at System.Net.Http.HttpClient.StartContentBuffering(HttpRequestMessage request, CancellationTokenSource cancellationTokenSource, TaskCompletionSource`1 tcs, HttpResponseMessage response) at System.Net.Http.HttpClient.<>c__DisplayClass55_0.<SendAsync>b__0(Task`1 task)
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.Xdb.Common.Web.CommonWebApiClient`1.<ExecuteAsync>d__41.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.XConnect.Client.WebApi.CollectionBatchWebApiClient.<ExecuteBatch>d__11.MoveNext()
6444 04:22:14 ERROR [Path Analyzer] Interaction Interaction {5f4a2423-cdd3-0800-0000-066dfa764874} could not be collected due to error
Exception: System.AggregateException
Message: One or more errors occurred.
Source: mscorlib at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification) at Sitecore.PathAnalyzer.Processing.TreeAggregator.GetContact(IEntityReference`1 contactReference) at Sitecore.PathAnalyzer.Processing.TreeAggregator.GetFullInteraction(Interaction interaction) at Sitecore.PathAnalyzer.Processing.TreeAggregator.Aggregate(ItemBatch`1 batch)
Nested Exception
Exception: Sitecore.XConnect.XdbCollectionUnavailableException
Message: An error occurred while sending the request.
Source: Sitecore.XConnect.Client at Sitecore.XConnect.Client.WebApi.CollectionBatchWebApiClient.<ExecuteBatch>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.XConnect.Client.Operations.HttpOperationInvoker.<Execute>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.XConnect.XdbContext.<ExecuteBatchAsyncInternal>d__101.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Sitecore.XConnect.XdbContext.<ExecuteBatchAsyncInternal>d__101.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.XConnect.XdbContext.<ExecuteAsync>d__68.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.XConnect.XdbContext.<GetAsync>d__62`1.MoveNext()
Nested Exception
Exception: Sitecore.Xdb.Common.Web.ConnectionTimeoutException
Message: A task was canceled.
Source: Sitecore.Xdb.Common.Web at Sitecore.Xdb.Common.Web.CommonWebApiClient`1.<ExecuteAsync>d__41.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.XConnect.Client.WebApi.CollectionBatchWebApiClient.<ExecuteBatch>d__11.MoveNext()
Nested Exception
Exception: System.Threading.Tasks.TaskCanceledException
Message: A task was canceled.
Source: mscorlib at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.Xdb.Common.Web.CommonWebApiClient`1.<ExecuteAsync>d__41.MoveNext()
5244 19:38:16 ERROR Exception when executing agent processing/taskAgent
Exception: Sitecore.Analytics.Processing.ProcessingTaskProviderException
Message: An unexpected error occurred during pick of a deferred single-threaded task.
Source: Sitecore.Analytics.Sql at Sitecore.Analytics.Processing.SqlTaskDataProvider.<GetProcessingTaskUsingRoutineAsync>d__51.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.Analytics.Processing.SqlTaskDataProvider.<PickDeferredActionAsync>d__45.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.Analytics.Processing.TaskQueue.<TryGetNextAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.Analytics.Processing.TaskAgent.<ExecuteCoreAsync>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.Analytics.Core.Agent.<ExecuteAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.Analytics.Core.AsyncBackgroundService.<ExecuteAgentAsync>d__22.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.Analytics.Core.AsyncBackgroundService.<RunAsync>d__26.MoveNext()
Nested Exception
Exception: System.InvalidOperationExceptionMessage: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
Source: System.Data at System.Data.Common.ADP.ExceptionWithStackTrace(Exception e)
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.Framework.TransientFaultHandling.Sql.SqlRetryHelper.<>c__DisplayClass18_0.<<OpenAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.Analytics.Processing.SqlTaskDataProvider.<GetProcessingTaskUsingRoutineAsync>d__51.MoveNext()
4172 19:38:16 ERROR Exception when executing agent aggregation/rebuildAgent
Exception: System.InvalidOperationExceptionMessage: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
Source: System.Data at System.Data.Common.ADP.ExceptionWithStackTrace(Exception e)
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.Framework.TransientFaultHandling.Sql.SqlRetryHelper.<>c__DisplayClass18_0.<<OpenAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.Analytics.Aggregation.History.SqlRebuildProcessStateDataProvider.<GetStateAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.Analytics.Aggregation.History.ReportingStorageManager.<ProcessRebuildAsync>d__27.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.Analytics.Aggregation.Data.Processing.RebuildAgent.<ExecuteCoreAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.Analytics.Core.Agent.<ExecuteAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.Analytics.Core.AsyncBackgroundService.<ExecuteAgentAsync>d__22.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.Analytics.Core.AsyncBackgroundService.<RunAsync>d__26.MoveNext()
5244 19:38:16 ERROR Exception when executing agent aggregation/historyWorker
Exception: Sitecore.Analytics.Aggregation.History.HistoryTaskProviderException
Message: The unexpected error occurred during retrieval of the history task.
Source: Sitecore.Analytics.Sql at Sitecore.Analytics.Aggregation.History.SqlHistoryTaskDataProvider.<TryGetHistoryTaskAsync>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.Analytics.Aggregation.History.HistoryTaskManager.<GetTaskStatusAsync>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.Analytics.Aggregation.History.HistoryTaskManager.<IsActiveAsync>d__20.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.Analytics.Aggregation.History.HistoryTaskManager.<GetInteractionsBatchSchedulerAsync>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.Analytics.Aggregation.Data.Processing.InteractionHistoryWorker.<GetBatchSchedulerAsync>d__21.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.Analytics.Aggregation.Data.Processing.InteractionHistoryWorker.<ExecuteCoreAsync>d__20.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.Analytics.Core.Agent.<ExecuteAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.Analytics.Core.AsyncBackgroundService.<ExecuteAgentAsync>d__22.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.Analytics.Core.AsyncBackgroundService.<RunAsync>d__26.MoveNext()
Nested Exception
Exception: System.InvalidOperationExceptionMessage: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
Source: System.Data at System.Data.Common.ADP.ExceptionWithStackTrace(Exception e)
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.Framework.TransientFaultHandling.Sql.SqlRetryHelper.<>c__DisplayClass18_0.<<OpenAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Sitecore.Analytics.Aggregation.History.SqlHistoryTaskDataProvider.<TryGetHistoryTaskAsync>d__18.MoveNext()
| |
Follow the below steps to integrate the Azure Active Directory(AD) with the Sitecore identity server. This will enable users login to Sitecore via organizations credentials using SSO.
Azure AD set up
Go to the Azure Active Directory module and create a new tenant by providing the organization name and domain.
Go to your directory and click on App registration then click on ‘New Registration’. Give this app a name and select the tenant we have created and give Sitecore identity server URL (append /signin-oidc) in ‘Redirect URI’ field.
Note down the Client ID and tenant ID. You’ll need these when configuring Sitecore Identity.
Go to the manifest tab and edit “groupMembershipClaims” setting to “SecurityGroup“.
Setup Sitecore Identity
Navigate to the identity server instance and go to this path \sitecore\Sitecore.Plugin.IdentityProvider.AzureAd\Config.
Open Sitecore.Plugin.IdentityProvider.AzureAd.xml for edit. You can change the display name. Give the values of client ID and Tenant ID which we noted down from Azure AD. Don’t forget to change Enabled to true.
Restart the Sitecore identity server and try to login to CMS. You should see the Azure AD login option.
Mapping the AD users with Sitecore:
Go to the Azure portal and create a new security group and add users to this group. Note down the Object ID of this group.
Now open the Sitecore.Plugin.IdentityProvider.AzureAd.xml placed at \sitecore\Sitecore.Plugin.IdentityProvider.AzureAd\Config in Sitecore identity instance and uncomment the AzureADUserToAdminUser node. Paste the Azure security group ID. It will make all the security user groups members admin.
To Skip the Sitecore Login Page:
Open this config file: Sitecore.Owin.Authentication.config file under App_Config/Include folder.
Set as the "loginPage" attribute for any site that your Azure AD users have access to. Like in below config, I changed login Page for admin site to $(loginPath)admin/IdentityServer/IdS4-AzureAd
<!-- LOGIN PATH variable
Specifies the login path prefix for federated authentication. It should be used in the "site" nodes in the "loginPage" attribute.
The full login path must have this structure:
$(loginPath)site_name/identity_provider
or
$(loginPath)site_name/identity_provider/inner_identity_provider,
The site_name must have the "name" attribute value of the "site" node where the login path is set.
The "identity_provider" must have the "id" attribute value of the configured identity provider that you want to use.
The "inner_identity_provider" must be equal to the name or AuthenticationScheme of the underlying identity provider in the "identity_provider".
Note: The "inner_identity_provider" value is sent to the "identity_provider" as an acr_value - idp:inner_identity_provider. Thus, identity_provider have to support acr_value.
Examples:
<sites>
<site name="shell" set:loginPage="$(loginPath)shell/IdentityServer"/>
<site name="admin" set:loginPage="$(loginPath)admin/IdentityServer/IdS4-AzureAd"/>
</sites> -->
This will skip the default login page and go straight to the Azure AD login.
You can read all the steps in detail here: https://sitecorewithraman.wordpress.com/2021/01/01/sitecore-cms-azure-ad-integration
| How to do Sitecore SSO integration with Azure AD?
We have to do the Sitecore SSO integration with Azure AD and need to skip the login page. Is there any document to verify the steps?
| |
To get rid of the Marketing Applications buttons on the Sitecore launchpad, we can switch to the core database through the Sitecore desktop, then go to the item path
/sitecore/client/Applications/Launchpad/PageSettings/Buttons/Marketing
From here, we can delete the entire Marketing subtree. After doing this, the instance will automatically restore a child item Forms, which is expected because XM still allows users to use this feature. To understand more about this, Sitecore recommends this article:
https://doc.sitecore.com/xp/en/developers/102/platform-administration-and-architecture/sitecore-xp-feature-compatibility-in-xm-scaled-packages.html.
Unfortunately, Sitecore does not have any simple steps to recommend to completely get rid of all analytics and marketing items from our databases. The above-suggested step only helps to hide the buttons, which should be enough to prevent our instance from running into any error related to Marketing and Analytics.
Some other ways we can try:
If we did not add any custom item to your core database, then we can simply consider discarding the old core database and using the new core database which came with your fresh XM installation.
If we have custom items in the core database, we can try to add them into an item package using package designer (accessible from the desktop), which allows for creating item packages from core database items. Then, install the item package on your new XM core DB.
I have used the Sitecore Razl: Tool for Compare and Merge the database and find out the customization into the core DB.
For more details about the Sitecore Razl refer to the documentation: https://hedgehogdevelopment.github.io/razl/comparing.html
Note: I raised the support ticket to Sitecore and there is no documented and tested upgrade path from XP to XM, unfortunately, Sitecore doesn't have such SQL scripts.
| Upgrade Sitecore 8.2 XP Database to Sitecore 10.2 XM Database
This question is related to the upgrade approach of the Sitecore Database. There are plenty of documents available on Sitecore and other blog posts and articles about How to upgrade the Sitecore database, but this is different.
I have an application in Sitecore 8.2 XP and it needs to be migrated on Sitecore 10.2 XM, please focus on instance XM instead of XP.
Sitecore 8.2 XP instance launchpad as below:
Sitecore 10.2 XM instance launchpad as below:
I have upgraded the Database using the SQL scripts provided by Sitecore here and now my Sitecore 10.2 XM instance launchpad as below:
Can anyone please guide how can I get rid of these icons and options under the Marketing Application section?
Note:
I have not published code yet on the Sitecore 10.2 XM instance, I have attached only the upgraded Database. So there are no config and other changes.
I have also run the Sitecore UpdateApp Tool, after upgrading the database.
| |
To solve the issue, do the following.
You need to upgrade the current .net framework to .NETFramework 4.8
Then you need to install Sitecore.Kernel 10.2.0,
Then it should resolve the issue.
For more reference use this link.
https://sitecore.myget.org/feed/sc-packages/package/nuget/Sitecore.Kernel
https://support.sitecore.com/kb?id=kb_article_view&sysparm_article=KB0087164
| Sitecore.Kernet Package installation from Nuget Package Manager error
When I am trying to install Sitecore.Kernel or any other package from Nuget Package Manager i am getting this error
| |
This reporting DB has a table Fact_PageViews. The fact table is a data warehousing term used to describe tables that contain measurements and metrics. In a fact table, foreign keys allow join to be made with dimension tables. The Fact_PageViews table contains statistical data about online or offline contact interaction. The table structure looks like this.
Read more:
https://pushpaganan.home.blog/2022/06/05/sitecore-analytics-report-query/
Fact_FormSummary contains the summary for each field in different forms. For example, it has the following data
Read more:
https://www.linkedin.com/pulse/how-power-sitecore-wffm-through-sql-rohit-chopra
A contact represents an individual who interacts with or may potentially interact with your organization. Contacts are represented by the Sitecore.XConnect.Contact class, and are uniquely identified by ID (of type Guid) within the xDB. IDs are generated by the service layer when a contact is saved and should not be saved outside the xDB. Contacts also have one or more identifiers that identifies the contact to systems outside the xDB.
Read more: https://doc.sitecore.com/xp/en/developers/90/sitecore-experience-platform/contacts.html
| What is the meaning of some Tables in the Reporting database?
I am working with Sitecore Reporting Database to analyze the website, but I don't know the purpose of each tables and their relationship.
It would be great help if someone share some documents around this.
If not, can someone explain the purpose of dbo.Fact_PageViews, dbo.Fact_FormSummary and dbo.Contacts
| |
I hope you have also performed the Clean up the content databases. Database clean-up is a one-time operation. If not then please follow the below steps:
The Sitecore.UpdateApp is a standalone console tool.
To clean up the content databases:
On the Sitecore Launchpad, open the Control Panel, in the Database section, click Clean up databases, select all the databases, and then click Clean.
Locate the Sitecore.UpdateApp 1.2.0 for Sitecore X.X.X rev XXXXXX.zip file that you downloaded earlier and extract its contents to a folder, for example, C:\Sitecore.UpdateApp.
Copy the license file to the Data folder of the tool, for example, C:\Sitecore.UpdateApp\Data\license.xml.
In the C:\Sitecore.UpdateApp\App_Config\ConnectionStrings.config file, update the connections to your databases.
If you do not have a security database, use the connection to the core database.
Add the upgrade resources from every module and connector to the UpdateApp Tool files.
You can download the upgrade packages for the different versions of the Sitecore modules from the Sitecore downloads site and you can find links to the compatible modules on the Sitecore XP downloads page.
Download the items as resources zip file for the module version that is installed on your solution. If the module or the connector has several versions, there are separate folders for each version.
Unpack the zip file into a local folder, for example, c:\ModulesUpgradeResources\[Module Name].
Copy all the subfolders and files from the Data folder, for example, from c:\ModulesUpgradeResources\[Module Name]\X.X.X\Data.
Paste all the subfolders and files into the UpdateApp Data folder, for example, C:\Sitecore.UpdateApp\Data.
Repeat this procedure for every module and connector.
Open a Command Prompt in the tool folder and run: Sitecore.UpdateApp.exe clean
The number of items that are removed from each database is listed in the Command Prompt window.
Detailed information about any modified items that are skipped is written to the log files in the tool folder – \Data\logs.
To clear the caches, open the <instance_url>\sitecore\admin\cache.aspx page, click Refresh, and then click Clear.
| Duplicate Content Items appearing during Sitecore Upgrade to 10.2
We are in process of upgrading Sitecore 8.2 to 10.2
Have ran the upgrade scripts on the existing databases as mentioned in the Upgrade guide. In the Sitecore Content Editor, its displaying duplicate items throughout the tree structure. Duplicate items has same ID.
Tip: Sitecore 8.2 solution was using TDS but we are not using it for 10.
Please check the screenshot.
Can someone please help?
| |
Update rendering engine with a query parameter in configure services
services.AddSitecoreRenderingEngine(options =>
{
//Register your components here
options
.MapToRequest(
(httpRequest, sitecoreLayoutRequest) => sitecoreLayoutRequest.Language(**httpRequest.Query["lang"]**));
})
Then call API with passing lang in query string
https://HostingAPI/APIEndpoints?lang=en-au
| Alternative way of calling Layout API from .Net core App
In Sitecore 10.2 (Using .Net Core rendering SDK), is there any altervative way to call Layout API apart from below example.
public class DefaultController : Controller
{
[UseSitecoreRendering]
public IActionResult Index(Route route)
{
return View(route);
}
}
I want to call Layout API and populate route object instead of Middleware filter as shown above so that I can modify request param for Layout API.
| |
In my current environment we have the following (Sitecore XM 10.2):
DEV : Configured as a standalone instance where a single instance of MSSQL hosts all databases. This is running on the local workstation.
INT : The first integrated environment configured as a standalone instance like DEV.
TST : Environment that closely mimics the production configuration. One MSSQL instance for the ContentManagement role and another for the ContentDelivery role. The CM role has a Core and Master database. The CD role has a Core and Web database. In my case, the Core db is NOT shared between CM/CD.
PRD : Configured like TST but more secure.
When it comes to moving changes between environments you'll want to consider which are part of the CI/CD pipeline (i.e. code, config, items) and what is content managed by authors that could be synced across environments as needed (e.g. home and descendants and media items). Remember that this is a CMS and content items in lower environments should not matter much; although if you decide to create content in lower environments to speed up the process then you can pick which method is best to move up through environments.
Each environment could/should have a single master db that corresponds with the ContentManagement role. The publishing targets (e.g. Internet aka web) are then largely based on your business needs. Sometimes you see publishing targets for different geographical locations or perhaps line of business.
| How many Master databases should you have across all environments?
This is going to sound like a real newbie question but is something I can't get my head round in terms of how our real world setup compares to what was taught in Sitecore training.
So - in the simplest, single environment/instance, example: you have 1 Master & 1 Web, new items are added to Master and then, to make them show on the site, they are published to Web.
Real world: we have 3 environments (DEV, UAT and PROD) which each have 1 Master & 1 Web. New content is added on PROD Master and published to PROD Web. New functionality is added on DEV Master and published to DEV Web and then, once signed off, is recreated on UAT(or PROD) Master and published to UAT(or PROD) Web. There are then, semi-regular, backups made of PROD Master & Web which are restored to DEV and UAT.
In my mind (and from what I, possibly mistakenly, remember from training) I am thinking that, in the real world, it should be possible for ... DEV to have 1 Master & 1 Web but UAT and PROD should each only have 1 Web. All new content/functionality is added to DEV Master and then published to DEV Web, UAT Web and then PROD Web.
Am I missing something obvious here ?
| |
finally not clicking space will skip the manifest file.
| NextJs JSS Setup Error generating manifest Error: Unable to load manifest require
Trying to setup NextJs JSS and ran only the below simple commands and it fails with below error for the 4th command but this folder/files doesn't exist. None of the below 4 commands creates those files. What am I missing here?
npx create-sitecore-jss
jss setup
jss deploy config
jss deploy app -c -d
Error generating manifest Error: Unable to load manifest require D:\Sitecore\POC_Headless\nextjs\sitecore\definitions\config.js: Error: Cannot find module 'D:\Sitecore\POC_Headless\nextjs\sitecore\definitions\config.js'
| |
The defaultSolrIndexConfiguration node is located under: .\App_Config\Sitecore\ContentSearch\Sitecore.ContentSearch.Solr.DefaultIndexConfiguration.config
You could create a custom index configuration node that is referenced by your custom index.
Warning: Don't do this for any of the out-of-the-box indexes since Sitecore relies on those index configurations to run properly.
Example
If I were to create a custom index for blog articles named sitecore_blog_master_index, my index configuration would look something like this
(pay attention to the configuration/sitecore/contentSearch/configuration/indexes/index/configuration node):
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/" xmlns:search="http://www.sitecore.net/xmlconfig/search/">
<sitecore role:require="Standalone or ContentManagement" search:require="solr">
<contentSearch>
<configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
<indexes hint="list:AddIndex">
<index id="sitecore_blog_master_index" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
<param desc="name">$(id)</param>
<param desc="core">$(id)</param>
<param desc="propertyStore" ref="contentSearch/indexConfigurations/databasePropertyStore" param1="$(id)" />
<configuration ref="contentSearch/indexConfigurations/blogSolrIndexConfiguration">
<enableReadAccessIndexing>true</enableReadAccessIndexing>
</configuration>
<strategies hint="list:AddStrategy">
<strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/manual" role:require="ContentManagement and !Indexing" />
<strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/intervalAsyncMaster" role:require="Standalone or (ContentManagement and Indexing)" />
</strategies>
<locations hint="list:AddCrawler">
<crawler type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch">
<Database>master</Database>
<Root>/sitecore</Root>
</crawler>
</locations>
<enableItemLanguageFallback>false</enableItemLanguageFallback>
<enableFieldLanguageFallback>false</enableFieldLanguageFallback>
</index>
</indexes>
</configuration>
</contentSearch>
</sitecore>
</configuration>
You'd need to make sure to define your blogSolrIndexConfiguration element. You've got two options for this.
Option 1
The easiest thing to do is copy the defaultSolrIndexConfiguration element that I referenced above into your custom index config file, changing the element name to blogSolrIndexConfiguration. This results in a lot of duplicated configuration that makes your index harder to support in the future.
Option 2
Another solution would be to use the ref attribute to reference the subelements from the defaultSolrIndexConfiguration in your blogSolrIndexConfiguration. It would look something like this:
<sc.variable name="defaultSolrIndexConfiguration"
value="contentSearch/indexConfigurations/defaultSolrIndexConfiguration/" />
<blogSolrIndexConfiguration type="Sitecore.ContentSearch.SolrProvider.SolrIndexConfiguration, Sitecore.ContentSearch.SolrProvider">
<initializeOnAdd ref="$(defaultSolrIndexConfiguration)initializeOnAdd" />
<fieldMap ref="$(defaultSolrIndexConfiguration)fieldMap"/>
<mediaIndexing ref="$(defaultSolrIndexConfiguration)mediaIndexing"/>
<virtualFields ref="$(defaultSolrIndexConfiguration)virtualFields"/>
<fieldReaders ref="$(defaultSolrIndexConfiguration)fieldReaders"/>
<indexFieldStorageValueFormatter ref="$(defaultSolrIndexConfiguration)indexFieldStorageValueFormatter"/>
<indexDocumentPropertyMapper ref="$(defaultSolrIndexConfiguration)indexDocumentPropertyMapper"/>
<documentBuilderType ref="$(defaultSolrIndexConfiguration)documentBuilderType"/>
<defaultSearchSecurityOption ref="contentSearch/indexConfigurations/defaultSearchSecurityOption" />
<enableReadAccessIndexing ref="contentSearch/indexConfigurations/enableReadAccessIndexing" />
<searchOptions ref="$(defaultSolrIndexConfiguration)searchOptions"/>
<highlightOptions ref="$(defaultSolrIndexConfiguration)highlightOptions"/>
<documentOptions type="Sitecore.ContentSearch.SolrProvider.SolrDocumentBuilderOptions, Sitecore.ContentSearch.SolrProvider">
{{Custom Configuration Goes Here}}
</documentOptions>
</blogSolrIndexConfiguration>
This minimizes the duplication of configuration, allowing you to define specifically what's custom to your solution.
| Define computed index fields for a specific index
I'm using Sitecore 10.2.
I want to define a custom computed field but I need it to be added to a specific index only.
I was able to add the computed field globally as below, but I need to specify it for one index only in SOLR, is there a way to do so?
<defaultSolrIndexConfiguration type="Sitecore.ContentSearch.SolrProvider.SolrIndexConfiguration, Sitecore.ContentSearch.SolrProvider" >
<documentOptions type="Sitecore.ContentSearch.SolrProvider.SolrDocumentBuilderOptions, Sitecore.ContentSearch.SolrProvider">
<fields hint="raw:AddComputedIndexField">
<field fieldName="mycustomfield" returnType="textCollection">Project.Web.Search.ComputedFields.MyCustomField, Project.Web</field>
</fields>
</documentOptions>
</defaultSolrIndexConfiguration>
| |
There is an out of the box report you can use as an example:
By default it only provides image filtering but you could copy/extend to include other types.
Example: Here is the sample report in which you could enhance.
$sizeOptions = [ordered]@{
"100 KB" = 100000
"250 KB" = 250000
"500 KB" = 500000
"1 MB" = 1000000
"5 MB" = 5000000
"10 MB" = 10000000
}
$typeOptions = [ordered]@{
"gif" = 1
"jpg, jpeg" = 2
"pdf" = 3
"png" = 4
"svg" = 5
}
$settings = @{
Title = "Report Filter"
Icon = [regex]::Replace($PSScript.Appearance.Icon, "Office", "OfficeWhite", [System.Text.RegularExpressions.RegexOptions]::IgnoreCase)
OkButtonName = "Proceed"
CancelButtonName = "Abort"
Description = "Filter the results based on the media size and type"
ShowHint = $true
Parameters = @{
Name = "selectedSize"
Value = 250000
Options=$sizeOptions
Title = "Larger Than"
Tooltip = "Filter the results for items larger than the specified size"
Editor = "combo"
}, @{
Name = "selectedTypeValues"
Value = 2,4
Options = $typeOptions
Title = "Media Extension"
Tooltip = "Filter the results for items with the specified extension"
Editor = "checklist"
Validation = { $_.Value -ne $null }
}
}
$result = Read-Variable @settings
if($result -ne "ok") {
exit
}
$selectedType = @()
foreach($val in $selectedTypeValues) {
switch($val) {
1 { $selectedType += "gif" }
2 { $selectedType += "jpg","jpeg"}
3 { $selectedType += "pdf" }
4 { $selectedType += "png" }
5 { $selectedType += "svg" }
}
}
$mediaItemContainer = Get-Item -Path "master:\media library"
$items = $mediaItemContainer.Axes.GetDescendants() |
Where-Object { $selectedType -contains $_.Fields["Extension"].Value -and [int]$_.Fields["Size"].Value -gt $selectedSize } |
Initialize-Item | Sort-Object -Property Size -Descending
$reportProps = @{
Title = "Media by size and type"
InfoTitle = "Media filtered by file size and extension"
InfoDescription = "Media found larger than $($selectedSize) bytes. Some paths included with a default installation were ignored."
Property = @("Name","TemplateName","Size", "Extension","ItemPath")
}
$items | Show-ListView @reportProps
Close-Window
You can update the script to filter for the additional file types. The dialogs are not required but would be helpful in making this report reusable. The final output can be exported to csv from the report view (Show-ListView).
| How to get media library item names in csv which has file extension .pdf, .doc and .xls?
I am looking for a solution to list items in the media library with file extensions pdf, doc, and xls followed by exporting to a csv.
| |
You can't directly store Null or Empty value but you can assign nullValue or EmptyString value as shown below
<fieldType fieldName="gender" returnType="text" nullValue="NULLVALUE" emptyString="EMPTYVALUE"/>
Reference Link -
https://doc.sitecore.com/xp/en/developers/90/sitecore-experience-manager/queries-for-null-or-empty-strings.html
Regarding GUID, Sitecore will always remove "{","}","-" as it usages ShortID.Encode(guid) to cleanup before GUID gets indexed but this can be achieved with the help of Update Request Processors. Every update request received by Solr is run through a chain of plugins known as Update Request Processors.
You can reference SO link for more info - https://stackoverflow.com/a/60375628/2580562
| SOLR Index: needs to show field although it is null. Also can we have actual itemid instead of guid in index fields
We are building some specific indexes for third party and they have specific requirement.
Always needs to have all fields, so if field is null then they want field with empty ("") value.
We tried with setting default value to field but it didn't worked
Also we need it for all fields i.e. default + computed
They want actual Sitecore item ID instead of Guid e.g. _group to be {F35E4CB3-3EB9-4FC2-9211-EB9F74D35F0B} instead of f35e4cb33eb94fc29211eb9f74d35f0b
| |
To solve the issue, performed the below steps::
Go to the Sitecore instance and open Sitecore.Horizon.Integration.config file
{root directory}\ sc102xmcm.local\ App_Config\Modules\Horizon\Sitecore.Horizon.Integration.config
Search setting name Horizon.ClientHost
<setting name="Horizon.ClientHost" value="https:// horizon.sc102xmcm.local" />
It's pointing to the old URL, now update it with the new URL:
<setting name="Horizon.ClientHost" value="https:// horizon.abc.com" />
Go to the Sitecore Horizon instance and open Host.xml file
{root directory}\ horizon.sc102xmcm.local \Config\Host.xml
Search <HostBaseUrl>
<HostBaseUrl> https:// horizon.sc102xmcm.local" /></HostBaseUrl>
Again, it's pointing to the old URL, now update it with the new URL:
<HostBaseUrl> https:// horizon.abc.com</HostBaseUrl>
| Sitecore Horizon error: Failed to render a page. Error message is logged
After installation of Sitecore Horizon when I hit the Horizon URL in the browser, it's throwing me an error:
I have checked the Horizon log file in the Horizon directory in IIS and the error log is:
[ERR] (Sitecore Authoring Host/EC2AMAZ-9FC5VOM) [Sitecore.FederatedUI.PageComposer] Failed to render a fragment "Horizon.App" in region "Shell.Main", with error: "Failed to start rendering"
System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.
---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host..
---> System.Net.Sockets.SocketException (10054): An existing connection was forcibly closed by the remote host.
--- End of inner exception stack trace ---
at System.Net.FixedSizeReader.ReadPacketAsync(Stream transport, AsyncProtocolRequest request)
at System.Net.Security.SslStream.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.Security.SslStream.EndProcessAuthentication(IAsyncResult result)
at System.Net.Security.SslStream.EndAuthenticateAsClient(IAsyncResult asyncResult)
at System.Net.Security.SslStream.<>c.<AuthenticateAsClientAsync>b__65_1(IAsyncResult iar)
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean allowHttp2, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.DecompressionHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.DiagnosticsHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.Logging.LoggingScopeHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at Sitecore.FederatedUI.PageComposer.Loader.HttpFragmentRenderer.RenderFragment(ServerRendering serverRendering, ExtensionContext extensionContext, RequestContext requestContext, CancellationToken token)
| |
Each time you run the serialization commands, the Sitecore Content Serialization (SCS) system automatically validates the content items in your file system against the content items in a Sitecore instance to make sure that they all are in the right place and that their references are in order. you can perform a manual validation of your content items using sitecore ser validate command.
Since you are getting validation errors you can fix it by running -
sitecore ser validate --fix
This command will correct the most common issues. In your case, it will delete the files which are extra. Also If the --fix command finds duplicate content items in your file system, it keeps the last updated one and deletes the oldest one. For example, if you renamed an item and added it to the repository, but the old copy (with the same ID) remains in the repository, the --fix argument deletes the old copy and keeps the version with the new name.
| Sitecore serialization dotnet sitecore ser validate error
I am getting this error whenever i am running command dotnet sitecore ser validate.How to fix.
| |
This issue is solved after the below steps:
Go to this location /sitecore/system/Data Exchange/Connect for Dynamics Tenant Branch/Endpoints/Providers/xConnect/xConnect Client Endpoint
Go to the Collection Model Path which is /sitecore/system/Settings/Data Exchange/Providers/xConnect/Collection Models/Connect for Dynamics/Connect for Dynamics Collection Model
Click on Convert Model to JSON, and it will download the JSON file.
-
Deploy this JSON file to below two locations:
<xConnectWebsite>\App_Data\jobs\continuous\IndexWorker\App_Data\Models
<xConnectWebsite>\App_Data\Models
| 'Sitecore.DataExchange.Tools.DynamicsConnect.Models.DynamicsConnectCollectionModel, 1.0' does not have a remote version
I have installed Data Exchange Framework 7.0.0 and Sitecore Connect™ for Microsoft Dynamics 365 for Sales 7.0.0 in Sitecore 10.2. In this location /sitecore/system/Data Exchange/Connect for Dynamics Tenant Branch/Endpoints/Providers/xConnect/xConnect Client Endpoint, I have added Collection Service Connection String Name (xconnect.collection) and Collection Service Certificate Connection String Name (xconnect.collection.certificate).
but when I am getting the error Run Troubleshoot I am getting below error:
Below error is coming on the log file:
14448 13:01:41 ERROR [Data Exchange] at Sitecore.Xdb.Common.Web.Synchronous.SynchronousExtensions.SuspendContextLock[TResult](Func`1 taskFactory)
at Sitecore.XConnect.Client.XConnectSynchronousExtensions.SuspendContextLock(Func`1 taskFactory)
at Sitecore.DataExchange.Providers.XConnect.Client.BaseXConnectServiceClientConverter`1.CreateNewClientConfiguration(XConnectClientSettings settings)
at Sitecore.DataExchange.Providers.XConnect.Client.BaseXConnectServiceClientConverter`1.Convert(XConnectClientSettings settings)
at Sitecore.DataExchange.Providers.XConnect.DefaultXConnectClientHelperFactory.ToXConnectClient(XConnectClientSettings clientSettings)
at Sitecore.DataExchange.Providers.XConnect.Troubleshooters.TestXConnectClientEndpointConnection.Troubleshoot(Endpoint endpoint, TroubleshooterContext context)
| |
You can create computed index field and write logic according to that if Summary field is empty in that case it will go to Body field. And logic will be like that into your computed index field class. It is not exact code it's only condition should be like below.
public object ComputeFieldValue(IIndexable indexable)
{
Item item = indexable as SitecoreIndexableItem;
if (item == null)
return null;
if(!string.IsNullOrEmpty(item.Fields["Summary"].Value)) {
return item.Fields["Summary"].Value
}
else {
return item.Fields["Body"].Value
}
}
Then use this computed index field into your query and rebuild your indexes, I think it will start working.
Hope it helps you.
| How to get dynamic Summary or short description from Solr index
I am constructing a listing page by querying Solr Index where I am getting
[Title], [Summary], [Published Date], [Body] etc.,
The Solr index is returning all the indexed fields and so far so good. The problem for me is if [Summary] field is not populated by the content author, I have to get some dynamic text (like a couple of lines) from [Body] field, which is an RTE. Any thoughts/ ideas on how to achieve this?
| |
This happens because the media is cached in the browser for the time specified in the MediaResponse.MaxAge setting. If a browser has already accessed the media item, it may not perform any requests to the server and may retrieve the media item from its cache until the cached version expires.
To force the browser to always check whether the media item has changed since the last request, and download a new version if necessary, you need to set the MediaResponse.MaxAge setting in the Sitecore.config file to 00:00:01. This makes Sitecore set Cache-Control: max-age and Expires headers of the HTTP response for media requests to 1 second.
<!-- MEDIA RESPONSE - MAX AGE
The <see cref="HttpCachePolicy.SetMaxAge">max age</see> to use in media response headers.
Set it to "00:00:00" to omit this header.
Default value: 7.00:00:00 (seven days)
-->
<setting name="MediaResponse.MaxAge" value="00:00:01" />
For more details refer to this KB article:
https://support.sitecore.com/kb?id=kb_article_view&sysparm_article=KB0218124
| Latest Versioned Media Item is not Updating on Front End Website
We are using Versioned Media Items on our website.
Our media URLs will be in the format -
https://domain/-/media path.pdf?sc_lang=en&hash=6952A5CAEA1FC60BEF7CCDF29B0293E2
After we attach a pdf file in the latest version and publish,media url in the front end website remains same (https://domain/-/media path.pdf?sc_lang=en&hash=6952A5CAEA1FC60BEF7CCDF29B0293E2) and also we are able to view only the old pdf file but not the latest one.
We checked the Web DB and latest published file is available there. Only after manually clearing cache we are able to view the latest file.
Is any fix available for getting latest versioned file on front end site after publishing without the need of manual cache clear?
| |
You need to override the existing configurator that registers the health check for Solr. This can be found in the patch Sitecore.ContentSearch.Solr.DefaultIndexConfiguration.config.
<configurator type="Sitecore.ContentSearch.SolrProvider.DependencyInjection.ContentSearchServicesConfigurator, Sitecore.ContentSearch.SolrProvider"/>
Internally there is a function for loading the list of Solr core names from configuration.
var path = "sitecore/contentSearch/configuration/indexes/index/param[@desc='core']"
XmlNodeList xmlNodeLists = ConfigReader.GetConfiguration().SelectNodes(path);
One solution would be to patch in a list of cores to ignore and then override this code to handle the rest.
| Can we exclude indexes to check in the /healthz/ready probe used in Sitecore Docker containers or Sitecore Managed Cloud?
In Sitecore Docker implementations and Sitecore Managed Cloud implementations, containers have a liveness probe that determines whether the Sitecore instance is ready and alive. In cases where it fails, it brings down the container and attempts to restart it.
One of these health checks is a Solr Dependency check. This check takes the list of indexes that are configured in Sitecore and attempts to find them in the local environment.
In most cases, this is sufficient. But there are index customizations available today that allow an index to be sourced from a different Solr environment, and not need to be created in the Solr environment that is listed in ConnectionStrings.config. (Think SaaS based Solr Cores).
In these cases, is there a way to exclude (or include) specific indexes in which the liveness probe should check (or ignore)?
| |
If you want to make the rendering variant access the current page, mention the datasource "page:"
| SXA component with rendering variant does not render if datasource is empty in the rendering
I am using an SXA component to render fields from current page. But it seems rendering variant renders fields only from datasource item.
In my case, datasource is empty as I need to render fields from current page item so it does not renders anything.
As a work around I am passing a dummy datasource and then in scriban template, I am assigning current page to current item like: i_item=i_page
Please suggest if there is a better solution to this.
| |
In the Experience Analytics section go to the date button and click on it. You will see the different-different option there, from where you can choose the day or date for which you want to view the data.
| FXM Analytics showing incorrect date
Using Sitecore 10.2
I created a local site on Aug 25, 2022, to understand FXM.
In FXM, the data for that site shows as 21 Aug 2022. Is this expected?
Also, when I refresh that local site incognito, I'm expecting the "Visits" in FXM analytics would increase. But that is not happening.
| |
You can manage placeholders and other FXM-related things from here -
/sitecore/system/Marketing Control Panel/FXM
You can follow below link to know more about placeholders - https://doc.sitecore.com/xp/en/developers/90/sitecore-experience-platform/add-a-placeholder-on-an-external-website-in-fxm.html
| FXM - How to delete placeholders
I no longer need these placeholders. How can I delete them?
While adding the second placeholder, mistakenly, I selected Replace which is overlapping some text and now I do not see an option to delete.
| |
Sitecore has recently launched the Partner Technical Advisory support service.
The Partner Technical Advisor (PTA) team is a team of expert developers and subject matter experts who provide partners with pre-sales, sales, implementation, and ongoing support and advocacy.
Getting started:
How to engage a PTA using Service Now, Sitecore’s case management system:
Navigate to the Support Portal and log in
Click on Support Cases
Click on Partner Technical Advisor in the gray horizontal navigation bar
Complete the simple form and add attachments as needed
Click Submit (Note: You will receive an acknowledgment via email)
All correspondence must be conducted through Service Now
Frequently Asked Questions (FAQs):
Do I need to be certified to engage with a PTA?
PTAs are intended to support partner resources who are already trained and certified (or are actively pursuing certification).
When should I engage a PTA for implementation review?
Requests for implementation review should be done before the commencement of the project.
Are there any requirements for engaging a PTA in an implementation review?
An implementation review will only be offered if the partner has put a minimum of three appropriately certified team members on the project.
What does an engagement with a PTA look like? How often will we meet?
A lead PTA will determine the right cadence of check-ins to be followed over the course of the project (Minimum: one check-in every two weeks).
Can I set up a Service Level Agreement (SLA) with the PTA team?
There are no SLAs on PTA requests. The commitment is the best effort only. Partners who need committed response times should engage with professional services.
Can I use PTAs as an extension of my development team?
PTAs are advisory only. They will not create deliverables for partners.
What are some things PTAs won’t help with?
PTAs will not assist with product defects. Suspected defects should be routed through support. PTAs also do not handle any issues related to pricing, program compliance, etc.
Do take note that only certified Sitecore Developers can raise tickets on the support portal.
| What is a PTA Partner Tech Advisor, added to the Sitecore Support portal?
What is a PTA Partner Tech Advisor, added to the Sitecore Support portal?
| |
After investigating, I found that Sitecore's Connection string uses a configBuilders attribute.
<connectionStrings configBuilders="SitecoreConnectionStringsBuilder">
......
</connectionStrings>
The encryption command tries to resolve this configBuilders on the on-premise server, to fix this issue, we need to remove this attribute with value (configBuilders="SitecoreConnectionStringsBuilder") before performing the encryption command. So our connection string should be like the below -
<connectionStrings>
......
</connectionStrings>
| Connection String Encryption is throwing error in command prompt
We have a requirement of encrypting the connection string of a Sitecore application with some external database entries in connectionstring.config file. We are using the below command to perform this operation-
C:\Windows\Microsoft.NET\Framework64\v4.0.30319>Aspnet_regiis.exe -pef "connectionStrings" "C:\Encryption"
Where C:\Encryption is our path of the website root. but we are getting below error while running this command -
Microsoft (R) ASP.NET RegIIS version 4.0.30319.0
Administration utility to install and uninstall ASP.NET on the local machine.
Copyright (C) Microsoft Corporation. All rights reserved.
Encrypting configuration section...
An error occurred loading a configuration file: Could not load file or assembly 'Microsoft.Configuration.ConfigurationBuilders.Environment, Version=1.0.0.0, Culture=neutral' or one of its dependencies. The system cannot find the file specified. (D:\temp\test\App_Config\ConnectionStrings.config)
Could not load file or assembly
'Microsoft.Configuration.ConfigurationBuilders.Environment,
Version=1.0.0.0, Culture=neutral' or one of its dependencies. The
system cannot find the file specified. Failed!
how to fix this?
| |
Configuration builders provide a modern and agile mechanism for ASP.NET apps to get configuration values from external sources.
Configuration builders:
Are available in .NET Framework 4.7.1 and later.
Provide a flexible mechanism for reading configuration values.
Address some of the basic needs of apps as they move into a container and cloud-focused environment.
Can be used to improve the protection of configuration data by drawing from sources previously unavailable (for example, Azure Key Vault and environment variables) in the .NET configuration system.
Reference - https://docs.microsoft.com/en-us/aspnet/config-builder
From Sitecore 9.3 onwards, the connectionstrings.config file refers to the configBuilder SitecoreConnectionStringsBuilder to provide support for the container and cloud-focused environment. When we look on the web.config, we will find that the SitecoreConnectionStringsBuilder uses the Microsoft.Configuration.ConfigurationBuilders.EnvironmentConfigBuilder class. This class will read the connectionstring from the environment settings. The config section also defines that the connectionstrings are prefixed with Sitecore_ConnectionStrings_ -
<configBuilders>
<builders>
<add name="SitecoreAppSettingsBuilder" mode="Strict" prefix="SITECORE_APPSETTINGS_" stripPrefix="true" type="Sitecore.Configuration.FlexibleEnvironmentConfigBuilder, Sitecore.Kernel" />
<add name="SitecoreConnectionStringsBuilder" mode="Strict" prefix="SITECORE_CONNECTIONSTRINGS_" stripPrefix="true" type="Microsoft.Configuration.ConfigurationBuilders.EnvironmentConfigBuilder, Microsoft.Configuration.ConfigurationBuilders.Environment, Version=1.0.0.0, Culture=neutral" />
</builders>
</configBuilders>
Since on our local or on-premise servers where we are not using docker, this attribute is not in use so if required we can simply remove this attribute.
| What is configBuilder “SitecoreConnectionStringsBuilder” in Sitecore Connection string?
From Sitecore 9.3 onwards, we noticed that the connection string is using a new attribute configBuilder. Its value is SitecoreConnectionStringsBuilder and if we remove this attribute from an on-premise server it does nothing. so the question here is what is the use of this attribute and what it is?
<connectionStrings configBuilders="SitecoreConnectionStringsBuilder">
......
</connectionStrings>
| |
From what you wrote I think the problem is not with Sitecore or your action, but the problem is with how it's handled with javacsript.
There is a response returned from API to javascript but it's all up to javascript how it's gonna handle it. It has to be coded in a way that browser starts download (or ask user what to do with a file) action.
That's a general javascript question which is not related to Sitecore. You can find an answer here:
https://stackoverflow.com/questions/16086162/handle-file-download-from-ajax-post
| Zip file download File response not working in Sitecore MVC
Zip file download File type response not working in Sitecore MVC.
Requirement: User can download each file on click download button and download selected files or download all. So selected files or all files must be downloaded as zipped file.
Code:
I created post action result and File return type, which will allow to download zip file.
I am creating memory stream, initiating the Ziparchive Class.
Next putting media files&stream into zip createEnty.
At last converting the Zipstream to bytes array and defining some response headers like content disposition, content type etc..
Please find post action method code below:
public ActionResult BulkDownload(string[] checkboxSelected)
{
string[] fileItemIDs = checkboxSelected.Distinct().ToArray();
using (System.IO.MemoryStream zipStream = new System.IO.MemoryStream())
{
using (ZipArchive zip = new ZipArchive(zipStream, System.IO.Compression.ZipArchiveMode.Update, true))
{
foreach (var fileid in fileItemIDs)
{
try
{
var lgItemID = Sitecore.Context.Database.Items.GetItem(fileid);
Sitecore.Data.Fields.FileField fileField = ((Sitecore.Data.Fields.FileField)lgItemID.Fields["File"]);
var mediaItem = fileField.MediaItem;
var media = MediaManager.GetMedia(mediaItem);
var stream = media.GetStream().Stream;
var extension = mediaItem.Fields["extension"].Value;
if (String.IsNullOrEmpty(extension)) continue;
ZipArchiveEntry zipItem = zip.CreateEntry(mediaItem.Name + "." + extension);
using (Stream entryStream = zipItem.Open())
{
stream.CopyTo(entryStream);
}
}
catch (Exception ex) { }
}
}
byte[] fileBytes = zipStream.ToArray();
System.Net.Mime.ContentDisposition contentDisposition = new System.Net.Mime.ContentDisposition
{
FileName = "Selectedfile.zip",
Inline = false
};
string ContentType = "application/x-zip-compressed";
//string ContentType = System.Net.Mime.MediaTypeNames.Application.Octet;// It also tried following content type: "application/zip","application/x-zip-compressed"
Response.Headers.Add("Content-Disposition", contentDisposition.ToString());
Response.Headers.Add("X-Content-Type-Options", "nosniff");
return File(fileBytes, ContentType);
}
No error no warnings, all looks good but not giving download popup or not downloading file.
Please see the browser response request & response header(from network tab) below:
I am not getting why it is able to download zip file. I think Sitecore may be blocking or browser(client) is not able download it.
Because a normal pdf/any media file download functionality also not working in File result type response in Sitecore mvc.
Is there anything more to configure for zip file or any file download programmatically in Sitecore mvc controller actions?
I welcome your suggestions, Thanks!
| |
Please follow the article - https://www.nehemiahj.com/2022/02/sitecore-experience-editor-cannot-read.html, and give it a try.
It says - Added a breakpoint where the code throws the error in the browser. There were 120+ fields with chrome for editing. An error was thrown in the 66th loop and pinpointed the related component. Added a small code in the experience editor JS file in the browser and enabled a breakpoint to find the problematic field.
for (var i = 0; i < l; i++) {
var currentElem = $sc(elements[i]);
var chrome = Sitecore.PageModes.ChromeManager.getChrome(currentElem);
/* Custom added */
if (chrome == null) {
console.log("Chrome is null for element");
}
/* Custom added */
if (!deep) {
/* if dom node's parent chrome is not this chrome, it means there is a chrome in between, so we disregard it a descendant, but not a child. */
if (chrome.parent(false, false) != this) {
continue;
}
}
The root cause is really simple. One of components built in the front end (Sitecore Headless) was transitioning after a defined interval (10 seconds) and changed the already generated Sitecore html for experience editor. Sitecore experience editor Javascripts were not able to find the related elements and it threw the error. This error will occur for sliders and other components where there is a transition with changes to the html. example: carousel or sliders.
Ideally, we should load sliders in a stacked manner in the experience editor so that content authors can edit easily without animation but view the transition in preview mode. This is not a new thing but sometimes frontend developers forget to use context.pageEditing flag and load the content in a different way for editing purposes.
| Experience Editor current chrome is null, crashes editor when referencing chrome.parent
Having an odd issue in Experience Editor (Sitecore 10.1.2, containers).
Intermittently, when adding a new component from the ribbon, EE will not respond and print the following to console:
Uncaught TypeError: Cannot read properties of null (reading 'parent')
This is looking for chrome.parent inside getChildChromes in the EE JS.
I can "fix" the issue by adding a safe-navigation operator between chrome and parent in my local instance. However, our deploy environments are containerized and we would have to fully replace the EE JS and customize the container to solve; that smells like the wrong solution.
I am struggling to see which components/chromes are causing the error, or even if there is are specific ones. Has anyone else seen this issue before?
| |
One solution is to introduce a CI=true environment variable on your build server (or Azure DevOps pipeline). With it being defined only on your build server, you can adjust your application code not to call Sitecore during the build process.
In [[...path]].tsx, in the getStaticPaths function, your app is calling the Sitecore sitemap fetcher to get all the routes defined in your content tree. This is the call you can skip with that extra environment variable.
The original code looks like this:
if (process.env.NODE_ENV !== 'development') {
const paths = await sitemapFetcher.fetch(context);
...
}
The modified code can look like this:
if (process.env.NODE_ENV !== 'development' && process.env.CI !== 'true') {
const paths = await sitemapFetcher.fetch(context);
...
}
This will skip assembling all of your Sitecore pages with their renderings. So there might still be runtime errors. However, the rest of the code will be compiled and all of the code will be checked for type issues by the TypeScript compiler.
It seems like starting with the upcoming v21 release of Sitecore JSS, the sample application will come with a similar feature using a different environment variable:
if (process.env.NODE_ENV !== 'development' && !process.env.DISABLE_SSG_FETCH) {
...
}
Source: https://github.com/Sitecore/jss/commit/cc6a5878cce723db26983a727c02cc2c19448bfa
| Build NextJS app on CI without accessing Sitecore
I've got a JSS application created using Next.js Getting Started template. During development, when I have local Sitecore instance runnung, I can build the app using jss build command. On the CI server the app is being built when the rendering container starts which seems too late. If there are build errors, the container will never start. See the Docker file fragment:
EXPOSE 3000
ENTRYPOINT "npm run start:connected"
To prevent that, I'd like to build next.js app in advance. Ideally, on a pull request validation. But, if executed without Sitecore instance running, the jss build fails with connection error:
info - Creating an optimized production build
info - Compiled successfully
> Build error occurred
FetchError: request to https://cm.localhost/sitecore/api/graph/edge failed, reason: connect ECONNREFUSED 127.0.0.1:443
It even does what I need - compiles the frontend app. It just needs to be stopoed before sending the request to Sitecore. How to do that?
| |
Here is the approach you can take to migrate the data from 8.2 to 10.2
Install Sitecore vanilla with SXA.
Download the production master database
Use RAZL to copy custom templates, Layouts, and content to Sitecore 10.2
Use RAZL to copy content items (data sources) for each component from the old site to Sitecore 10.2 SXA data folder
Identify the components which can be SXA components. Find those component templates and map those fields to SXA fields.
Run a PowerShell script to transform the old template to the SXA template.
Tweak the script to create the folder structure.
Repeat the step above for all the components.
Use the below article for the migration steps.
https://www.konabos.com/blog/lift-and-shift-to-sitecore-sxa-migration-the-easy-way
And finally, you need to create your Custom PowerShell script to move the data into the appropriate location.
Hope this helps.
| How to migrate content from non sxa sitecore 8.2 to SXA based sitecore 10.2 version?
We have completely redesigned a traditional Sitecore 8.2 based website to Sitecore 10.2 with SXA. Now, we want to move the content from 8.2 to 10.2 in a way that if
A page in 8.2 has a different field name, based on a particular template, and the same page has a different field in 10.2, based on a particular template.
In 8.2 the data source items are available at different locations, somewhere in the global folder outside the Home Node, and in 10.2 SXA we have already a Data folder where we have already predefined parents folder available for each page-specific content.
I know that I will have to write custom logic for content migration but need your thoughts on what could be possible best approaches to achieve this migration.
| |
The fix which I applied for this issue was to make an entry of localhost default IP address in netsh (which somehow got removed, so the connection was getting refused),
This is the command
C:\Windows\system32>netsh http add iplisten 127.0.0.1
| Sitecore 9.3 installation error Sitecore.XConnect.XdbCollectionUnavailableException System.Net.Sockets.SocketException
I am trying to install Sitecore 9.3 but getting below error
Then I tried to view the complete error by executing Sitecore.MAEngine.exe, this gives the below error
Error initializing XConnect client. System.AggregateException: One or
more errors occurred. --->
Sitecore.XConnect.XdbCollectionUnavailableException: An error occurred
while sending the request. ---> System.Net.Http.HttpRequestException:
An error occurred while sending the request. --->
System.Net.WebException: Unable to connect to the remote server --->
System.Net.Sockets.SocketException: No connection could be made
because the target machine actively refused it 127.0.0.1:443
Please Help.
| |
You can override IncludeFiles processor of forms.renderForm pipeline and add custom parameter for all the scripts (or styles). Class below adds DateTime.Now.Ticks to scripts only. You can use your own logic there to include desired cache buster:
public class IncludeFiles : Sitecore.ExperienceForms.Mvc.Pipelines.RenderForm.IncludeFiles
{
protected override void IncludePath(HttpContextBase httpContext, string filePath, bool script)
{
var filePathWithCacheInfo = script ? $"{filePath}?{DateTime.Now.Ticks}" : filePath;
base.IncludePath(httpContext, filePathWithCacheInfo, script);
}
}
Remember to register your class with patch file:
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<forms.renderForm>
<processor type="Sitecore.ExperienceForms.Mvc.Pipelines.RenderForm.IncludeFiles, Sitecore.ExperienceForms.Mvc">
<patch:attribute name="type">MyAssembly.MyNamespace.IncludeFiles, MyAssembly</patch:attribute>
</processor>
</forms.renderForm>
</pipelines>
</sitecore>
</configuration>
| Is there a way to add a cache buster to the RenderFormScripts Html helper function?
In our outerlayout.cshtml file we have the following code:
@Html.RenderFormScripts()
which seems to loop round the JS files, that have been attached to the Sitecore form:
and create script tags for each of them in the finally outputted HTML.
Does anyone know of a way where we can add a cache buster to this functionality so that we don't have to remember to manually update the attached JS file references every time one of the source JS files changes ?
We have other areas, of the site, where JS files have cache busting on them by having a buildNumber parameter, which is incremented every time the source code is deployed to PROD, and then injecting this parameter into the script tag but it seems like we need to customise what the RenderFormScripts function does
| |
Short answer
Yes
Explanation
If you open the \sitecore\shell\hotfixes\SC Hotfix 379282-1 CMS.Core 14.0.0 ContentSearch 6.0.0 Speak 6.0.0.txt file and view its contents, you can see the IDs of all of the bugs and other work items that are included in the hotfix:
Bug 361332: In certain cases the ContentSearch.Indexing.DisableDatabaseCaches setting disables caches for read operations
Bug 223702: SC_TICKET entries are never cleared from Properties table
Bug 235313: Index is always optimized after a rebuild ignoring the ContentSearch.Solr.OptimizeOnRebuild.Enabled setting
Bug 214239: Exception is thrown when Grid SPEAK 2.0 control is used
Bug 257381: Inconsistency in Validation Results dialog width
Bug 155383: Incorrect item data can be indexed if 'DisableDatabaseCaches' is set to 'true'
Bug 104112: Item tree copy does not reset workflow for descendants
Bug 360037: Select the Associated Content dialog: tree is not expanded to current selection when click "Browse"
Bug 250256: The ShowConfigLayers.aspx page doesn't consider the search parameter
Bug 118985: Heartbeat.aspx logs connection string password
Bug 332061: The only implementation of UserLockProvider is extremely inefficient
Product Backlog Item 257467: Rework TemplateEngine.GetTemplate API to avoid sequential execution
Product Backlog Item 185029: Use concurrent collection in DefaultLanguageFallbackStrategy to avoid blocking in multi-threading
Bug 119290: Incorrect standard values cache for inherited template
Then, you can search the release notes for the Sitecore releases at https://dev.sitecore.net/downloads to see if those numbers are listed as being implemented in that release. In this case, they were all fixed in version 10.0.0:
Release notes for 10.0.0
| Has the Sitecore Hotfix 379282 been fixed in later versions of Sitecore (coming from 9.3)
We have Sitecore Hotfix 379282 installed in our 9.3 Sitecore environment (it has two nuget packages, Sitecore.Client.Hotfix.379282 and Sitecore.ContentSearch.Hotfix.379282). We're in the process of updating to Sitecore 10.1.1 right now.
Have the fixes introduced by this hotfix been resolved in any versions of Sitecore between 9.3 and 10.1.1?
| |
I can see that you're using only Microsoft Offline and Sitecore sources for nuget.
Try getting packages from official package source:
Add it in Tools > NuGet Package Manager > Package Manager Settings.
| Unable to install Sitecore.Kernel in new solution
I have set up a new solution for Sitecore 10.2 instance. I have created a new project targeting .Net Framework 4.8. When I try to install Sitecore.Kernel, I get this error
Unable to resolve dependency 'EnterpriseLibrary.Common'. Source(s) used: 'Microsoft Visual Studio Offline Packages', 'Sitecore'.
Output window shows
Attempting to gather dependency information for package
'Sitecore.Kernel.10.2.0' with respect to project
'Feature\Navigation\GSC.Feature.Navigation', targeting
'.NETFramework,Version=v4.8'
Gathering dependency information took 4.11 sec
Attempting to resolve dependencies for package
'Sitecore.Kernel.10.2.0' with DependencyBehavior 'Lowest'
Unable to resolve dependency 'EnterpriseLibrary.Common'. Source(s)
used: 'Microsoft Visual Studio Offline Packages', 'Sitecore'.
Time Elapsed: 00:00:04.1640715
========== Finished ==========
I don't see this error very informative. Can someone help me fix this?
| |
add a public variable with the parameter name and also modify the constructor to only accept the object that needs resolved:
public string ExcludeSiteNames { get; set; }
public PageNotFoundProcessor(IErrorPageRepository errorPageRepository)
{
_errorPageRepository = errorPageRepository;
}
In the config file, modify it like the following: (note: the pipes were causing it to not map correctly, but commas worked fine)
<processor type="Feature.ErrorHandling.Pipeline.HttpRequest.PageNotFoundProcessor, Feature.ErrorHandling" resolve="true"
patch:before="processor[@type='Sitecore.Pipelines.HttpRequest.ExecuteRequest, Sitecore.Kernel']">
<ExcludeSiteNames>SHELL,ADMIN,LOGIN,SERVICE,MODULES_SHELL,MODULES_WEBSITE</ExcludeSiteNames>
| Inject parameters and an object into pipeline processor using DI
How do I pass a parameter to the processor's constructor AND resolve its dependencies?
In the config I have:
<processor type="Feature.ErrorHandling.Pipeline.HttpRequest.PageNotFoundProcessor, Feature.ErrorHandling"
resolve="true"
patch:before="processor[@type='Sitecore.Pipelines.HttpRequest.ExecuteRequest, Sitecore.Kernel']">
<param desc="excludeSiteNames">SHELL|ADMIN|LOGIN|SERVICE|MODULES_SHELL|MODULES_WEBSITE</param>
</processor>
the constructor:
public PageNotFoundProcessor(IErrorPageRepository errorPageRepository, string excludeSiteNames)
{
_errorPageRepository = errorPageRepository;
_excludeSiteNames = excludeSiteNames;
}
I receive the following error:
Unable to resolve service for type 'System.String' while attempting to activate 'Feature.ErrorHandling.Pipeline.HttpRequest.PageNotFoundProcessor'
| |
Usually anonymous users are not allowed to access Sitecore RESTful API for security reasons. You should send a POST request to /sitecore/api/ssc/auth/login to authenticate a user before calling any other /sitecore/api/ssc/... API method.
By default Sitecore API is configured to use session-based authorization, but if you want to use token authorization then change the setting Sitecore.Services.Token.Authorization.Enabled to true.
All settings related to API security and authorization are listed in the file /App_Config/Sitecore/Services.Client/Sitecore.Services.Client.config, though be careful and consider application security before changing any of them.
There is also an alternative way to get publishing queue information. You can call Publishing Service API directly and get the list of queued jobs by calling the API method:
https://{publishing-service-host}/api/publishing/jobqueue
If there is an active publishing job, it will be returned by the method:
https://{publishing-service-host}/api/publishing/activejob
You can call the following API method to the list of recent jobs:
https://{publishing-service-host}/api/publishing/jobhistory?skip=0&top=10
| Unable to access Sitecore Publish service get request
We have a custom dashboard for monitoring all servers health check, as part that we have one component to display publishing statistics (Here we display ongoing, queued publish items). Now we are using publish service to publish data from one database to another database.
We tried using Web API to get response from publishing service (
https://{hosturl}/sitecore/api/ssc/publishing/jobs/%7B00000000-0000-0000-0000-000000000000%7D/All?sourceDatabase=master ) but getting 403 forbidden or unauthorized exception.
Please help us here any other way to get response from above URL.
| |
To solve this we need to pass the second parameter which is RelationRole like below –
IRelation relation = arg.Entity.GetRelation("fieldName", RelationRole.Parent);
This relation role can be 2 types -
RelationRole.Parent
RelationRole.Child
You can use either as per your requirements. Because if you create a Relation field it will create 2 fields automatically, one is child relation and the other is parent relation.
After doing the above change, we were able to find a relation successfully.
I also wrote a blog for this - https://sitecorerocksblog.wordpress.com/2022/08/25/888/
| Error : Relation ‘fieldName’ is self referencing and multiple relation instances match
We create a Relation field in the Content hub and needed to sync this field value in some products in Sitecore Commerce.
So to get this value in our backend code, we used the below –
IRelation relation = arg.Entity.GetRelation("fieldName");
But while executing the code we got an error –
Relation ‘fieldName’ is self referencing and multiple relation
instances match. Specify the relation role.
at Stylelabs.M.Sdk.Models.Base.RelationContainer.GetRelation()
at
Stylelabs.M.Sdk.Models.Base.RelationContainer.GetRelation(Nullable`1
role)
at Stylelabs.M.Sdk.Models.Base.RelationManager.GetRelation(String
name, Nullable`1 role)
– arg.Entity.GetRelation(“Relations”,
RelationRole.Child) {Relations.ChildToManyParentsRelation}
Stylelabs.M.Sdk.Contracts.Base.IRelation
{Stylelabs.M.Sdk.WebClient.Models.Relations.ChildToManyParentsRelation}
| |
Assume that the Application Insights have been configured and the logging data is being collected correctly.
The info/audit information to trace the Login events you can find in the traces table. A simple query will be:
traces
| where itemType == "trace"
| where customDimensions.Role == "CM"
| where operation_Name contains "login"
Sitecore Identity role registers log messages into the customEvents table.
| Is there a reliable way to get Login Audit logs from Application Insights of a CM web app?
I am trying to find audit logs corresponding to users in the Sitecore domain - in application insights for my CM web app. I am looking at the -ai app and searching with EventType = Trace.
I have validated that the log level in the config is set to INFO.
But no login records are being returned for months.
I logged in myself several times within the past month, but those records are not reflected either.
Is there a reliable way to get Login Audit logs from Application Insights?
| |
For every feature / foundation projects select build action as None in Solution Explorer:
That will make sure that they won't be published during your build process.
| CI build selecting the the wrong web.config
Currently using msbuild in dev ops to build and publish our sc helix solution. Each project in the helix solution has a web.config file and ive noticed that after the build and publish the web.config file is not correct. It seems to be randomly selecting a web.config to publish from one of the feature / foundation projects and not the main project web.config. Has anyone else encountered this? Below is the build task in my pipeline
task: MSBuild@1
displayName: 'MSBuild: Full Build Sitecore solution'
inputs:
solution: '$(solution)'
msbuildVersion: '17.0'
msbuildArchitecture: 'x64'
configuration: '$(buildConfiguration)'
platform: '$(buildPlatform)'
clean: true
msbuildArguments: '/p:DeployOnBuild=true /p:DeployDefaultTarget=WebPublish /p:WebPublishMethod=FileSystem /p:DeleteExistingFiles=false /p:publishUrl=$(Build.SourcesDirectory)\Deploy\website'
condition: and(succeeded(), eq(${{ parameters.runPRBuild }}, false))
| |
It had issue as was fetching unwanted items as well i.e. item having publish date null.
So although set Feeds.MaximumItemsInFeed to 100, it got filtered at code level so reduced the total number of records in RSS.
After altering RSS query to fetch only those records which have some publish date have resolved the issue, e.g. given below:
query:/sitecore/content/My Site/Home//*[@Publish Date > '' ]
Now it is fetching all eligible records so don't alter the count on feed and include other eligible records in it.
| RSS Feed issue- All expected items not seems to be shown on page
We are facing one in RSS-Feed on CD, some items on CD have publish date but they are not listed in RSS-feed page. We have custom implementation for feed but it only removes item if it is null or don't have publish date.
Any idea/clue why some items have not shown up in Feed although they have latest publish date, also it comes using query given for RSS-feed
Although we have Feeds.MaximumItemsInFeed to 100, but it only shows 68 items and when i increased it to 200 then it displays 100 items
Do we have control on Sorting of Feed items.
| |
To create an item:
URL: /item/{path}?database&language
Edit an item:
URL: /item/{id}?database&language&version
Delete an item:
URL: /item/{id}?database&language
Run a Sitecore search:
URL: /item/search?term&pageSize&page&database&language&includeStandardTemplateFields&fields&sorting&facet
Run a stored Sitecore search:
URL: /item/{id}/search?term&pageSize&page&database
For more details you can refer: The RESTful API for the ItemService
| Need Rest API in Sitecore which can create, get, update , delete and publish items in sitecore without writing any code
Is there any Rest API in Sitecore which can create, get, update , delete and publish items in web instance and Solr without writing any code
| |
An easy way to apply hybrid rendering (SSG and SSR) with Sitecore and Next.js, you can utilize different routes and configurations.
First, for your default routes, you can leverage static site generation (SSG) by keeping the [[...path]].tsx file. This allows you to pre-render pages at build time and serve them as static HTML files. This approach is ideal for pages that do not require real-time data and can be cached for improved performance.
However, if you have specific routes or pages that require server-side rendering (SSR) to handle dynamic content or data fetching, you can create sub-routes or specific paths to cater to these scenarios. For example, you can create a route like pages/account/[[...path]].tsx and configure it to use SSR. This way, when a user accesses this route, the server will generate the page on the fly, incorporating real-time data or executing server-side logic before sending the response to the client.
But these solutions may vary according to the needs of your project.
| How could we apply Hybrid (SSG and SSR) rendering with Sitecore Nextjs
How could we apply Hybrid (SSG and SSR) rendering in a single Sitecore Nextjs application?
We tried this article:
https://github.com/Sitecore/jss/tree/release/18.0.0/samples/nextjs/src/pages
https://doc.sitecore.com/xp/en/developers/hd/200/sitecore-headless-development/prerendering-methods-and-data-fetching-strategies-in-jss-next-js-apps.html
But it doesn't work together (SSR AND SSG).
Getting 502 error.
| |
I would suggest that if you need to do any customizations in Sitecore Form controls, then rather than do any modification in OOTB control, you can create your own form control and write the HTML or JS to fulfill your needs.
For example, I created a Multiline-Input control that allows to add multiple text boxes to be filled by the user. Mainly used to add the address in multiline.
So I created my custom control and added the HTML and JS like below.
@using Sitecore.ExperienceForms.Mvc.Html
@model Sitecore.ExperienceForms.Mvc.Models.Fields.StringInputViewModel
@{
var id = Html.IdFor(m => Model.Value);
var button = Html.IdFor(m => Model.Value) + "_input";
}
<div id="formWrapper">
<label for="@Html.IdFor(m => Model.Value)" class="@Model.LabelCssClassSettings.CssClass">@Html.DisplayTextFor(t => Model.Title)</label>
<input type="text" id='@(@id+"_0")' name='@(@id+"_0")' class="@Model.CssClassSettings.CssClass">
<input id="@Html.IdFor(m => Model.Value)" name="@Html.NameFor(m => Model.Value)" class="@Model.CssClassSettings.CssClass" type="hidden" value="" @if (Model.MaxLength > 0) { <text> maxlength="@Model.MaxLength" </text> } placeholder="@Model.PlaceholderText" data-sc-tracking="@Model.IsTrackingEnabled" data-sc-field-name="@Model.Name" data-sc-field-key="@Model.ConditionSettings.FieldKey" @Html.GenerateUnobtrusiveValidationAttributes(m => m.Value) />
@Html.ValidationMessageFor(m => Model.Value)
<input type="button" id="@button" class="input-add" value="Add New" />
</div>
<script>
var count = 1;
var addAfterInputId = '@id';
var inputValue = "";
jQuery(document).ready(function ($) {
jQuery("#@button").click(function () {
var newInput = '@id' + '_' + count;
var input = jQuery('<br /><input type="text" id=' + newInput + ' name=' + newInput + ' class="@Model.CssClassSettings.CssClass">');
jQuery("#" + addAfterInputId).after(input);
addAfterInputId = '@id' + '_' + count;
count++;
})
jQuery("form").submit(function () {
jQuery("#formWrapper :text").each(function () {
if (jQuery.trim($(this).val())) {
inputValue += $(this).val() + "|";
}
});
jQuery("#" + "@id").val(inputValue);
});
});
</script>
Like this, you can extend an existing Sitecore form control and write your own JS or HTML to manage your control.
Here is the link to the blog that I wrote about this new control. You can refer to this and create your own control.
https://sbhatiablogs.wordpress.com/2021/11/26/multiline-input-control-multiple-input-text-control/
Hope this will help you to initiate.
Thanks
| How to implement nested checkbox list in Sitecore forms field. how do we customize it
How do i enhance these kind on checkbox in Sitecore forms 9.3
| |
This is a bug in Sitecore CLI v5.0.16 and it is fixed in v5.1.25. The new version has the following information in "Resolved issues" in the release notes:
Could not locate plugin [email protected] 540750
So if you still have this issue, upgrade your Sitecore CLI:
dotnet tool update sitecore.cli
This only updates the CLI, not the plugin refereneces in sitecore.json, so you have to manually update these (inlucing the Sitecore.DevEx.Extensibility.Database) to the same version (I assume) as the Sitecore CLI. At the moment the latest version is 5.1.25, so make sure that all entries in plugins ends with @5.1.25.
You can check which version of Sitecore CLI you have installed by running this command:
dotnet tool list
| Sitecore CLI can't locate plugin that actually exists
I'm following the documentation on how to set up Sitecore CLI: https://doc.sitecore.com/xp/en/developers/102/developer-tools/install-sitecore-command-line-interface.html
After doing all the steps I've come to step 5 where you can do a dotnet sitecore plugin list to list the installed plugins. When I do this I get the following message:
>> Begin installing NuGet packages: [email protected]
>>> Skipping NuGet package [email protected] because it is already installed.
Could not locate plugin [email protected]. Some CLI commands may not function correctly.
This message then appears in all CLI commands, even when doing something simple as dotnet sitecore -h.
The message says that it should install a package, then it says the package is already installed, finally it says the plugin couldn't be found. The package should obviously be able to be found as it is already installed. I've also checked the .sitecore\package-cache\nuget\Sitecore.DevEx.Extensibility.Database.5.0.16 folder, which exists, and it has a the corresponding .nupkg and .nuspec files.
I can remove the plugin with the following command: dotnet sitecore plugin remove -n Sitecore.DevEx.Extensibility.Database. Running dotnet sitecore plugin list no longer has the errors. When I readd the plugin using dotnet sitecore plugin add -n Sitecore.DevEx.Extensibility.Database the error reappears.
So why does Sitecore CLI keep complaining that a plugin can't be located when it is in fact installed?
| |
I like to think about the two like this: Security Profiles are to users, as API Clients are to applications.
Security Profiles are groups of roles that are assigned to users (at varying levels of assignment, be it at the Buyer level, User Group level, or even down to specific users). These groups of roles (or Security Profiles) define what level of data access specific users have.
API Clients are partitioned to grant access to your marketplace's data to specific applications. You could think of them like "API Keys". It is encouraged that you use API Clients liberally in order to have granular control. For instance, if you have a buyer application, an admin application, a middleware API, and a nightly webjob, it would be encouraged that you have 4 different API Clients, one for each of those applications.
Then, when your users are authenticating into one of your applications, you include the API Client for that specific application in the authentication request to OrderCloud. It is important to keep in mind that if your API Client has a Client Secret defined, it must be sent along with any authentication request grant type. API ClientIDs are not sensitive, however if you have a Client Secret defined, this is sensitive and should be protected and never publicly exposed.
A good reason for using API Clients liberally would be in the unfortunate case that your Client Secret was exposed, you could deactivate the specific API Client for this application without affecting many other applications, while you swap out with a new API Client.
To summarize: Security Profiles are used to grant specific data access to to users, and API Clients are used to grant specific data access to your applications. Both are required for a user to successfully authenticate to OrderCloud and begin making requests.
| What is the difference between API Client & Security Profile
According to the official documentation:
API Clients - API clients are access points to your marketplace data.
These access points have properties that control what parties can use
it, how they can gain access, and for how long that access remains
valid.
But isn't a Security Profile also used to control access.
For example, I would create two profiles - seller & buyer for respective users.
What is the need for API client here and should we have it always?
Please help me understand this with any example.
| |
This is how I handle managing environment settings.
Assuming you start with a default web.config included with a vanilla instance, you can transform that during build with the appropriate key. In my case we decided to use the full word "environment" rather than the abbreviated form.
<?xml version="1.0"?>
<configuration>
<appSettings>
<add xdt:Transform="InsertIfMissing" xdt:Locator="Match(key)" key="environment:define" value=""/>
</appSettings>
</configuration>
Next you will want to add a new namespace to your configuration patches.
xmlns:environment="http://www.sitecore.net/xmlconfig/environment/"
Example: The following demonstrates the use of an environment namespace where the possible values are "Dev", "Int", "Tst", "Prd".
<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/" xmlns:role="http://www.sitecore.net/xmlconfig/role/" xmlns:environment="http://www.sitecore.net/xmlconfig/environment/">
<sitecore environment:require="Dev or Int or Tst or Prd">
</sitecore>
</configuration>
Now, whether you are using standard VMs or containers you can override the environment variables with a key/value like the following:
SITECORE_APPSETTINGS_ENVIRONMENT:DEFINE
Int
| Updating value of env:define when using images across multiple environments
We are currently working on our build pipeline, which compiles our code and creates our cm/cd images, on SC managed cloud (sc 10.2). We have a single image for cm and cd that we deploy to all of our environments (DEV, QA,UAT, and PRODUCTION).
We'd like to update our environment app setting (<add key="env:define" value="Local" />) to reflect which environment the image has been deployed to, such as nonproduction for QA, UAT, and DEV and Production for our production site, so that we can use the setting in our rule-based configuration changes. We're not sure how you can do that per environment because of how images are created. Previously (before images), we would have created a transform that was triggered during the release pipeline.
| |
So i thought i would post the answer to this in case anyone else comes across this problem.
So the Sitecore 10.2 docker images (this is the only version I have verified this against) come with a configbuilder that lets you update app settings using environment variables.
If you look in the web.config you will find the config builder settings
<add name="SitecoreAppSettingsBuilder" mode="Strict" prefix="SITECORE_APPSETTINGS_" stripPrefix="true"
type="Microsoft.Configuration.ConfigurationBuilders.EnvironmentConfigBuilder, Microsoft.Configuration.ConfigurationBuilders.Environment, Version=1.0.0.0, Culture=neutral"/>
You can create environment variables with the same name as the appsetting prefixed with SITECORE_APPSETTINGS_ and at runtime the app settings value will be replaced with the one in the environment variable.
| Replacing app setting with environment variable in Sitecore managed cloud
Can someone tell me whether it's possible to replace an app setting with an environment variable in Sitecore Managed Cloud? Specifically, we would like to create some rule-based config based on an app setting that changes in each environment.
| |
If you check the DLL Glass.Mapper.Sc.Web.Mvc, you will find the implementation of this under GlassController
/// <summary>
/// Returns the item specificed by the data source only. Returns null if no datasource set
/// </summary>
[ExcludeFromCodeCoverage]
public virtual Item DataSourceItem => !this.RenderingContextWrapper.HasDataSource ? (Item) null : Sitecore.Context.Database.GetItem(this.RenderingContextWrapper.GetDataSource());
And if you check the method GetDataSource(), you will find it's implementation.
public string GetDataSource()
{
string dataSource = RenderingContext.CurrentOrNull.Rendering.DataSource;
if (dataSource.IsNullOrWhiteSpace() && RenderingContext.Current.Rendering.Item != null)
dataSource = RenderingContext.Current.Rendering.Item.ID.ToString();
return dataSource;
}
The above implementation is getting the rendering datasource.
Hope this makes sense.
Thanks
| What determines how DataSourceItem is set in Glass Mapper when used with SitecoreService.GetItem?
I am working on some code that was written years ago and I am just trying to understand how it works. On some pages, there is the following code:
var context = new SitecoreService(Sitecore.Context.Database.Name);
item = context.GetItem<ISomething>(DataSourceItem);
I'm trying to determine how the value DataSourceItem is populated - it is not set by my code explicitly. A full search of my code never shows it being set; plus, it doesn't have a 'set' accessor anyway. The question is: for each rendered page, how does Glass Mapper determine the value it should be set to?
If I follow it to it's source, it's in an abstract class that appears auto-generated:
// Summary:
// Returns the item specificed by the data source only. Returns null if no datasource
// set
public Item DataSourceItem { get; }
If I debug the code, the value of DataSourceItem is a GUID that I can easily find in the content editor of Sitecore. Where is this variable populated? I've searched the code, Google, the Sitecore community, and elsewhere. Should be simple, right?
Edit: A couple of people are suggesting that I decompile the Glass Mapper code to see where the value of DataSourceItem is set. Also, a search of my entire codebase doesn't show that this variable is set by my code.
What I really want to know is what determines how DataSourceItem is set. This variable is being set internally by Glass Mapper, but something must have been passed in to it, instructing Glass Mapper to pull an item from Sitecore. I don't see that in the code.
| |
You can use:
return Redirect("/ErrorPages/404");
or
return Redirect("http://myErrorPage");
instead of:
return View("NotFound", request.Response.Content.Sitecore.Context);
Updated:
I don't see OOTB ways if a 404 status code is needed, but as an option, it is possible to use one of the standard approaches like the one below:
Create your own RedirectResultWithStatusCode (it can be inherited from RedirectResult) with the option to pass statusCode
Override the existing RedirectResultExecutor, that is registered:
services.TryAddSingleton<IActionResultExecutor<RedirectResult>, RedirectResultExecutor>();
And then override ExecuteAsync, so it might look something like that:
public override Task ExecuteAsync(ActionContext context, RedirectResult result)
{
var redirectResultWithStatusCode = result as RedirectResultWithStatusCode;
if (redirectResultWithStatusCode == null)
{
return base.ExecuteAsync(context, result);
}
// My logic is here
/*
context.HttpContext.Response.StatusCode = redirectResultWithStatusCode.StatusCode;
context.HttpContext.Response.Headers[HeaderNames.Location] = result.Url;
*/
return Task.CompletedTask;
}
| How do you render Headless ASP.NET to present a Sitecore page as 404?
As per Sitecore's example code for ASP.NET Headless you can have your default controller method look like this:
[UseSitecoreRendering]
public IActionResult Index(Route route) {
var request = HttpContext.GetSitecoreRenderingContext();
if (request.Response.HasErrors) {
foreach (var error in request.Response.Errors) {
switch (error) {
case ItemNotFoundSitecoreLayoutServiceClientException notFound:
Response.StatusCode = (int)HttpStatusCode.NotFound;
return View("NotFound", request.Response.Content.Sitecore.Context);
case InvalidRequestSitecoreLayoutServiceClientException badRequest:
case CouldNotContactSitecoreLayoutServiceClientException transportError:
case InvalidResponseSitecoreLayoutServiceClientException serverError:
default:
throw error;
}
}
}
return View(route);
}
But I want to display a Sitecore page as the 404 page instead of a regular View inside the ASP.NET rendering host.
Let's say I have a page at the following path in Sitecore: /sitecore/content/MySite/Home/ErrorPages/404
How would I go about rendering that specific page when the rendering host encounters a "NotFound" scenario? This has to work with model binding, of course.
I guess I have to do something instead of Return View("NotFound", request.Response.Content.Sitecore.Context); but what?
| |
Sitecore stores information about email addresses in EmailAddressList facet (Sitecore.XConnect.Collection.Model.EmailAddressList).
EmailAddressList contains:
public EmailAddress PreferredEmail { get; set; }
public Dictionary<string, EmailAddress> Others { get; set; } = new Dictionary<string, EmailAddress>();
That allows contact to have preferred email and a list of other email addresses as well. Both PreferredEmail and Others use EmailAddress class that has:
public string SmtpAddress { get; set; }
public int BounceCount { get; set; }
And here is your BounceCount - it's stored separately for each email address.
| Make Sitecore contact as inactive when exm bounce contact email
I have one EXM which I am sending to multiple contacts available in xDB. When email bounce for contact (reach to Undelivered Max count) I want to mark that contact as inactive using custom facets but I am really not sure where Sitecore stores "Bounce count" for a specific contact. Please help.
| |
Treelist and DropTree use a different syntax if you want to stay with the ootb options. The Treelist parameters are explained here: https://doc.sitecore.com/xp/en/developers/102/sitecore-experience-manager/controlling-the-list-of-items-in-a-selection-field.html (check the Treelist parameters section)
You can specify the following parameters:
DataSource: Root item.
DatabaseName: The name of the database containing DataSource.
IncludeTemplatesForSelection: Users can only select items based on
this comma-separated list of data template names.
ExcludeTemplatesForSelection: Users cannot select items based on this
comma-separated list of data template names.
IncludeTemplatesForDisplay: Users can only navigate items based on
this comma-separated list of data template names and IDs.
ExcludeTemplatesForDisplay: Users cannot navigate items based on this
comma-separated list of data template names and IDs.
IncludeItemsForDisplay: Users can only navigate items based on this
comma-separated list of item names and IDs.
ExcludeItemsForDisplay: Users cannot navigate items based on this
comma-separated list of item names and IDs.
AllowMultipleSelection: If yes, users can select the same item more
than once.
By using the Datasource in combination with the IncludeTemplatesForSelection and maybe the IncludeTemplatesForDisplay you should be able to get what you want. Note that for the field to work well you have to be able to display all (parent) items in the tree above the ones you want to be able to select (the editors need to able to follow the tree path)
| How to set relative path for datasource of treelistEx field
I would like to change the datasource of treelistEx field in template from
/sitecore/content/Home/Web1/
to
datasource=query:./ancestor-or-self::*[@@templateid='{F045A478-2CEC-4333-970D-808DC9FFE9BC}' or @@templateid='{179A1E0B-53A1-4AA4-B25E-ADB6F0D9CD5C}']/*
I found that TreeList, TreeListEx and DropTree are not support query: and fast:
Is it possible to do it?
if it possible, How to do it? please help. Thanks.
| |
Open the <role-root>\App_data\config\Sitecore\Collection\sc.Xdb.Collection.Data.Sql.xml configuration file and set the UseAlwaysEncrypted element to true
<UseAlwaysEncrypted>true</UseAlwaysEncrypted>
For more details refer this link.
https://doc.sitecore.com/xp/en/developers/102/platform-administration-and-architecture/configure-sql-always-encrypted-for-the-xdb-collection-database.html
| How to check if AlwaysEncrypted is enabled on a Sitecore Collection Shards DB?
We would like to know whether AlwaysEncrypted feature is ON/OFF for our Collection shards DB in Sitecore. We are working on the Upgrade to 10.2
| |
There are some reporting events that get initiated automatically in the Content Hub. For example, you will be interested in an asset.download.completed event.
Whenever an asset is downloaded, a log entry with the event_type asset.download.completed will be recorded in reporting index.
The full list of reporting events see here.
Then you can view the triggered events in the Reports section. Some tweaks of the reporting filters & dimensions might be required before you will see the expected result.
For external integration, you can query the audit indexes through Audit REST API to fetch the captured events as follows:
GET /api/audit/business/query{/entityId}{?logType*,raw,from,to,fullText,skip,take,sort,order}
| How to set a goal in Content hub
In Sitecore, we can set a goal when a user downloads a media item.
Is it possible OOB to do the same in Content Hub?
There is no Sitecore integration for this project, just the Content Hub.
This is to capture analytics data for marketing, say how often an image has been viewed/downloaded.
| |
You need to inject your code in publishing related pipeline e.g. publish:end pipeline
Create Handler, write your code in it
Refer handler in config at publish:end event
<event name="publish:end">
<handler type="namespace.classname, assembly" method="methodname" />
</event>
you can refer :
https://briancaos.wordpress.com/2018/01/04/sitecore-publishend-and-publishendremote/
It should solve your problem. As we also use publishing service and it works for us.
Answer updated on 27-sept-2022 :
I have installed publishing service on my local and Details to get all items which get published from service are given below:
Article to refer for detail: https://joaoneto.blog/publishing-service-bulkpublishingend-pipeline/
Refer these dll to your solution
We need to hook into the publishEndResultBatch pipeline
a. Add class and enter code to work with published item, e.g.
public class PublishItemsDetail
{
public void Process(PublishEndResultBatchArgs args)
{
if (args.Aborted)
{
ActionForAbort(args);
}
else
{
ActionAfterPublish(args);
}
}
private void ActionAfterPublish(PublishEndResultBatchArgs args)
{
var itemsAffected = args.Batch.Select(b => b.EntityId).Distinct().ToList();
foreach (var item in itemsAffected)
{
//here you got list of all items published, now do whatever you want with this info
Console.WriteLine(item.ToString());
}
}
private void ActionForAbort(PublishEndResultBatchArgs args)
{
Console.WriteLine("aborted publishing...");
}
}
b. add entry to config
<sitecore>
<pipelines>
<publishEndResultBatch>
<processor type="Nuveen.Utils.Pipelines.PublishItemsDetail, Nuveen.Utils"
patch:after="*[@type='Sitecore.Publishing.Service.Pipelines.BulkPublishingEnd.RaiseRemoteEvents, Sitecore.Publishing.Service']" >
</processor>
</publishEndResultBatch>
</pipelines>
</sitecore>
Now you are all set, i have tested it on my local and it works as expected and able to get list of all published items using publish service.
| How to get all the published items without publish:itemProcessed event
We have installed sitecore publishing service module to separate publishing. Earlier we were using publish:itemProcessedevent to get all publishing items but with Sitecore Publish module this event is not working.
Could some one please help us here.
| |
I also faced the same issue while I uploaded the DB backup on Azure BlobStorage and tried to restore it directly via Portal.
Connect the Azure SQL Server to your local SSMS. For that, you need to add your IP address to the Azure SQL Server Firewall rule.
To set a server-level IP firewall rule from the database overview
page, select Set server firewall on the toolbar, as the following
image shows
The Networking page for the server opens
Add a rule in the Firewall rules section to add the IP address of
the computer that you're using, and then select Save. A server-level IP firewall rule is created for your current IP address.
See the article: https://learn.microsoft.com/en-us/azure/azure-sql/database/firewall-configure?view=azuresql#from-the-database-overview-page
Once you are able to connect the Azure SQL server to the local SSMS then create the BACPAC file of the database instead of .bak file and try to restore the BACPAC file on Azure SQL Server.
See the blog post:
How to create or export BACPAC file using SSMS?
How To Import Or Restore BACPAC File Using SQL Server Management Studio
| Sitecore Collection Shards DB import failure
We are doing the Sitecore 10.2 upgrade. We have exported and restored the Collection Shard0 and Shard1 into our local. We have successfully executed our upgrade script.
When we try to import the database again to Azure, we are getting the error.
| |
This can be achieved by overwriting the sxacontent field in Solr document.
Create a class by inheriting AggregatedContent class and overriding ComputedFieldValue
Inside override method, access ComputedFiedValue from base class which is nothing but sxacontent field value from Solr
Write a condition for a specific item or items from the specific template and replace the existing sxacontent field value with the necessary field values only or add the extra field content to the existing sxacontent field value as per your requirement.
Outside the condition, return the sxacontent field value grabbed from the base class as it is. So that it will not impact your changes to the other items content.
Create a patch file and patch it instead of existing sxacontent computed field value,
<field fieldName="sxacontent" patch:instead="*[@fieldName='sxacontent']" returnType="textCollection" type="your class, namespace"/>
deploy the code and patch file to webroot
Rebuild the indexes
Refer to my blog on overwriting Sxacontent field for more details.
| Is this possible to restrict the SXA search box to search only through a particular field?
I have added an SXA search box component on the page and now when I type a search term it returns the result based on the search term found through the aggregated content. But, I want that search box to search that word in a specific field only.
For example, I have a few pages of profile template with the following fields in it,
First Name
Last Name
Email
For the search box, we have set up a scope to limit a few templates like profile template, insight template, etc.
Now when we try to find a person in the search box then according to scope it returns the result from scoped template's field content.
But, is there any way to modify the scope query or other solution to set up the search box to perform its search in the specific field (say First Name) only?
We are using Sitecore Experience Accelerator 10.2.0 rev. 04247 with Sitecore 10.2.
| |
The short answer to this is yes, with Sitecore headless, you are able to call the headless APIs from any application that can make a web request. So, your react application can make calls to the API to get content and layout data. There is no hard requirement for Next.js, if you want the features of Next.js, then go ahead and re-build it there. But you do not need to do this.
However, depending on what functionality you want to support, you may need to make changes to your react code.
If you want to have inline editing support in the Experience Editor and/or support for adding/removing components or page composition in the Experience Editor, you should refactor your application to use the Sitecore JSS SDK. You can probably still use all your existing react components and just modify them to use the JSS SDK for rendering fields. That would enable inline editing.
For page composition, you will probably need to re-build the app using the JSS SDK, and just pull in your existing component code, modifying them to use the JSS SDK.
So, you have some options, as for the "best way" to do this, we can't answer that here, and that really is not what SSE is for anyway, that would be opinionated. Choose the path that best fits your requirements, budget and timeline.
| Is it possible to use an existing React.js application with Sitecore Headless?
I have an existing React.js application and I want to integrate it with Sitecore to provide CMS features.
Is it possible to integrate the existing React.js App with Sitecore 10.2 with Headless support? Do I need to go with Next.js and rewrite React app?
| |
The error shown is stating that it cant find the file used to run the service.
First thing to check is that the file listed as "Path to executable" exists on your local machine. To do this right click on the service itself in "services" window.
In the general tab, you will see the path to executable. It will point to either the solr instance itself or a service (like NSSM - mentioned by Gaurav above). Please confirm that the file shown exists.
If its something like NSSM, you should also check that the subsequent file that the service manager is calling is correctly pointing to your solr instance.
If non of the above gives any success, then I suggest looking in the "Event Viewer". This will give details of the file that is being attempted to call.
Please update your answer with any relevant logs from there.
| Broken local environments - media library search, experience editor, can't rebuild index / indices
Three local Sitecore environments have several core functionalities that don't work as expected despite having little or no recent changes.
Media library search fails giving the error message: "An error has occurred and the search cannot be completed". Manually browsing the media library however works as expected and I can load media items.
Indexing manager shows no indices to select to rebuild.
Loading the Experience Editor shows the error: "An error occurred. [Log message: Value cannot be null. Parameter name: source]". Unlike many other Experience Editor errors, I cannot ignore this error and add content. I was able to find this in the error log in App_Data\logs and have attached a screenshot of it.
All three of these issues have been replicated in 3 separate local Sitecore installations. One of the Sitecore installations doesn't even have any content beyond the default content created upon installation. I am running Sitecore 9.2.
Screenshots of errors:
| |
Can you please confirm what model name you have passed as a parameter while creating the XdbModelBuilder?
XdbModelBuilder xdbModelBuilder = new XdbModelBuilder("{modelname}", new XdbModelVersion(1, 0));
The model name should be identical in the patch file:
<runtime type="Sitecore.XConnect.Client.Configuration.RuntimeModelConfiguration,Sitecore.XConnect.Client.Configuration">
<schemas hint="list:AddModelConfiguration">
<schema name="{modelname}" type="Sitecore.XConnect.Client.Configuration.StaticModelConfiguration,Sitecore.XConnect.Client.Configuration" patch:after="schema[@name='collectionmodel']">
<param desc="modeltype">ProjectName.Foundation.Analytics.Model.YourFacetCollectionModel, ProjectName.Foundation.Analytics</param>
</schema>
</schemas>
</runtime>
From your steps mentioned above and the code in your question, all seems good but one more file and piece of code we need to do, could you please confirm that you are doing correct by referring to the below code:
public class YourFacetCollectionModel
{
public static XdbModel Model { get; } = BuildCoreModel();
private static XdbModel BuildCoreModel()
{
//double check the below line of code
XdbModelBuilder xdbModelBuilder = new XdbModelBuilder("{modelname}", new XdbModelVersion(1, 0));
//double check the below line of code as well
xdbModelBuilder.ReferenceModel(CollectionModel.Model);
xdbModelBuilder.DefineFacet<Contact, CustomFacetA>(CustomFacetA.DefaultFacetKey);
xdbModelBuilder.DefineFacet<Contact, CustomFacetB>(CustomFacetB.DefaultFacetKey);
return xdbModelBuilder.BuildModel();
}
}
| The specified type is not a valid facet type
I am creating custom facets in Sitecore 10.2. Below steps I have performed:
Created custom facets.
[FacetKey(DefaultFacetKey)]
[Serializable]
public class CustomFacet : Facet
{
public const string DefaultFacetKey = "CustomFacet";
public string ResidentialStatus { get; set; }
}
Created custom facet model
public class CustomFacetModel
{
public static XdbModel Model { get; } = null;
static CustomFacetModel()
{
Model = BuildModel();
}
private static XdbModel BuildModel()
{
var builder = new XdbModelBuilder(typeof(CustomFacetModel).FullName, new XdbModelVersion(1, 0));
builder.DefineFacet<Contact, CustomFacet>(CustomFacet.DefaultFacetKey);
return builder.BuildModel();
}
}
Deployed dll on inetpub/wwwroot/website
Created Json file and pasted on below two places:
{
"Name": "xx.Foundation.Analytics.Models.CustomFacetModel",
"Version": "1.0",
"References": [
{
"Name": "XConnect",
"Version": "1.0"
}
],
"Types": {
"xx.Foundation.Analytics.Models.CustomFacet": {
"Type": "Facet",
"BaseType": "Sitecore.XConnect.Facet",
"ClrType": "xx.Foundation.Analytics.Models.CustomFacet, xx.Foundation.Analytics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
"Properties": {
"ResidentialStatus": {
"Type": "String"
}
}
}
},
"Facets": [
{
"Target": "Contact",
"Name": "CustomFacet",
"Type": "xx.Foundation.Analytics.Models.CustomFacet"
}
]
}
inetpub\wwwroot\xxxxconnect.dev.local\App_Data\jobs\continuous\IndexWorker\App_Data\Models
inetpub\wwwroot\xxxlocalxconnect.dev.local\App_Data\Models
Created patch file:
<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
<sitecore>
<xconnect>
<runtime type="Sitecore.XConnect.Client.Configuration.RuntimeModelConfiguration,Sitecore.XConnect.Client.Configuration">
<schemas hint="list:AddModelConfiguration">
<schema name="CustomFacetModel" type="Sitecore.XConnect.Client.Configuration.StaticModelConfiguration,Sitecore.XConnect.Client.Configuration" patch:after="schema[@name='collectionmodel']">
<param desc="modeltype">XX.Foundation.Analytics.Models.CustomFacetModel,XX.Foundation.Analytics</param>
</schema>
</schemas>
</runtime>
</xconnect>
</sitecore>
</configuration>
Saving facets in xDB
using (var client = SitecoreXConnectClientConfiguration.GetClient())
{
var trackerIdentifier = new IdentifiedContactReference(identifierSource, email);
var contact = client.Get(trackerIdentifier, new ContactExpandOptions(CollectionModel.FacetKeys.PersonalInformation, CollectionModel.FacetKeys.EmailAddressList, CollectionModel.FacetKeys.PhoneNumberList, PhoneNumberList.DefaultFacetKey, CustomFacet.DefaultFacetKey));
if (contact == null)
{
if (Tracker.Current == null && Tracker.Enabled)
{
Tracker.StartTracking();
}
if (!Tracker.Enabled || Tracker.Current == null || !Tracker.Current.IsActive)
{
return false;
}
}
}
Tracker.Current is coming null, Tracker.Enabled is true. In log file below error is coming:
25284 14:17:19 ERROR Cannot create tracker.
Exception: System.ArgumentException
Message: The specified type is not a valid facet type.
Parameter name: facetType
Source: Sitecore.Analytics.Model
at Sitecore.Analytics.Model.Framework.ModelFactory.CreateFacet(Type facetType)
at Sitecore.Analytics.Model.Framework.Faceted.AddFacet(String name, Type type)
at Sitecore.Analytics.Model.ContactFactory.Create(ContactCreationParameters parameters, IReadOnlyDictionary`2 facets)
at Sitecore.Analytics.Data.ContactRepository.CreateContact(ID id)
at Sitecore.Analytics.Tracking.ContactManager.CreateContact(ID id)
at Sitecore.Analytics.Pipelines.EnsureSessionContext.LoadContact.Process(InitializeTrackerArgs args)
at (Object , Object )
at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)
at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
at Sitecore.Analytics.Pipelines.EnsureSessionContext.EnsureSessionContextPipeline.<>c__DisplayClass4_0.<Run>b__0()
at Sitecore.Analytics.XConnect.Diagnostics.PerformanceCounters.OperationPerformanceMonitorExtensions.<>c__DisplayClass1_0.<Monitor>b__0()
at Sitecore.Analytics.XConnect.Diagnostics.PerformanceCounters.OperationPerformanceMonitorExtensions.Monitor[T](OperationPerformanceMonitorBase monitor, Func`1 operation)
at Sitecore.Analytics.DefaultTracker.EnsureSessionContext()
at Sitecore.Analytics.Pipelines.CreateTracker.GetTracker.Process(CreateTrackerArgs args)
at (Object , Object )
at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)
at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
at Sitecore.Analytics.Tracker.Initialize()
xDB is enabled and SC_ANALYTICS_GLOBAL_COOKIE is coming in browser. Please help.
| |
The Sitecore Content Hub platform is not a personalization engine. It is aimed at delivery and management of content and digital assets. Moving to Content Hub focuses purely on the content part of things in the composable DXP architecture.
As you seem to be moving that direction for architecture, you likely want to be looking at using a headless personalization engine which can provide that specific functionality. Sitecore has a product for that (Sitecore Personalize) as well as a CDP (Sitecore CDP) both based on the acquired Boxever technology. This can be one way to go. There are also lots of other vendors that have personalization tools, so if personalization is a business requirement you might want to look at what specifically you need to do, and at what scale, so you can find the right headless option to add to your content solution.
| Can we have Sitecore XP like personalization in Content Hub
We are evaluating options before suggesting Content Hub as the CMS platform for a client.
The website will be built with MVC and will not have Sitecore XP.
If we want to personalize the content for the end user (the user of the website and not Content Hub), like for example:
Showing a certain image based on user's location or
Showing a certain image based on user's authentication etc..
Is it possible OOB in Content Hub or does it have to be programmatically handled in the website business logic.
| |
Got to the bottom of it - I noticed that my code #1 did work the first time after an app pool recycle. I then noticed that my crawler stopped immediately after the first run in crawling logs:
WARN [Index=my_site_search] Crawling Stopped
Subsequent attempts using IndexCustodian would fail immediately (with no error).
Decompiling Sitecore.ContentSearch.ISearchIndex then pointed me at the dispose method of Sitecore.ContentSearch.AbstractSearchIndex.
Fix in my code above was to remove the using clause around:
var solr = ContentSearchManager.GetIndex("my_site_search")
Dispose doesn't get called, crawler continues, and further calls to #1 work as expected on all methods - (.Update, .Refresh, .ForcedIncrementalUpdate etc)
Just answering in case it helps someone else in future.
Thanks to Balaji's answer here https://sitecore.stackexchange.com/a/4674/4299 for pointing me to the underlying problem.
| Refreshing single document in ContentSearch/Solr index using IndexCustodian?
I have a working custom index configured, it includes some custom fields and has specifically included fields and templates to keep it light. It uses the default SitecoreItemCrawler. I'm on 10.1 deployed on Azure.
I just want to run an update on a specific document in my index, to force some computed fields to be recomputed and persisted in the Solr index.
I'm struggling to get IndexCustodian to perform the update, here is relevant code:
using (var solr = ContentSearchManager.GetIndex("my_site_search"))
{
// just for example, this comes from elsewhere
string exItemUri = "sitecore://web/{d1adabf3-393e-4d59-b9e3-a3104253b879}?lang=en&ver=1";
var ctx = solr.CreateSearchContext(Sitecore.ContentSearch.Security.SearchSecurityOptions.DisableSecurityCheck);
using (new SecurityDisabler())
{
Log.Info($"Context User: {Sitecore.Context.User.Name}", "SU");
var indexableUniqueIds = new[] { new SitecoreItemUniqueId(exItemUri) };
var db = Factory.GetDatabase("web");
var it = db.GetItem(new DataUri(exItemUri));
var tempItem = (SitecoreIndexableItem)it;
// ** THIS DOES NOT WORK #1
// solr.Refresh(tempItem); This also doesnt work - noted comment that this should not be done, IndexCustodian should be used
var job = IndexCustodian.Refresh(solr, tempItem);
//job.Start(); // doesn't make any difference - job is started anyway by IndexCustodian(?)
job.Wait();
Log.Info("Ran Refresh: indexUniqueIds: " + indexableUniqueIds[0].ToString(), "SU");
// ** THIS WORKS, BUT I'M NOT USING THE INDEXCUSTODIAN #2
using (var upctx = solr.CreateUpdateContext())
{
solr.Operations.Update(tempItem, upctx, solr.Configuration);
upctx.Commit();
}
Log.Info("Ran Update indexUniqueIds: " + indexableUniqueIds[0].ToString(), "SU");
}
}
I've tried various methods on IndexCustodian (.Update, .Refresh, .ForcedIncrementalUpdate etc), but all have the same effect - I see the job going into the jobs queue, it gets processed, however does nothing to my index - it also states 0 items updated. I'm examining index with the Solr query tool.
I've run out of things to try - I'm not sure if approach #2 is correct as I believe we are supposed to use the IndexCustodian.
Any help greatly appreciated!
| |
Kubernetes doesn't support the colon character (:) in environment variables names, as reported in this Github issue on the Kubernetes repository here.
The workaround suggested by Sitecore using double underscores (__) to replace a colon in the environment variable name works for an ASP.NET Core application, but not for an ASP.NET framework application.
You should be able to replace the value of your env:define app setting with an environment variable, defining instead its default value in the web.config with the following syntax that explicitly defines the name of the environment variable associated to:
<add key="env:define" value="$(env:SITECORE_APPSETTINGS_ENV_DEFINE)" />
With the syntax above, the name of the environment variable to add in your Kubernetes specs would be SITECORE_APPSETTINGS_ENV_DEFINE.
I haven't tested it, but it should work.
| Replacing the value of env:define with an environment variable in AKS
Has anyone successfully replaced the value of env:define app setting?
I have tried using SITECORE_APPSETTINGS_env:define however it seems that AKS does not support using the colon in an environment variable name.
I've contacted Sitecore who advised trying SITECORE_APPSETTINGS_env__define however that also didn't work.
| |
If you are planning to downgrade from XP to XM then the below link will give you all the information on the features that you will miss in XM.
https://getfishtank.ca/blog/sitecore-xm-vs-xp
https://bala.one/is-sitecore-xp-to-xm-a-downgrade/
And for your question about "what constitutes an XP feature?" the answer is if you download both packages, you will see the lesser DLLs and configs in the Sitecore XM package, which will reduce features in that.
The above links will also give you the licensing information between both of them.
For your last question, the feature you will find in the above links as well. And you can see that on Sitecore documents.
https://doc.sitecore.com/xp/en/developers/92/platform-administration-and-architecture/sitecore-xp-feature-compatibility-in-xm-scaled-packages.html
| Downgrading from XP to XM
Has anyone ever done an XP to XM downgrade, what was involved?
Does anyone know what constitutes an XP feature? Is it based on features, assemblies we include, or something else?
Is there a page / list we can query to let us know which features are in use? Docs are not very helpful around this so far.
| |
Wildcards are not currently supported by Identity Server. There was a similar request in the Identity Server GitHub and the response was:
Wildcards in URLs are always dangerous from a security point of view.
If you need that particular feature and think you can implement it securely for your environment, please use our extensibility points to do it yourself. That's why they exist.
So you can either list all your domains in the config under <AllowedCorsOriginsGroup> or write a custom implementation of ICorsPolicyService and define the method Task<bool> IsOriginAllowedAsync(string origin) to meet your requirements - it should return true if the origin is allowed and false otherwise. Then you can register the class in Identity Server dependency injection container:
services.AddSingleton<ICorsPolicyService>((container) => {
return new CustomCorsPolicyService();
});
Here is Identity Server documentation for custom Cors Policy services: https://docs.identityserver.io/en/latest/topics/cors.html#custom-cors-policy-service
| Using wildcard in AllowedCorsOrigin of the IdentityServer
Is there a way to use wildcard in AllowedCorsOrigin of the IdentityServer. I want to allow all the sites to access the Sitecore CMS. I tried the following which didn't work.
<AllowedCorsOriginsGroup1>*.site.com</AllowedCorsOriginsGroup1>
One way is to add all the sites in the AllowedCorsOrigin but I want a new site to be added automatically rather than entering the site manually in the AllowedCorsOrigin.
Any suggestion would be appreciated.
Thanks in advance.
| |
Delete buttons do not exist in reports by default. If you wish to add your own custom report actions then you can following the documentation described here. You can make the action do whatever you want, such as delete the item and send an email.
The training module included with SPE provides an example report action.
The Advanced Report example demonstrates the "Say Hello" button.
| Sitecore PowerShell Select item at Show-ListView has no delete action
I need to find media items that has no references, but user should have an option to delete them manually .
by some reason, if I add an item to custom noRefeItems, Show-ListView component does not show delete action. how to fix it?
$noRefeItems = [System.Collections.ArrayList]@()
$itemsToProcess = Get-ChildItem -Path $root.ProviderPath -Recurse | Where-Object { $_.TemplateName -eq 'Image' }
if ($itemsToProcess -ne $null) {
$itemsToProcess | ForEach-Object {
$referrers = Get-ItemReferrer -Item $_ | measure
if ($referrers.Count -gt 0) {
} else {
$noRefeItems.Add($_)
}
}
}
$noRefeItems | Show-ListView -Property DisplayName, ProviderPath, Size, Created
| |
I think the below information will be sufficient to understand the in-line edition feature with Experience Editor in the JSS app.
The Sitecore Experience Editor only supports in-page (inline) editing of a limited number of fields. These are the field for which JSS provides components.
Internal link fields, such as Droptree, need to be edited in one of the form-based UIs, like the field editor "pencil" button mentioned in the styleguide. To change the Droptree (or Treelist, or Multilist, etc.) field itself and change the linked items, you can use that field editor button.
You can still use <Text /> and other components to render content from the linked item. That can still be edited inline.
You can find the discussion here. Where @nickwesselman stated the above.
https://github.com/Sitecore/jss/issues/415
Hope this answer your question.
Thanks
| React/JSS Components and Experience editor compatibillity
Is it possible to have a full editing experience within Experience Editor with components that don't use the built-in @sitecore/sitecore-jss-nextjs Fields and Types?
For example, I have a component that looks like this:
const MyComponent = (props: MyComponentProps): JSX.Element => (
<h1><Text field={props.fields.myComponentHeading}/></h1>
<p><Text field={props.fields.myComponentText}/></p>
)
In the above example, the value for the <h1> and <p> can be edited directly in the Experience editor.
In contrast in this example:
const MyComponent = (props: MyComponentProps): JSX.Element => (
<h1>{props.fields.myComponentHeading.value}</h1>
<p>{props.fields.myComponentText.value}</p>
)
a content editor would need to select the component, then click the pencil icon and edit the values in the modal window for the data source.
Is there a way to allow the Experience Editor workflow to be the same in both examples, or is using elements like <Text field={...} /> the only way to do this?
| |
I assume you already found how to add SPE to the images - that part is documented (https://doc.sitecore.com/xp/en/developers/102/developer-tools/add-sitecore-modules.html) and you mentioned it is working locally.
If your sql is not in a container, you don't have a sql-init setup so that is no option. I think what should be possible is:
install SPE with the Sitecore package in your running CM environment once to have it create the items in the database
make sure your cm container has the necessary files (what should be the case as you have that locally)
| Installing SPE to managed cloud
We are upgrading to 10.2 and are using Sitecore Managed cloud (aks) as our production host.
We would like to use the SPE module and have got this working fine locally in docker, however in aks our setup is slightly different. Instead of using a containerized version of SQL Server we are using azure SQL. Part of the SPE install creates a new role and account in the core database. This works fine locally as our SQL is containerized but we are confused as to how we can get this SQL update applied to our core database hosted in azure SQL.
Has anyone managed to install SPE into aks when the core DB is hosted in azure SQL?
| |
Try to access it though membership class. Example to grab all extranet users below.
[System.Web.Security.Membership]::GetAllUsers() | Where-Object {$_.UserName.StartsWith("extranet")} |
Show-ListView -Property @{Name = 'FullName'; Expression = {(Get-User -Identity $_.UserName).Profile.FullName}},
@{Name="User Name"; Expression={ $_.UserName} },
@{Name="Email"; Expression={ $_.Email} },
@{Name="Is Enabled"; Expression={ $_.IsApproved} },
@{Name="Is Locked"; Expression={ $_.IsLockedOut } },
@{Name="Created Date"; Expression={ $_.CreationDate} },
@{Name="Last Login Date"; Expression={ $_.LastLoginDate} }
I would probably directly access database and try to figure out if there are corrupted users or duplicates.
| Get users from 7.2 - throwing error in Sitecore PowerShell
I am using 7.2 Sitecore version. There I need to fetch users using PowerShell script.
I have tried multiple combinations or filters to run for instance -
Get-User -Filter *
I get an error saying - item key already been added. This is happening due to a specific user. It might be more than one users corrupted. I am not even able to access the user through user User Manager.
How can I fix this issue?
| |
Look at forms.saveForm pipeline in the Sitecore.ExperienceForms.Pipelines.Client.configconfiguration file; the default settings are
<forms.saveForm>
<processor type="Sitecore.ExperienceForms.Client.Pipelines.SaveForm.CreateModels, Sitecore.ExperienceForms.Client" resolve="true" />
<processor type="Sitecore.ExperienceForms.Client.Pipelines.SaveForm.GenerateNames, Sitecore.ExperienceForms.Client">
<defaultItemName>Form Item</defaultItemName>
</processor>
<processor type="Sitecore.ExperienceForms.Client.Pipelines.SaveForm.CheckAccessRights, Sitecore.ExperienceForms.Client" resolve="true" />
<processor type="Sitecore.ExperienceForms.Client.Pipelines.SaveForm.UpdateItems, Sitecore.ExperienceForms.Client" resolve="true" />
</forms.saveForm>
| What pipeline is triggered when a form is created in the forms builder
I just tried to create a form based on template that was created before. The mail campaign is set up correctly in the template, but the problem is that all token mappings are lost for the new form.
I want to map the tokens for the mail campaign configuration for a form just created via form builder using pipelines. What is the correct pipeline to use for this?
| |
There may be other options available, but the easiest I found begins in the config.js included with the SXA theme. Making the configuration changes below will result in a pre-optimized-min file bundled with the variable/function names intact.
Here is the original minifyOptions provided:
minifyOptions: {
js: {
compress: {
hoist_funs: true,
passes: 1
},
toplevel: false
},
css: { compatibility: 'ie8' }
}
Here is the updated minifyOptions:
minifyOptions: {
js: {
compress: false,
mangle: false,
toplevel: false
},
css: { }
}
Note: SXA makes use of the npm-uglify-es and npm-clean-css packages.
| How do I disable minification for pre-optimized-min items in my theme?
Sitecore/SXA 10.2
I find it very difficult to know exactly which part of my code is broken when the theme scripts are mangled beyond my comprehension. What can I do to improve this experience?
Take for example this piece of code:
Minified
Original
Note: I'm using a CDN which handles the minify process in production.
| |
On you item template, you can provide the RTE source like this.
And when you open the Show Editor button in RTE, you will find the option to add the Ordered List like this.
Here are some more source options available as per your needs.
/sitecore/system/Settings/Html Editor Profiles/Rich Text Default
/sitecore/system/Settings/Html Editor Profiles/Rich Text Full
/sitecore/system/Settings/Html Editor Profiles/Rich Text IDE
/sitecore/system/Settings/Html Editor Profiles/Rich Text Medium
Read more in details.
https://himynameistim.com/blog/optimize-the-rich-text-editor-in-sitecore
| How to add ordered list icon to rich text editor in html mode for sitecore 10
Using Sitecore 10.0.1
I want to add ordered list icon to Sitecore rich text editor when opening in HTML mode.
How do we achieve this?
| |
The issue was that Solr was missing an expected index. The logs showed that sitecore_suggested_test_index was missing:
5312 16:11:56 ERROR Unable to connect to [https://localhost:8983/solr], Core: [sitecore_suggested_test_index]
Exception: SolrNet.Exceptions.SolrConnectionException
Message: <html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 404 Not Found</title>
To resolve the issue I disabled Content Testing by editing Sitecore.ContentTesting.config and setting ContentTesting.AutomaticContentTesting.Enabled to false
| Value cannot be null. Parameter name: fieldNameTranslator - but Solr indexes available and build successfully
I have a new Sitecore 9.0.1 instance that I installed through SIF. It was installed using Lucene so I needed to install Solr and update the configuration. I went through the following steps to change it to use Solr: https://ericastockwellalpert.wordpress.com/2022/08/02/updating-a-sitecore-instance-to-use-solr-instead-of-lucene/
Solr is running and the indexes are able to build successfully. I initially had an issue with the Polish language processing where I needed to add some jars to Solr, but that seems to be resolved because the indexes build now without error (mentioning in case it's relevant). But I'm unable to open the content editor, I get the server error Value cannot be null. Parameter name: fieldNameTranslator
| |
Add https://sitecore.myget.org/feed/xmcloud-preview/package/nuget/Sitecore.DevEx.Extensibility.XMCloud reference:
dotnet sitecore plugin add -n Sitecore.DevEx.Extensibility.XMCloud
Then you should be able to use the command like this below:
dotnet sitecore cloud login
| How do I use the Sitecore CLI with Sitecore Cloud to serialize content?
I've been watching all of videos about XM Cloud (https://developers.sitecore.com/learn/getting-started/xm-cloud-introduction) and I have a question about serialization? How is it working on XM Cloud?
There is a Andy Cohen's video (https://youtu.be/a23g2TRUvOI) that he's using sitecore cloud commands and I'm not finding this CLI.
| |
As described in the docs, you can do something as simple as the following:
$homeItem = Get-Item -Path "master:/content/home"
$homeItem.Image = Get-Item -Path "master:\media library\logo"
| how to set an item Image field
Using Sitecore PowerShell Extensions I can set an item's text properties but an Image property cannot be set:
In the screenshot above, setting the Title property worked but none of the attempts at setting the Featured Image worked.
However from Content Editor when I specify a relative media library path, it works:
Is it possible to set an image field value with a media library item using Sitecore PowerShell Extensions? If so, how?
| |
Try running it through PowerShell script like this.
.\Sitecore.Framework.Publishing.Host --urls 'http://sc910.publishing:5000' -environment Development
It will give you the error on the console.
Also check this article below and seems like this is a similar kind of issue.
https://sitecorefootsteps.blogspot.com/2019/12/sitecore-publishing-service-410-setup.html
Might resolve your issue.
Thanks
| Issue in setup Sitecore Publishing Module (ver 4.3) on local system (Error: An error occurred while starting the application)
I am trying to setup publishing module (ver 4.3) for my sitecore 10.0 application, everything has been done based on manual/script steps in document. Like configure connection string, creating IIS site, adding host entry, application pool setup etc. But seems there is some issue due to which not able browse the site.
Thus when browse url: http://sitecore.publishing/api/publishing/operations/status, it gave error:
Note: My development site is on https but I am configuring my publishing service on http.
Please suggest if i am missing something/
When tried to load service from powershell, it gave error:
After above issue gets resolve getting Permission issue:
I have make sure that Everyone has full right on the folder to get started but then also no luck.
Error in log :
[Fatal] Unable to start Kestrel.
Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networking.UvException: Error -4092 EACCES permission denied
at Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal.Networking.LibuvFunctions.ThrowError(Int32 statusCode)
| |
Disabling Sitecore XDB and Tracking is Sitecore's CMS-only mode. In CMS-only mode, any functionality that depends on data collection will be unavailable and a number of applications will not run. In CMS-only mode, the Sitecore XP applications and functionality are classified as:
Fully compatible -The following features will run in CMS-only mode without any changes:
Content editing in the Experience Editor
Device detection
IP Geolocation detection
Commerce Connect
Compatible with limited functionality - The following features will run in CMS-only mode with limitations:
Campaign Creator – runs without analytics functionality.
Personalization – in-session personalization works, while personalization based on historical data is unavailable.
Web Forms For Marketers. (lower versions only)
Sitecore Forms – runs without analytics functionality.
Incompatible - The following features are incompatible with CMS-only mode:
Content testing
Email Experience Manager
Experience Analytics
Experience Explorer
Experience Profile
Federated Experience Manager
List Manager
Path Analyzer
Segmentation
Marketing Automation
Now based on your website's requirements and Sitecore's functionalities you are using, you can disable the Sitecore XDB and tracking and it will definitely improve the performance of your site as Sitecore will not collect lots of information from end-user. Also if you just need the CMS-only mode it will give you a benefit in your license cost as well (no need to purchase xDB licenses)(You need to speak to your local Sitecore representative or partner for this).
https://doc.sitecore.com/xp/en/users/102/sitecore-experience-platform/cms-only-mode-compatibility.html
| Does disabling Sitecore XDB and Tracking help in improving Site Performance?
Can disabling Sitecore XDB and tracking help in improving Site Performance ?
What all can be functionalities/ features can be impacted if we disable them ?
| |
The issue was that sometimes updated XConnect models do not properly load. So we have to perform the following steps in order to fix the issue:
Please ensure that you didn't miss any steps from the following article:
https://doc.sitecore.com/xp/en/developers/91/sitecore-experience-platform/deploy-a-custom-model.html
Then execute following steps:
Restart all xconnect web apps;
Restart the "AutomationEngine" web job. To do so please go to "ma-ops" web app->Web Jobs->Automation Engine and click "stop" and then "start":
Please note that Azure WebJobs are used for running IndexWorker, AutomationEngine, and ProcessingEngine services for Cloud environments. Service files are copied to the D:\local\Temp\jobs\continuous folder and run from this directory.
Please ensure that your custom model is deployed to these folders too.
in the Azure Portal, find the related xConnect App Service.
using KUDU, navigate to the App_data folder for the corresponding WebJob as follows: D:\local\Temp\jobs\continuous\JOB-NAME\RANDOM-NAME\App_data\Models folder.
| Xconnect Error after deploying custom model on Azure
I am using Sitecore 9.1 Azure. Recently I deployed the XConnect custom model and other required files on 5 roles referring to the link https://doc.sitecore.com/xp/en/developers/100/sitecore-experience-platform/deploy-a-custom-model.html
The roles are given below where I deployed:
ma-rep
ma-ops
xc-collect
xc-refdata
xc-search
But I am getting the below error. Any idea what am I missing?
does not have a remote version Exception: Sitecore.XConnect.Client.XdbModelConflictException Message: One or more local models conflict with the xDB service layer. 'CustomModel, 1.0' does not have a remote version
| |
When you select a form in the Form Panel and export the data in excel like below.
You will get the data in excel along with the file path to download like this.
Now when you open this URL in the browser, you will be able to download the file.
So You can use this way to get your uploaded file.
If you want to manage the file storage for the form, then you can follow this Sitecore document to do the modifications.
https://doc.sitecore.com/xp/en/developers/101/sitecore-experience-manager/manage-file-storage-for-forms.html
Hope this help.
| Unable to locate the uploaded document using Sitecore Forms
I have created a Sitecore form where I am added a File Upload button and uploaded a file. Also, I have used the Save Data option to save the data to the Database once I click submit button.
Now I can able to see the data in the database in the table [sitecore_forms_filestorage].[FileStorage] with the Filename field containing the name of the file I uploaded. For example, I have uploaded a word document named "Test Document.docx" and it is showing in the database. But I have no idea where the physical document is stored in Sitecore.
I have searched in Media Library but it is not present. I need to retrieve this document and allow the user to edit the document which I am currently not able to do. Can you please help me how to find the uploaded document in Sitecore? I have attached screenshots of the forms and data for reference.
Thanks in Advance
Vijay
| |
Using the toolbox in SXA, you need to first add the Splitter (Columns) component like this.
Then on each column use the Edit Style and open the grid.
And adjust the style.
Then for the Bottom use the Splitter (Rows)
It will show the same structure that you need like this.
Hope this help.
| left header placeholder in sitecore SXA
In Sitecore SXA How i create a left header placeholder as shown in the below image do i need create a custom grid layout and custom grid css
| |
See this conversation here on github as @WulfgarDK is saying above - https://github.com/SitecorePowerShell/Console/issues/912
But this was not the reason in our case.
We had the same issue and solution was to enable Spe.IdentityServer.config at \inetpub\wwwroot\website\App_Config\Include\Spe.
OOTB this file comes with Sitecore Powershell module as disabled. Just need to remove .disabled from the config name.
| Can't download any results from Show-ListView
I've written a script to generate a report that allows downloading a list of pages and relevant tags applied to them (within a section). In that script, I wrote the below code to download the output. For some reason, any export buttons, that Show-ListView displays, do nothing. files can't be downloaded. What is the reason for not given to download the results from Show-ListView?
$options = @{
"News" = "/sitecore/content/IFS/IFS/Home/News"
"Assets" = "/sitecore/content/IFS/IFS/Home/Assets"
"Industries" = "/sitecore/content/IFS/IFS/Home/Industries"
"Solutions" = "/sitecore/content/IFS/IFS/Home/Solutions"
"Succes" = "/sitecore/content/IFS/IFS/Home/Customer Success"
"Partners" = "/sitecore/content/IFS/IFS/Home/Partners"
}
$props = @{
Parameters = @(
@{Name="selectedOption"; Title="Choose an option"; Options=$options; Tooltip="Choose one."}
)
Title = "Option selector"
Description = "Choose the right option."
Width = 300
Height = 300
ShowHints = $true
}
$result = Read-Variable @props
if($result -ne "ok") {
Exit
}
$table = New-Object System.Data.Datatable;
$path1 = "/sitecore/content/IFS/IFS/Home/News"
$path2 = "/sitecore/content/IFS/IFS/Home/Assets"
$path3 = "/sitecore/content/IFS/IFS/Home/Industries"
$path4 = "/sitecore/content/IFS/IFS/Home/Solutions"
$path5 = "/sitecore/content/IFS/IFS/Home/Customer Success"
$path6 = "/sitecore/content/IFS/IFS/Home/Partners"
if($selectedOption -eq $path1){
$allitems = Get-Item -Path master:// -Query "$path//*[@@TemplateName = 'Article']"
}elseif($selectedOption -eq $path2 ){
$allitems = Get-Item -Path master:// -Query "$path//*[@@TemplateName = 'Asset']"
}elseif($selectedOption -eq $path3){
$allitems = Get-Item -Path master:// -Query "$path//*[@@TemplateName = 'Content Page']"
}elseif($selectedOption -eq $path4){
$allitems = Get-Item -Path master:// -Query "$path//*[@@TemplateName = 'Content Page']"
}elseif($selectedOption -eq $path5){
$allitems = Get-Item -Path master:// -Query "$path//*[@@TemplateName = 'Customer Story']"
}elseif($selectedOption -eq $path6){
$allitems = Get-Item -Path master:// -Query "$path//*[@@TemplateName = 'Partner Profile']"
}
[void]$table.Columns.Add("Name")
[void]$table.Columns.Add("Tag_Category")
[void]$table.Columns.Add("Tags")
ForEach ($item in $allItems) {
$name = $item.DisplayName
[void]$table.Rows.Add("$name","","")
$rawIds = [Sitecore.Data.Fields.MultilistField]$item.Fields["CardCategory"]
$selectedItems = $rawIds.GetItems()
foreach($selectedItem in $selectedItems){
$tag = $selectedItem.DisplayName
[void]$table.Rows.Add("","CardCategory","$tag")
}
$rawIds = [Sitecore.Data.Fields.MultilistField]$item.Fields["ContentType"]
$selectedItems = $rawIds.GetItems()
foreach($selectedItem in $selectedItems){
$tag = $selectedItem.DisplayName
[void]$table.Rows.Add("","ContentType","$tag")
}
$rawIds = [Sitecore.Data.Fields.MultilistField]$item.Fields["Industry"]
$selectedItems = $rawIds.GetItems()
foreach($selectedItem in $selectedItems){
$tag = $selectedItem.DisplayName
[void]$table.Rows.Add("","Industry","$tag")
}
$rawIds = [Sitecore.Data.Fields.MultilistField]$item.Fields["Language"]
$selectedItems = $rawIds.GetItems()
foreach($selectedItem in $selectedItems){
$tag = $selectedItem.DisplayName
[void]$table.Rows.Add("","Language","$tag")
}
$rawIds = [Sitecore.Data.Fields.MultilistField]$item.Fields["ProductCategory"]
$selectedItems = $rawIds.GetItems()
foreach($selectedItem in $selectedItems){
$tag = $selectedItem.DisplayName
[void]$table.Rows.Add("","ProductCategory","$tag")
}
$rawIds = [Sitecore.Data.Fields.MultilistField]$item.Fields["Region"]
$selectedItems = $rawIds.GetItems()
foreach($selectedItem in $selectedItems){
$tag = $selectedItem.DisplayName
[void]$table.Rows.Add("","Region","$tag")
}
$rawIds = [Sitecore.Data.Fields.MultilistField]$item.Fields["Topic"]
$selectedItems = $rawIds.GetItems()
foreach($selectedItem in $selectedItems){
$tag = $selectedItem.DisplayName
[void]$table.Rows.Add("","Topic","$tag")
}
}
$table | Show-ListView -Property Name, Tag_category, Tags
Please help me.
Thank you
| |
OOTB Sitecore will not give you this type of filtering using DropTree. Droptree shows items as a tree view instead of showing them as the dropdown. The user is allowed to select a single item at a time. It shows a complete Sitecore tree if the source is not provided at the time of field declaration or incorrect source path. The source can be XPath Query or GUID and Item Path.
To fix your particular problem we have multiple options -
Change your field type to Drop link it will show you the complete list as dropdown
Use the drop tree field which will show you a complete tree node based on your source but add custom validation for the required template type item. using this, you will not be able to select another item in the list.
Create a custom field type based on your requirement
Use multiroot treelist or treelist field and add custom validation of one item-only selection.
There could be some better approaches to fix this issue from different people here, but this is what I am thinking
| Sitecore DropTree Query
I am using Sitecore 9. I am having a problem trying to populate the droptree in the template(source).
The template ID for the Apple, Banana and Peach is {AB86861A-6030-46C5-B394-E8F99E8B87DB} and the template id for the Apple Skin, Banana Skin,Peach Skin is {3FFD8425-4652-4BFE-9D8D-5CC1AE2D24A2}
This is how my Sitecore structure looks like
/sitecore/content/Global/My Manager/MyFruits/
under Myfruits
FruitOne
Apple
Apple Skin
FruitTwo
Banana
Banana Skin
FruitThree
Peach
Peach Skin
I only want to show Apple Skin, Banana skin and Peach skin in the droptree.
I am able to show all three using a Droplist or Droplink using this query
query:/sitecore/content/Global/My Manager/MyFruits//*[@@templateid = '{3FFD8425-4652-4BFE-9D8D-5CC1AE2D24A2}']
If i use the same query for droptree i only get the first one(Apple Skin). I don't get all three.
I have tried using
query:./ancestor-or-self::*[@@templatename='Fruity']/sitecore/content/Global/My Manager/MyFruits
it does not work.
| |
It seems you're using OpenID Connect, but this implementation seems different form the Sitecore docs: https://doc.sitecore.com/xp/en/developers/92/sitecore-experience-manager/configure-federated-authentication.html
I have also written a blogpost about it: https://www.jeroenbreuer.nl/blog/custom-identity-provider-in-sitecore/
Here are the important files:
ProjectIdentityProvider.cs
public class ProjectIdentityProvider : IdentityProvidersProcessor
{
private readonly IConfigurationRepository configurationRepository;
private readonly IUrlUtils urlUtils;
private readonly ICookieManager cookieManager;
public ProjectIdentityProvider(
IConfigurationRepository configurationRepository,
IUrlUtils urlUtils,
FederatedAuthenticationConfiguration federatedAuthenticationConfiguration,
ICookieManager cookieManager,
BaseSettings settings) : base(federatedAuthenticationConfiguration, cookieManager, settings)
{
this.configurationRepository = configurationRepository ?? throw new ArgumentNullException(nameof(configurationRepository));
this.urlUtils = urlUtils ?? throw new ArgumentNullException(nameof(urlUtils));
this.cookieManager = cookieManager ?? throw new ArgumentNullException(nameof(cookieManager));
}
protected override void ProcessCore(IdentityProvidersArgs args)
{
var authenticationType = this.GetAuthenticationType();
var identityProvider = this.GetIdentityProvider();
var saveSigninToken = identityProvider.TriggerExternalSignOut;
var oidcOptions = this.SetupOidcOptions(authenticationType, saveSigninToken);
args.App.UseOpenIdConnectAuthentication(oidcOptions);
}
public OpenIdConnectAuthenticationOptions SetupOidcOptions(
string authenticationType,
bool saveSigninToken)
{
var oidcOptions = new OpenIdConnectAuthenticationOptions
{
AuthenticationType = authenticationType,
AuthenticationMode = AuthenticationMode.Passive,
MetadataAddress = this.configurationRepository.GetSetting(Constants.Settings.IdentityAccessManagementMetadataAddress),
ClientId = this.configurationRepository.GetSetting(Constants.Settings.IdentityAccessManagementClientId),
ClientSecret = this.configurationRepository.GetSetting(Constants.Settings.IdentityAccessManagementClientSecret),
ResponseMode = OpenIdConnectResponseMode.Query,
ResponseType = OpenIdConnectResponseType.Code,
RedeemCode = true,
Scope = OpenIdConnect.ProjectIdentityScope,
RequireHttpsMetadata = true,
Notifications = new OpenIdConnectAuthenticationNotifications
{
RedirectToIdentityProvider = this.RedirectToIdentityProviderAsync,
SecurityTokenValidated = this.SecurityTokenValidatedAsync
},
TokenValidationParameters =
{
SaveSigninToken = saveSigninToken
},
CookieManager = cookieManager
};
return oidcOptions;
}
protected override string IdentityProviderName => OpenIdConnect.ProjectIdentityProvider;
protected BaseLog Log { get; }
public Collection<string> Scopes { get; } = new Collection<string>();
private Task RedirectToIdentityProviderAsync(
RedirectToIdentityProviderNotification<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions>
notification)
{
var domain = urlUtils.GetDomain();
var owinContext = notification.OwinContext;
var protocolMessage = notification.ProtocolMessage;
if (protocolMessage.RequestType == OpenIdConnectRequestType.Authentication)
{
var redirectUri = this.configurationRepository.GetSetting(Constants.OpenIdConnectOptions.RedirectUri);
// Make sure the redirectUri goes to the current domain.
redirectUri = WebUtil.GetUri(redirectUri, new Uri(domain)).ToString();
protocolMessage.RedirectUri = redirectUri;
}
if (protocolMessage.RequestType == OpenIdConnectRequestType.Logout)
{
var postLogoutRedirectUri = this.configurationRepository.GetSetting(Constants.OpenIdConnectOptions.PostLogoutRedirectUri);
// Make sure the postLogoutRedirectUri goes to the current domain.
postLogoutRedirectUri = WebUtil.GetUri(postLogoutRedirectUri, new Uri(domain)).ToString();
protocolMessage.PostLogoutRedirectUri = postLogoutRedirectUri;
protocolMessage.IdTokenHint = this.GetIdTokenHint(owinContext);
}
return Task.CompletedTask;
}
private Task SecurityTokenValidatedAsync(SecurityTokenValidatedNotification<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> notification)
{
var identityProvider = this.GetIdentityProvider();
var identity = notification.AuthenticationTicket.Identity;
foreach (var current in identityProvider.Transformations)
{
current.Transform(identity, new TransformationContext(this.FederatedAuthenticationConfiguration, identityProvider));
}
return Task.CompletedTask;
}
}
patch.config
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<federatedAuthentication type="Sitecore.Owin.Authentication.Configuration.FederatedAuthenticationConfiguration, Sitecore.Owin.Authentication">
<identityProvidersPerSites hint="list:AddIdentityProvidersPerSites">
<mapEntry name="sites with extranet domain" type="Sitecore.Owin.Authentication.Collections.IdentityProvidersPerSitesMapEntry, Sitecore.Owin.Authentication" resolve="true" patch:instead="*[@name='sites with extranet domain']">
<sites hint="list">
<site>project</site>
</sites>
<identityProviders hint="list:AddIdentityProvider">
<identityProvider ref="federatedAuthentication/identityProviders/identityProvider[@id='ProjectIdentityProvider']" />
</identityProviders>
<externalUserBuilder type="Sitecore.Owin.Authentication.Services.DefaultExternalUserBuilder, Sitecore.Owin.Authentication" resolve="true">
<IsPersistentUser>false</IsPersistentUser>
</externalUserBuilder>
</mapEntry>
</identityProvidersPerSites>
<identityProviders>
<identityProvider id="ProjectIdentityProvider" type="Sitecore.Owin.Authentication.Configuration.DefaultIdentityProvider, Sitecore.Owin.Authentication">
<param desc="name">$(id)</param>
<param desc="domainManager" type="Sitecore.Abstractions.BaseDomainManager" resolve="true" />
<caption>Go to login</caption>
<domain>extranet</domain>
<triggerExternalSignOut>true</triggerExternalSignOut>
<!--list of identity transfromations which are applied to the provider when a user signin-->
<transformations hint="list:AddTransformation">
<!--SetIdpClaim transformation-->
<transformation name="Idp Claim" type="Sitecore.Owin.Authentication.Services.SetIdpClaimTransform, Sitecore.Owin.Authentication" />
<!-- If external authentication is configured with "TokenValidationParameters = {SaveSigninToken = true}", this saves the value from "claimsIdentity.BootstrapContext" to the "id_token" claim. -->
<transformation name="set id_token claim" type="Sitecore.Owin.Authentication.Services.SaveIdTokenInClaim, Sitecore.Owin.Authentication" />
</transformations>
</identityProvider>
</identityProviders>
</federatedAuthentication>
<pipelines>
<owin.identityProviders>
<processor type="Project.Foundation.Identity.IdentityProviders.ProjectIdentityProvider, Project.Foundation.Identity" resolve="true" id="ProjectIdentityProvider">
<scopes hint="list">
<scope name="openid">openid</scope>
<scope name="sitecore.profile">sitecore.profile</scope>
</scopes>
</processor>
</owin.identityProviders>
</pipelines>
</sitecore>
</configuration>
site.config
<site patch:before="site[@name='website']"
inherits="website"
name="project"
language="nl-NL"
contentLanguage="nl-NL"
scheme="https"
rootPath="/sitecore/content/Project"
startItem="/Home"
loginPage="$(loginPath)project/ProjectIdentityProvider" />
If you use the Federated Authentication functionality provided by Sitecore you should also get the correct value in Request.IsAuthenticated. So it will be true if you are logged in.
| Request.IsAuthenticated is alway false in OpenId Connect
I have a requirement where the public users will click on login then it will go to SSO and after that it will redirect back to the website with details. I am using the OpenID connector for public user SSO for this I have created Startup file.
public class Startup
{
public void Configuration(IAppBuilder app)
{
CorePipeline.Run("initializeOwinMiddlewareCustom", new InitializeOwinMiddlewareArgs(app));
}
}
and below is InitializeOwinMiddlewareCustom class.
public void Process(InitializeOwinMiddlewareArgs args)
{
args.App.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
args.App.UseCookieAuthentication(new CookieAuthenticationOptions());
args.App.UseOpenIdConnectAuthentication(
new OpenIdConnectAuthenticationOptions
{
Authority = authority,
ClientId = clientId,
ClientSecret = clientSecret,
ResponseType = OpenIdConnectResponseType.IdTokenToken,
RedirectUri = redirectUri,
PostLogoutRedirectUri = postLogoutRedirectUri,
Scope = OpenIdConnectScope.OpenIdProfile + " " + OpenIdConnectScope.OfflineAccess,
SaveTokens = true,
TokenValidationParameters = new TokenValidationParameters()
{
ValidateIssuer = false
},
Notifications = new OpenIdConnectAuthenticationNotifications
{
AuthenticationFailed = OnAuthenticationFailed,
SecurityTokenValidated = notification =>
{
notification.AuthenticationTicket.Identity.AddClaim(new Claim("surname", notification.AuthenticationTicket.Identity.Claims.FirstOrDefault(x => x.Type == "surname").Value));
notification.AuthenticationTicket.Identity.AddClaim(new Claim("id_token", notification.ProtocolMessage.IdToken));
notification.AuthenticationTicket.Identity.AddClaim(new Claim("phone_number", notification.AuthenticationTicket.Identity.Claims.FirstOrDefault(x => x.Type == "phone_number").Value));
return Task.FromResult(0);
}
}
}
);
}
Login Controller:
if (!Request.IsAuthenticated)
{
HttpContext.GetOwinContext().Authentication.Challenge(new AuthenticationProperties { RedirectUri = "/" },
OpenIdConnectAuthenticationDefaults.AuthenticationType);
}
I am getting all claim in OpenIdConnectAuthenticationNotificationsbut in controllerRequest.IsAuthenticated is coming false.
if(Request.IsAuthenticated)
{
var claims= ClaimsPrincipal.Current.Identities.First().Claims.ToList();
}
| |
As per my knowledge, there is no cache setting that can help with this kind of error. As this is looking like a duplicate content issue.
Before pushing the item, you should validate your content using these commands.
dotnet sitecore ser validate
dotnet sitecore ser validate --fix
If there is an error you can fix those before pushing content to your environment.
Read more
https://doc.sitecore.com/xp/en/developers/101/developer-tools/the-cli-serialization-command.html
| (***GUID***) attempted to be cached, but the cache already contained /sitecore/content/****
We have setup Sitecore CLI and are able to do PULL and PUSH successfully in the Dev environment. Same steps we have followed in the higher environment (PreProd) but getting below error
/sitecore/content/**** (***GUID***) attempted to be cached, but the
cache already contained /sitecore/content/****. Non-unique paths
cannot be serialized. Please choose a different item name.
When we check the respective error prone item in Sitecore, Item Id is different but item name is the same. However same items successfully able to do PULL and PUSH in Dev environment. But fails in higher environment. In higher environment (PreProd), we are using non-interactive login whereas in Dev environment, we are using interactive login. Is there any cache settings that we have to enable/disable in higher environment. Please advise.
| |
Sitecore stores information about the source of a clone in __Source Item and Source fields.
You can get the value in c# code using
var sourceField = item.Fields[Sitecore.FieldIDs.Source];
var sourceItemField = item.Fields[Sitecore.FieldIDs.SourceItem];
__Source item field is shared - it keeps the source item reference.
Source field is versioned - it keeps source versions for every language separately. Note that the actual field name is __Source.
They both store string values like:
Source: sitecore://master/{2163CB8F-3CF1-4183-A53A-2B9ED850646C}?lang=de&ver=1
_Source Item: sitecore://master/{2163CB8F-3CF1-4183-A53A-2B9ED850646C}
| How can I determine the source of a cloned item
I have a cloned item.
I want to know which item is it cloned from (what is the source item of the clone).
How can I do that in Sitecore itself or using codebehind c#?
| |
I would suggest creating a custom Submit button and binding the JS event on the cshtml.
The csthml will look like the one below, where you can bind the confirmation box by clicking on the button. You need to follow the blow code and remove the logic and put the confirmation logic before submitting.
@using Sitecore.ExperienceForms.Mvc.Constants
@model Sc.FormsCustomScripts.Models.CustomScriptButtonViewModel
@{
var cssClass = Model.CssClass;
if (Model.NavigationStep < 0)
{
var classes = Model.CssClass.Split(' ');
if (!classes.Contains("cancel", StringComparer.OrdinalIgnoreCase))
{
if (!string.IsNullOrEmpty(Model.CssClass))
{
cssClass += " ";
}
cssClass += "cancel";
}
}
}
<input value="@Html.DisplayTextFor(t => Model.Title)" type="submit" class="@cssClass" name="@Html.Name(Model.ItemId)" data-sc-field-key="@Model.ConditionSettings.FieldKey" />
@Html.Hidden(AttributeNames.NavigationButtons, Model.ItemId)
@Html.Hidden(Model.ItemId, Model.NavigationStep)
<script type="text/javascript">
(function ($) {
var $inputEl = $("input[name='@Html.Name(Model.ItemId)']");
var $formEl = $inputEl.closest('form');
if ($inputEl.length == 0 || $formEl.length == 0) {
return;
}
$inputEl.click(function () {
$("input[type=submit]", $formEl).removeAttr("clicked");
$(this).attr("clicked", "true");
});
@if (Sitecore.Context.Site.Name != "shell")
{
if (!string.IsNullOrWhiteSpace(Model.FormSubmitScript))
{
<text>
$formEl.on("submit", function () {
if ($inputEl.attr('clicked')) {
@Html.Raw(Model.FormSubmitScript)
}
});
</text>
}
}
})(jQuery)
</script>
To know more about the custom submit event, refer to this article.
https://smartsitecore.com/en/call-custom-javascript-on-sitecore-forms-submit/
| On Sitecore form submit show pop up with yes or no button and clicking Yes save the form data
I have a requirement where on Sitecore form submit, I have to show a pop up with Yes/No option. And once I click Yes, it would call save the form data.
Note: we are already using Sitecore form. and CSaveaction is working fine. But now have to add a pop up on submit and from pop up call save action.
So please suggest how to achieve. Thank you.
| |
No, there is no any restrictions on how many times a visitor can be mapped to a pattern card based on their interactions with various pages and resources on a Sitecore website. Note, that a visitor can only be mapped to one pattern card per profile at a time and as the visitor navigates through a Sitecore website, the pattern card that they are mapped to can be changed on the fly based on their interactions on the website.
How pattern cards work
When a visitor navigates through a Sitecore website, they accumulate the profile values of all the pages and resources that they browse. Sitecore calculates the average score that the visitor has accumulated for each profile and maps the visitor to the pattern card that is the closest match using a measurement called N-Dimensional Euclidean Distance. So, it is important to assign appropriate profile values to each pattern card to ensure that profile values are applied uniformly across your website.
I suspect that in your case you either have too close or too distant profile values between your pattern cards and that is why the mapping engine doesn't respond as per your expectations. Suggest to check on your profile values setup for your pattern cards and make sure that they have the different journey pattern and don't score identically for the same interaction.
| Pattern cards not changing once assigned
I am using Sitecore personalization with Profile and Pattern cards, everything is working fine and a relevant pattern card gets assigned to visitors after 3 visits (as per the default setup), but it seems that after a few more visits after a pattern card was assigned to a visitor, that pattern card sticks to the visitor and doesn't change despite the visitor browsed other pages multiple times that are relevant to other profile and pattern cards.
Is there any threshold value that once reached that number of visits a pattern will not change and stick to that one only?
Sitecore version 10.1
| |
You can use RenderingContext.Current.Rendering.Parameters
@{
var rendering = RenderingContext.Current.Rendering;
string someParameter = rendering.Parameters["my multilist field"];
}
| Getting Rendering Parameter in View
Is there a way to get Rendering Parameter in cshtml view file without the glass mapper model?
The existing View is already using a model. So want to get the parameter without a model or glass mapper.
The Rendering parameter is a multilist field, I need the selected value of the field.
| |
You can go through the below link - https://doc.sitecore.com/xp/en/developers/sxa/93/sitecore-experience-accelerator/add-a-cookie-warning-message-to-your-site.html
If you want to be compliant with General Data Protection Regulation (GDPR) and ePrivacy, you must inform your users about collection and sharing of personal information. SXA lets you inform visitors that your site uses cookies. You can customize the message, select the warning type, and exclude pages from having cookie warnings.
To add a cookie warning to your pages:
In the Content Editor, navigate to sitecore/Content/<tenant>/<site>/Settings/Privacy Warning.
In the Privacy Warning Content section, fill in the following fields:
| How to add Cookies banner in Sitecore?
I would like to add cookies banner in Sitecore 9.1 version. I am using SXA 1.8. I have already added the Privacy warning in our site and would like to add cookies banner along with confirm , reject and manage button.
I have checked the Sitecore site there they are using cookies consent. I would like to add as its in our site.
|
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.