output
stringlengths
34
25.7k
instruction
stringlengths
81
31k
input
stringclasses
1 value
If you want to set the Title and Text properties of Link. Just update your script like the one below. $item = get-item 'master:/sitecore/content/Home'; $item.Editing.BeginEdit() [Sitecore.Data.Fields.LinkField]$linkField = $item.Fields["Link"] if($item.Version.Count -gt 0) { #update Text Value $linkField.Text= "My Text" #Update Title value. $linkField.Title = "My Title" } $item.Editing.EndEdit() Also, you can set other properties the same way by adding properties. Here are the different properties of Link field you can access. You can validate them by opening Link details: Hope it helps!
How to update the link field properties in Sitecore Powershell Extensions? I want to write a script to bulk update the link field title and text for all the components of a particular type to Read more but I struggle with figuring out how to update these properties. Here is a part of my script which takes all the search results items and goes through them to update the link field text and title but after this code is invoked and I try to read the $item.Fields["Link"].Text or Value there is no new value written so I assume that they are not saved correctly. Could you please point me out what is wrong here? ... $item.Editing.BeginEdit() [Sitecore.Data.Fields.LinkField]$linkField = $item.Fields["Link"] if($item.Version.Count -gt 0) { Switch ($item.Language){ "en" { # I tried different things like below $linkField["Text"] = "Read more" $linkField.Text = "Read more" } "de" { ... } ... } #Trying to assign the new values to the link field but when I try to read it afterwards does not work $item.Fields["Link"].Value = $linkField.Value } $item.Editing.EndEdit() > $null
I know this is not a good solution but If you don't want this functionality anymore or completely remove this then one thing you can do is delete or rename or update the code in the JS file that is handling this click event from your Sitecore application root. Here is the location of this file. wwwroot\<your-appplication-root>\sitecore\shell\client\Sitecore\ExperienceEditor\Commands\Publish.js And it will stop the publish functionality. I will suggest you to modify the JS written in this file on the click event and just use return in the functions. After modifying your changes, run the application in incognito mode to verify the latest changes. Then it will reflect. Hope this will work.
Disable publish button for admin user We would like to disable Publish button under the home menu in experience editor for admin users as well in Sitecore SXA. Tried approach : I went to core database /sitecore/content/Application/webedit/ribbons/webedit/Experience Editor /publish/publish path and tried to remove click textbox text (item:publish(id=$Target) After that I am still able to see the functionality. I have a requirement to remove the functionality of the click event, not the button. When I am clicking on publish button then it shows the publish item popup. I don't want to open this functionality.
It looks like you have done most of the steps correctly. However, the error logs indicate that the Ingress Controller isn't able to find the SSL certificates even though they are present in the same namespace. To help you further with this issue, I would suggest a few things to verify: Double-check the secret names and ensure they match with the names specified in the Ingress configuration: Run the following command to list all secrets in the sitecore namespace: kubectl get secrets --namespace sitecore Make sure the output contains the secrets global-cd-tls, global-cm-tls, and global-id-tls. Check the contents of the secrets to ensure they have the correct information: kubectl get secret global-cm-tls --namespace sitecore -o jsonpath='{.data}' This should display the base64 encoded data for the .crt and .key files. Make sure that both tls.crt and tls.key are present. Check the logs of the Ingress Controller to see if there are any issues with the secret handling: kubectl logs -n sitecore -l app.kubernetes.io/name=ingress-nginx -c controller Look for any logs related to the TLS secrets. Verify that you have the correct kubernetes.io/ingress.class annotation in your Ingress resource: In your Ingress YAML file, you have the following annotation: kubernetes.io/ingress.class: nginx Make sure that this annotation is consistent with the class specified during the installation of the Nginx Ingress Controller. The Ingress Controller needs to have the same class as the one defined in the Ingress resource. Make sure the Ingress Controller is configured to use the correct namespace: By default, the Ingress Controller watches all namespaces. However, if you have specified a specific namespace for the Ingress Controller to watch during installation, it might not be able to access the secrets in the sitecore namespace. Check the command used to deploy the Ingress Controller, specifically the --watch-namespace flag. If you find any discrepancies or issues with the above suggestions, please fix them and try again. If you still face issues, you can provide additional logs and details to help diagnose the problem. Updated 5/2/2023 To check the certificates being used by the ingress controller, you can access the website using a browser and inspect the certificate details. You should be able to confirm if the certificates being used are the ones you expect or if the default ones are still being used. Another way to verify the certificates being used is to use the openssl command to check the certificate being served by the ingress controller. Replace with the actual domain name and run the following command: openssl s_client -connect <your-domain>:443 -servername <your-domain> | openssl x509 -noout -text Update 05/04/2023 Finally, we resolved issue by adding this setting into helm installation --set controller.service.externalTrafficPolicy=Local https://learn.microsoft.com/en-us/azure/aks/ingress-basic?tabs=azure-cli The alternative way of fixing it - to use https://nip.io/ to avoid hosts file changes and this setting.
Error getting SSL certificate - Nginx Ingress Controller (Kubernetes) I am trying to deploy the vanilla Sitecore packages to Kubernetes. I have an issue mapping the domain into the cluster via the Ingress Controller. When I exec into the ingress controller pod, I can see the following log entries: Error getting SSL certificate &quot;sitecore/global-cd-tls&quot;: local SSL certificate sitecore/global-cd-tls was not found. Using default certificate Error getting SSL certificate &quot;sitecore/global-cm-tls&quot;: local SSL certificate sitecore/global-cm-tls was not found. Using default certificate Error getting SSL certificate &quot;sitecore/global-id-tls&quot;: local SSL certificate sitecore/global-id-tls was not found. Using default certificate processed ingress via admission controller {testedIngressLength:1 testedIngressTime:0.051s renderingIngressLength:1 renderingIngressTime:0.001s admissionTime:26.2kBs testedConfigurationSize:0.052} &quot;successfully validated configuration, accepting&quot; ingress=&quot;sitecore/sitecore-ingress&quot; &quot;Found valid IngressClass&quot; ingress=&quot;sitecore/sitecore-ingress&quot; ingressclass=&quot;nginx&quot; &quot;Adding secret to local store&quot; name=&quot;sitecore/global-cd-tls&quot; &quot;Adding secret to local store&quot; name=&quot;sitecore/global-cm-tls&quot; &quot;Adding secret to local store&quot; name=&quot;sitecore/global-id-tls&quot; Yet the certificates in question have been generated and deployed as secrets in the same name space as the ingress resource and the controller. I am using the following to deploy the controller: .\helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx .\helm repo update .\helm install nginx-ingress ingress-nginx/ingress-nginx ` --namespace sitecore ` --set controller.replicaCount=2 ` --set controller.nodeSelector.&quot;kubernetes\.io/os&quot;=linux ` --set defaultBackend.nodeSelector.&quot;kubernetes\.io/os&quot;=linux ` --set controller.admissionWebhooks.patch.nodeSelector.&quot;kubernetes\.io/os&quot;=linux Example ingress.yaml (cd and id removed for brevity): apiVersion: networking.k8s.io/v1 kind: Ingress metadata: namespace: sitecore name: sitecore-ingress annotations: kubernetes.io/ingress.class: nginx nginx.ingress.kubernetes.io/proxy-buffer-size: &quot;32k&quot; nginx.ingress.kubernetes.io/affinity: &quot;cookie&quot; nginx.ingress.kubernetes.io/rewrite-target: / nginx.ingress.kubernetes.io/proxy-connect-timeout: &quot;600&quot; nginx.ingress.kubernetes.io/proxy-read-timeout: &quot;600&quot; nginx.ingress.kubernetes.io/proxy-send-timeout: &quot;600&quot; nginx.ingress.kubernetes.io/proxy-body-size: &quot;512m&quot; spec: rules: - host: cm.globalhost http: paths: - path: / pathType: Prefix backend: service: name: cm port: number: 80 tls: - secretName: global-cm-tls hosts: - cm.globalhost I can confirm the following: cm/cd/id pods are deployed and show TRUE for (Initialized/Ready/ContainersReady/PodScheduled) kubectl get ingress returns (cd.globalhost, cm.globalhost, id.globalhost) with external IP from LB kubectl get services returns a entry for (nginx-ingress-ingress-nginx-controller LoadBalancer (valid External IP)) I have ran the script to generate TLS .crt and .key files I have deployed the secrets I have created a local host entry mapping cm.globalhost to the external load balancer IP address for nginx All other pods are healthy Everything is deployed to same &quot;sitecore&quot; namespace Navigating to site When trying to navigate to the URL, Site can't be reached. Within the ingress pod the following responds with 308 redirect: curl -H &quot;HOST: cm.globalhost&quot; localhost UPDATE 02/05/2023 Thanks for taking the time to look. Please see update as per your comments below: All secrets are correctly named and match those in ingress yaml (see above): Output from kubectl get secret global-cm-tls --namespace sitecore -o jsonpath='{.data}' shows base64 .key and.crt Logs from ingress pod below - note order of actions (1) create controller (2) deploy ingress (3) deploy secrets (I did it this way as described in sitecore docs - hence why secrets shown as missing initially). ------------------------------------------------------------------------------- NGINX Ingress controller Release: v1.7.0 Build: 72ff21ed9e26cb969052c753633049ba8a87ecf9 Repository: https://github.com/kubernetes/ingress-nginx nginx version: nginx/1.21.6 ------------------------------------------------------------------------------- W0502 12:39:18.009339 6 client_config.go:618] Neither --kubeconfig nor --master was specified. Using the inClusterConfig. This might not work. I0502 12:39:18.009515 6 main.go:209] &quot;Creating API client&quot; host=&quot;https://10.0.0.1:443&quot; I0502 12:39:18.043344 6 main.go:253] &quot;Running in Kubernetes cluster&quot; major=&quot;1&quot; minor=&quot;24&quot; git=&quot;v1.24.9&quot; state=&quot;clean&quot; commit=&quot;57fbbcc2804848b95cad5519f5ec9d6355430db9&quot; platform=&quot;linux/amd64&quot; I0502 12:39:18.374623 6 main.go:104] &quot;SSL fake certificate created&quot; file=&quot;/etc/ingress-controller/ssl/default-fake-certificate.pem&quot; I0502 12:39:18.403976 6 ssl.go:533] &quot;loading tls certificate&quot; path=&quot;/usr/local/certificates/cert&quot; key=&quot;/usr/local/certificates/key&quot; I0502 12:39:18.419703 6 nginx.go:261] &quot;Starting NGINX Ingress controller&quot; I0502 12:39:18.426971 6 store.go:524] &quot;ignoring ingressclass as the spec.controller is not the same of this ingress&quot; ingressclass=&quot;nginx&quot; I0502 12:39:18.429045 6 event.go:285] Event(v1.ObjectReference{Kind:&quot;ConfigMap&quot;, Namespace:&quot;sitecore&quot;, Name:&quot;nginx-ingress-ingress-nginx-controller&quot;, UID:&quot;4038b9c7-6cf6-41ae-b0fc-ce3b40bfc2ed&quot;, APIVersion:&quot;v1&quot;, ResourceVersion:&quot;4111862&quot;, FieldPath:&quot;&quot;}): type: 'Normal' reason: 'CREATE' ConfigMap sitecore/nginx-ingress-ingress-nginx-controller I0502 12:39:19.621327 6 nginx.go:304] &quot;Starting NGINX process&quot; I0502 12:39:19.621452 6 leaderelection.go:248] attempting to acquire leader lease sitecore/nginx-ingress-ingress-nginx-leader... I0502 12:39:19.621959 6 nginx.go:324] &quot;Starting validation webhook&quot; address=&quot;:8443&quot; certPath=&quot;/usr/local/certificates/cert&quot; keyPath=&quot;/usr/local/certificates/key&quot; I0502 12:39:19.622139 6 controller.go:189] &quot;Configuration changes detected, backend reload required&quot; I0502 12:39:19.626755 6 status.go:84] &quot;New leader elected&quot; identity=&quot;nginx-ingress-ingress-nginx-controller-95fc5f944-9jncx&quot; I0502 12:39:19.720627 6 controller.go:206] &quot;Backend successfully reloaded&quot; I0502 12:39:19.720952 6 controller.go:217] &quot;Initial sync, sleeping for 1 second&quot; I0502 12:39:19.721069 6 event.go:285] Event(v1.ObjectReference{Kind:&quot;Pod&quot;, Namespace:&quot;sitecore&quot;, Name:&quot;nginx-ingress-ingress-nginx-controller-95fc5f944-pcshx&quot;, UID:&quot;cab3c8f3-1267-441e-9b98-e3bd242b5e1a&quot;, APIVersion:&quot;v1&quot;, ResourceVersion:&quot;4115774&quot;, FieldPath:&quot;&quot;}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration I0502 12:39:31.812432 6 store.go:433] &quot;Found valid IngressClass&quot; ingress=&quot;sitecore/sitecore-ingress&quot; ingressclass=&quot;nginx&quot; W0502 12:39:31.812897 6 backend_ssl.go:47] Error obtaining X.509 certificate: no object matching key &quot;sitecore/global-cm-tls&quot; in local store W0502 12:39:31.812928 6 backend_ssl.go:47] Error obtaining X.509 certificate: no object matching key &quot;sitecore/global-cd-tls&quot; in local store W0502 12:39:31.812936 6 backend_ssl.go:47] Error obtaining X.509 certificate: no object matching key &quot;sitecore/global-id-tls&quot; in local store I0502 12:39:31.812964 6 event.go:285] Event(v1.ObjectReference{Kind:&quot;Ingress&quot;, Namespace:&quot;sitecore&quot;, Name:&quot;sitecore-ingress&quot;, UID:&quot;7698fe3d-7734-4bf3-82d5-c595f1420e10&quot;, APIVersion:&quot;networking.k8s.io/v1&quot;, ResourceVersion:&quot;4115869&quot;, FieldPath:&quot;&quot;}): type: 'Normal' reason: 'Sync' Scheduled for sync W0502 12:39:34.257995 6 controller.go:1372] Error getting SSL certificate &quot;sitecore/global-cm-tls&quot;: local SSL certificate sitecore/global-cm-tls was not found. Using default certificate W0502 12:39:34.258040 6 controller.go:1372] Error getting SSL certificate &quot;sitecore/global-cd-tls&quot;: local SSL certificate sitecore/global-cd-tls was not found. Using default certificate W0502 12:39:34.258056 6 controller.go:1372] Error getting SSL certificate &quot;sitecore/global-id-tls&quot;: local SSL certificate sitecore/global-id-tls was not found. Using default certificate I0502 12:39:34.258148 6 controller.go:189] &quot;Configuration changes detected, backend reload required&quot; I0502 12:39:34.362997 6 controller.go:206] &quot;Backend successfully reloaded&quot; I0502 12:39:34.363893 6 event.go:285] Event(v1.ObjectReference{Kind:&quot;Pod&quot;, Namespace:&quot;sitecore&quot;, Name:&quot;nginx-ingress-ingress-nginx-controller-95fc5f944-pcshx&quot;, UID:&quot;cab3c8f3-1267-441e-9b98-e3bd242b5e1a&quot;, APIVersion:&quot;v1&quot;, ResourceVersion:&quot;4115774&quot;, FieldPath:&quot;&quot;}): type: 'Normal' reason: 'RELOAD' NGINX reload triggered due to a change in configuration W0502 12:39:37.591931 6 controller.go:1372] Error getting SSL certificate &quot;sitecore/global-cm-tls&quot;: local SSL certificate sitecore/global-cm-tls was not found. Using default certificate W0502 12:39:37.591981 6 controller.go:1372] Error getting SSL certificate &quot;sitecore/global-cd-tls&quot;: local SSL certificate sitecore/global-cd-tls was not found. Using default certificate W0502 12:39:37.591996 6 controller.go:1372] Error getting SSL certificate &quot;sitecore/global-id-tls&quot;: local SSL certificate sitecore/global-id-tls was not found. Using default certificate I0502 12:40:05.014665 6 store.go:588] &quot;Secret was added and it is used in ingress annotations. Parsing&quot; secret=&quot;sitecore/global-cd-tls&quot; W0502 12:40:05.014991 6 backend_ssl.go:47] Error obtaining X.509 certificate: no object matching key &quot;sitecore/global-id-tls&quot; in local store W0502 12:40:05.015011 6 backend_ssl.go:47] Error obtaining X.509 certificate: no object matching key &quot;sitecore/global-cm-tls&quot; in local store I0502 12:40:05.015565 6 backend_ssl.go:67] &quot;Adding secret to local store&quot; name=&quot;sitecore/global-cd-tls&quot; W0502 12:40:05.015709 6 controller.go:1372] Error getting SSL certificate &quot;sitecore/global-cm-tls&quot;: local SSL certificate sitecore/global-cm-tls was not found. Using default certificate W0502 12:40:05.015739 6 controller.go:1372] Error getting SSL certificate &quot;sitecore/global-id-tls&quot;: local SSL certificate sitecore/global-id-tls was not found. Using default certificate I0502 12:40:05.132452 6 store.go:588] &quot;Secret was added and it is used in ingress annotations. Parsing&quot; secret=&quot;sitecore/global-cm-tls&quot; I0502 12:40:05.133338 6 backend_ssl.go:67] &quot;Adding secret to local store&quot; name=&quot;sitecore/global-cm-tls&quot; W0502 12:40:05.133829 6 backend_ssl.go:47] Error obtaining X.509 certificate: no object matching key &quot;sitecore/global-id-tls&quot; in local store I0502 12:40:05.255165 6 store.go:588] &quot;Secret was added and it is used in ingress annotations. Parsing&quot; secret=&quot;sitecore/global-id-tls&quot; I0502 12:40:05.257241 6 backend_ssl.go:67] &quot;Adding secret to local store&quot; name=&quot;sitecore/global-id-tls&quot; I0502 12:40:06.276504 6 event.go:285] Event(v1.ObjectReference{Kind:&quot;Ingress&quot;, Namespace:&quot;sitecore&quot;, Name:&quot;sitecore-ingress&quot;, UID:&quot;7698fe3d-7734-4bf3-82d5-c595f1420e10&quot;, APIVersion:&quot;networking.k8s.io/v1&quot;, ResourceVersion:&quot;4116019&quot;, FieldPath:&quot;&quot;}): type: 'Normal' reason: 'Sync' Scheduled for sync I0502 12:40:11.796932 6 status.go:84] &quot;New leader elected&quot; identity=&quot;nginx-ingress-ingress-nginx-controller-95fc5f944-clqjt&quot; Ingress.yaml is set to use kubernetes.io/ingress.class: nginx (see question above). My powershell script for deploying the ingress controller originally didnt have any reference to class (but I think nginx is default value). I updated the script and added the following lines further to your comments (but no success): --set controller.ingressClass=nginx ` --set controller.scope.namespace=sitecore Observations (based on the above) I noticed in the log file shown the line: &quot;ignoring ingressclass as the spec.controller is not the same of this ingress&quot; ingressclass=&quot;nginx&quot; Do you think this could be significant, given your comments about class? Also, I notice the lines like: Adding secret to local store&quot; name=&quot;sitecore/global-cm-tls Then there are no further errors about the certificates. How would I confirm the certificates that are being used (i.e. is default still being used?) Update Please see below the response when I run the command from within the ingress pod: openssl s_client -connect cm.globalhost:443 -servername cm.globalhost | openssl x509 -noout -text
It turns out that for 10.2 and above you need to take some additional steps to remove the dlls and .dat file: For Sitecore XP 10.2 and later versions: Disable Sitecore.Publishing.Service.*.config files in /App_Config/Modules/PublishingService folder Remove Sitecore.Publishing.Service.*.dll from /bin folder Remove items.core.sps.dat from /sitecore modules/items/core folder. more info here: https://support.sitecore.com/kb?id=kb_article_view&amp;sysparm_article=KB0154093
No service for type 'Sitecore.Publishing.Service.ResourceFiles.IResourceFilesSynchronizationManager' has been registered I'd tried to disable the publishing service on my local 10.3 instance by doing the following: Locate the Sitecore.Publishing.Service.*.config files and change the file extension to .disabled. The files can be found in the following folders: Sitecore XP 8.2: the /App_Config/Include folder. Sitecore XP 9.0: the /App_Config/Modules/PublishingService folder. Switch to the Core database and rename the /sitecore/system/Aliases/Applications/Publish item to PublishDisabled. But was getting this error:
Even though aggregate functions are not available in the Batch Segmentation UI, this is something you can achieve with SQL queries in the advanced mode. You can prepare a basic filter with you custom field through the UI and switch to the advanced mode: Then update the auto-generated SQL query by adding an aggregate function as required: Here is an example of query that selects customers with the sum of all their points greater than 100: select g.meta_ref as guest_ref from (select s.meta_guest_ref from tenant_sandbox.events as e inner join tenant_sandbox.sessions as s on e.meta_session_ref = s.meta_ref where upper(e.type) = upper('VIEW') and (cast(e.ext['customKey'] as varchar) != '' ) group by s.meta_guest_ref having sum(cast(e.ext['customKey'] as double)) > 100.0) as o //aggregate function inner join tenant_sandbox.guests as g on o.meta_guest_ref = g.meta_ref group by g.meta_ref
Can I perform Batch Segmentation by aggregate values in Sitecore CDP? I want to create a batch segment in CDP based on a custom event value aggregated from all page visits. For example, each user gets a number of points for visiting a specific page and these points are saved in CDP as a part of the event extension object: const eventData = { channel: &quot;WEB&quot;, currency: &quot;EUR&quot;, pointOfSale: &quot;TestPOS&quot;, language: &quot;EN&quot;, page: &quot;home&quot; }; const extensionData = { customKey: 10 }; await engage.pageView(eventData, extensionData); Now I need to configure a batch segment that will include website visitors with a total sum of points from all events and sessions greater than 100. How can this scenario be achieved in Sitecore CDP?
It seems due SITECORE_API_KEY environment variable in the (.env or .env.local) file is not updated with proper Edge token or sitecore api key, Please update and give a try. Thanks
Error: GraphQL Error (Code: 401): {"response":{"error":"Unauthorized","status":401 I was installing sitecore jss wioth next js and added language en-US. for deploying app, I ran - jss deploy items --language=en-US --includeContent --includeDictionary any ideas to fix it?
To set the multiple selected value for multilist field you need to pass GUIDs separated by a |. For example Service is multilist field here and selected values are guid of items. { &quot;ItemName&quot;: &quot;MyItem5&quot;, &quot;TemplateID&quot;: &quot;{76036F5E-CBCE-46D1-AF0A-4143F9B557AA}&quot;, &quot;Title&quot;: &quot;Sitecore ItemService&quot;, &quot;Text&quot;: &quot;API called&quot;, &quot;Service&quot;: &quot;{D3BCD9DF-A90E-454F-849C-8528FB3948E1}|{F26695CB-180D-4360-AC72-C285A11545C0}&quot; } You can also try these steps in Postman to create a new item using ItemService API. Refer The RESTful API for the ItemService Authentication - first step into establishing a connection is to Authenticate the REST API. Setup a post request for Create Item API. In this case create item under home item. URL = https://<your server>/sitecore/api/ssc/item/sitecore%2Fcontent%2Fhome?database=master&amp;language=en Check the response status 201 Created. Now you can validate your newly created item. Updated As per your attached screenshot, it looks like OTWC item id not properly mapped to the HandbookType fild. If you pass valid ID it will be mapped to the selected value. You can also check the Raw value from view menu. value should be an item id. i.e {4167291E-80EC-47D1-850E-B01B9322575E}. Hope it helps!
Sitecore api- create item with multilist and Media item I am using sitecore rest api, I am able to create item, also populate Content item values (for Field type Single-line) with PoSt method. Content field values are being in passed in body of rest client post request. ( ex: body{“fieldname”:”value”}) Similarly, with create item call, I am trying to populate the value for multilist field value. tried two different ways to do that: first - same as described above (pass the value as string) and second by passing itemId( the one to shown as selected value) as string value. First approach ( passing the value): result is: the item is created and in multilist field, the selected values , shows the value passed in api appears, however it also shows error and in left side of multilist, all the values present. same result. For second approach, but shows different error in selected value side of the box Maybe I need to make two calls to achieve this, one call to create item and one to update item. Trying to find if I can do both in one call and populate multilist field value as well properly. [![Error Screenshot updated][1]][1] Updated post with - Error screenshot Updated post for Media items creation - sorry for combining two questions Query 2) Sitecore REST API media item- Resource was not found Updated . Posted the media item creation in new thread, so that I can close initially query (Multilist) as resolved .
Here is an example of how you can create a custom processor to remove the lang cookie for Layout Service requests: Create a new class that inherits from JssGetLayoutServiceContextProcessor. Override the Process method and remove the lang cookie from the response object. Register your custom processor in the httpRequestBegin pipeline after the JssGetLayoutServiceContextProcessor processor. Here is an example of what the code for the custom processor might look like: using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using Sitecore.JavaScriptServices.Configuration; using Sitecore.JavaScriptServices.Core; using Sitecore.JavaScriptServices.ViewEngine.LayoutService.Pipelines.GetLayoutServiceContext; namespace MyCustom.Processors { public class RemoveLangCookieProcessor : JssGetLayoutServiceContextProcessor { public override void Process(GetLayoutServiceContextArgs args) { base.Process(args); var httpContext = args.Context.RequestServices.GetService<IHttpContextAccessor>().HttpContext; httpContext.Response.Cookies.Delete(&quot;{website}#lang&quot;); } } } Remember to register your custom processor in the httpRequestBegin pipeline after the JssGetLayoutServiceContextProcessor processor: <httpRequestBegin> <processor type=&quot;Sitecore.JavaScriptServices.ViewEngine.LayoutService.Pipelines.Services.GetLayoutServiceContext.JssGetLayoutServiceContextProcessor, Sitecore.JavaScriptServices.ViewEngine&quot;/> <processor type=&quot;MyCustom.Processors.RemoveLangCookieProcessor, MyCustom&quot;/> </httpRequestBegin>
Prevent Sitecore from creating the sitename#lang cookie in jss/nextjs app Is there a way to block Sitecore from creating the {website}#lang cookie? When Sitecore's Layout Service is used with a headless app (a next js app)? Will it be enough to add a processor in getLayoutServiceContext, that inherits JssGetLayoutServiceContextProcessor, that will remove the lang cookie? So that Layout Service will not send over the lang cookie to the next js app, that will sequentially set it up to the visitor's browser.
Looks like we cannot run sitecore nextjs app in integrated mode in local environment. That is why it was not working.
Sitecore JSS nextjs | The requested document was not found Sitecore jss nextjs sample app in connected mode. installation is done as per https://doc.sitecore.com/xp/en/developers/hd/200/sitecore-headless-development/walkthrough--creating-a-jss-next-js-application-with-the-jss-initializer.html On browsing https://appname.dev.local it gets redirected to https://appname.dev.local/sitecore/service/notfound.aspx layout service - ok Experience editor - ok localhost:3000 - ok What may have gone wrong ? If I open any wrong url, say https://appname.dev.local/sit, then it opens blank page with header
adding values to parameters in .env, scjssconfig.json and ~sc102sc.dev.local\App_Config\Sitecore\JavaScriptServices has resolved this.
ClientError: GraphQL.ExecutionError: Error trying to resolve rendered Error while jss start:connected in sitecore jss next js sample app
Right now, I believe product requests should go through the support channels at https://support.sitecore.com/. There is also a Contact Us page on Sitecore.com where you can fill a form for generic feedback to Sitecore: https://www.sitecore.com/company/contact-us It also currently lists a phone number to call: +1 855-SITECORE (+1 855-748-3267) (NOTE: As another person has mentioned, this is primarily for sales-related requests, not for technical product questions). If you are a partner, you also have partner managers that you can connect with to provide feedback. The partner portal is available at https://partners.sitecore.com If you are a customer, your customer success manager should be able to take in your feedback.
How can I send general feedback to Sitecore? As a Sitecore community member, I am looking for ways in which I can provide general feedback to Sitecore. I also have clients who want to do this. I am aware of Sitecore support tickets and specific areas for providing feedback such as the feedback buttons on knowledge base posts. I am also aware of more casual ways of providing feedback such as posting in the Sitecore Slack. Is there an email address that accepts general feedback? What are the most effective methods of submitting general feedback?
I was also facing some issues in headless SXA with Sitecore 10.3 while using partial designs but my errors were different. Nonetheless Can you please check 2 things? Value of Layout service configuration field in site settings sitecore item, path should be : /sitecore/content/[Your Tenant Name]/[Your site name]/Settings, it should be sxa-jss not jss. Check the [your front end app name].config file (in my case it was jss-nextjs-app) inside your sitecore local instance path under \App_Config\Include\zzz, check for the node Jss App Registration, Here the value of layoutServiceConfiguration attribute should be sxa-jss. One more thing - The layout service you are using in screenshot should also be sxa-jss not jss meaning the URL /sitecore/api/layout/render/sxa-jss?item...
A rendering error occurred: Cannot read properties of undefined (reading 'attributes') I have Setup the JSS application with Sitecore 10.3. When I am adding the components on page level its working fine but when I added them on partial design they are appearing fine there in experience editor as shown below but when select that partial design on page design and assign that page design on page then it is giving error &quot;A rendering error occurred: Cannot read properties of undefined (reading 'attributes')&quot;. Below is the screenshot of layout service, it seems like datasource is not binding properly. Any ideas to fix this?
The problem is with this line using (new EditContext(configurationItem, false /*updateStatistics*/, true /*silent*/)) You use true for silent which means that no events should be triggered. That also means that Sitecore will not clear its caches. And btw, EditContext is obsolete. Just use item.Editing.BeginEdit() ... item.Editing.EndEdit()
Updating other item in the custom publish pipeline not working I am trying to update an item inside custom publish pipeline in Sitecore 10.2. It does get updated once but if pipeline runs again the item is not updated. The item update code gets executed every time but it doesn't update the field every time. Only after the apppool reset it does it once and nothing after that even if the code is executed. Below is my pipeline code: public class CustomCacheUpdatePublishPipeline { public void UpdatePublishingDate(object sender, EventArgs args) { var sitecoreArgs = args as Sitecore.Events.SitecoreEventArgs; if (sitecoreArgs == null) return; var publisher = sitecoreArgs.Parameters[0] as Publisher; if (publisher == null) return; var db = Sitecore.Configuration.Factory.GetDatabase(&quot;master&quot;); Item item = publisher.Options.RootItem; Item configurationItem = db.GetItem(Templates.CarAdvisoryConfiguration.ItemId); if (item != null &amp;&amp; configurationItem != null) { ID[] templateIds = configurationItem[Templates.CarAdvisoryConfiguration.Fields.TemplateIds]?.Split('|')?.Select(x => new ID(x))?.ToArray(); if ((templateIds?.Any() ?? false) &amp;&amp; templateIds.Contains(item.TemplateID) || (item.Axes?.GetAncestors()?.Where(x => templateIds.Contains(x.TemplateID))?.Any() ?? false)) { using (new EditContext(configurationItem, false /*updateStatistics*/, true /*silent*/)) { configurationItem.Fields[Templates.CarAdvisoryConfiguration.Fields.LastUpdated].Value = DateUtil.ToIsoDate(System.DateTime.Now); //this only get updated once and doesn't get updated after say 2 mins } Database master = Sitecore.Configuration.Factory.GetDatabase(&quot;master&quot;); Database web = Sitecore.Configuration.Factory.GetDatabase(&quot;web&quot;); Sitecore.Publishing.PublishOptions publishOptions = new Sitecore.Publishing.PublishOptions(master, web, Sitecore.Publishing.PublishMode.SingleItem, configurationItem.Language, System.DateTime.Now); Sitecore.Publishing.Publisher publisher1 = new Sitecore.Publishing.Publisher(publishOptions); publisher1.Options.RootItem = configurationItem; publisher1.Options.Deep = true; publisher1.Publish(); } } } } config: <configuration xmlns:patch=&quot;http://www.sitecore.net/xmlconfig/&quot;> <sitecore> <events> <event name=&quot;publish:end&quot;> <handler type=&quot;RACQ.Feature.CarAdvisory.Pipelines.CustomCacheUpdatePublishPipeline, RACQ.Feature.CarAdvisory&quot; method=&quot;UpdatePublishingDate&quot; /> </event> </events> </sitecore> </configuration>
No. A/B and multivariate testing in XM-scaled topology. Sitecore Experience Manager (CMS-only mode) allows you to run Sitecore XP without enabling the Experience Database (xDB) or purchasing xDB licenses. Experience Manager can run the following features with limitations: Personalization – You can implement some in-session personalization rules, such as ones based on device detection, to provide personalized content to your contacts. You cannot, however, implement any personalization rules that are based on historical data, such as outcomes or past goals triggered. Device detection – The device database exists on the instance and it is possible to use the API for custom development. IP Geolocation detection – The IP Geolocation service can be enabled using the API, but personalization rules are not available. Sitecore Forms – runs without any analytics functionality. Experience Manager can not run the following features: Experience Explorer Campaign Creator Commerce Connect Content testing Email Experience Manager Experience Analytics Experience Profile List Manager Path Analyzer Segmentation Federated Experience Manager Marketing Automation You need to use the Sitecore XP topology. Reference for more details: https://www.codehousegroup.com/insights/how-to-use-ab-and-multivariate-testing-in-sitecore https://www.getfishtank.com/blog/setting-up-sitecore-personalization-second-step Hope it helps!
Is it possible to do A/B or Multivariate testing in Sitecore XM scaled topology? Can we use Sitecore A/B and multivariate testing in XM scaled topology? If no, what can be the possible options?
You need to define separate routes for entries like that: routes.MapRoute( name: &quot;routeNameVirtualFolder&quot;, url: &quot;{virtualFolder}/api/ContrrolerName/ActionName&quot;, defaults: new { controller = &quot;Test&quot;, action = &quot;action&quot;, id = UrlParameter.Optional } ); routes.MapRoute( name: &quot;routeNameVirtualSubFolder&quot;, url: &quot;{virtualFolder}/{virtualSubFolder}/api/ContrrolerName/ActionName&quot;, defaults: new { controller = &quot;Test&quot;, action = &quot;action&quot;, id = UrlParameter.Optional } );
{virtualFolder} in route config is not taking full path defined on the site defnition file My current Sitecore(9.0.2) project have multisite implementation with URL structure as follows Url: www.MainSite.com virtual folder:/ Url: www.MainSite.com/SubSite virtual folder:/SubSite Url: www.MainSite.com/SubSite/Site1 virtual folder:/SubSite/Site1 Url: www.MainSite.com/SubSite/Site2 virtual folder:/SubSite/Site2 We have to use a common Sitecore component for SubSite, Site1, and Site2. the component has Ajax form posting and for this, I have added a single route entry for each of the APIs as follows: routes.MapRoute( name: &quot;routeName&quot;, url: &quot;{virtualFolder}/api/ContrrolerName/ActionName&quot;, defaults: new { controller = &quot;Test&quot;, action = &quot;action&quot;, id = UrlParameter.Optional }); The above routing is perfectly working for SubSite and when used on Site1 it is returning a 404 error during Ajax post. However, it is working correctly when I removed SubSite from URL ie, www.MainSite.com/Site1. So I understand that {virtualFolder} is not returning the path defined on siteconfig file. It is returning only the last part. Anybody help me to resolve this issue
You can achieve this with the help of PowerShell script - This PowerShell script creates a Sitecore package by adding items to it based on an array of item IDs, and then exports the package as a ZIP file and offers it for download. $itemIdArray = @(&quot;itemId&quot;, &quot;itemId&quot;, &quot;itemId&quot;) #Add Item Id's in this Array $package = New-Package &quot;Delta Package&quot;; # Set package metadata $package.Sources.Clear(); $package.Metadata.Author = &quot;Admin&quot;; $package.Metadata.Publisher = &quot;Admin&quot;; $package.Metadata.Version = &quot;1.0&quot;; # Add items to the package foreach ($itemId in $itemIdArray) { $source = Get-Item -Path &quot;master:&quot; -ID $itemId | New-ItemSource -Name 'N/A' -InstallMode Overwrite $package.Sources.Add($source); } # Save package Export-Package -Project $package -Path &quot;$($package.Name)-$($package.Metadata.Version).zip&quot; -Zip # Offer the user to download the package Download-File &quot;$SitecorePackageFolder\$($package.Name)-$($package.Metadata.Version).zip&quot; Hope this helps!
Way to quickly Move Delta content to other environments in one go I have been working on an upgrade project from Sitecore 8.2 to Sitecore 10. The project is almost complete and we fetched the delta content in the form of item IDs, that have been created or updated since we took a copy of the database. Is it possible to create a bulk package to move all of these changes in one go? Are there any other ways to move these changes quickly and efficiently? Thanks in Advance!
To solve this weird issue, I performed below two steps: When a user is already logged in and tries to open the login page in another tab then this issue was coming so to solve this issue, on RedirectToIdentityProvider method I checked if a user is already logged in then redirect to the dashboard page instead to go to Keycloak again. RedirectToIdentityProvider = notification => { if (notification.ProtocolMessage.RequestType == OpenIdConnectRequestType.Authentication) { if (Sitecore.Context.User.IsAuthenticated) { notification.HandleResponse(); notification.Response.Redirect(REDIRECTURL); } else { notification.ProtocolMessage.SetParameter(&quot;kc_idp_hint&quot;, &quot;saml&quot;); } } return System.Threading.Tasks.Task.CompletedTask; } Second scenario is that after session timeout when the user redirects to the login page then the user tries to log in again the same error was coming so to solve that I wrote a pipeline on httpRequestBegin public override void Process(HttpRequestArgs args) { if (Context.User.IsAuthenticated || Context.User?.Name == null || !Context.PageMode.IsNormal) { return; } CacheManager.ClearSecurityCache(Context.User.Name); RecentDocuments.Remove(Context.User.Name); Sitecore.Shell.Framework.Security.Abandon(); string currentTicketId = TicketManager.GetCurrentTicketId(); if (string.IsNullOrEmpty(currentTicketId)) { return; } TicketManager.RemoveTicket(currentTicketId); }
Federation Authentication with KeyCloak: Bad Request Issue I am using Sitecore 10.1.2 and we have integrated Key Cloak on the CM server, also we have disabled the Sitecore Identity server. Below is the code:      protected override void ProcessCore(IdentityProvidersArgs args)         {             Assert.ArgumentNotNull(args, &quot;args&quot;);             IdentityProvider = this.GetIdentityProvider();             var httphandler = new HttpClientHandler();             httphandler.DefaultProxyCredentials = CredentialCache.DefaultCredentials;             //httphandler.SslProtocols = SslProtocols.Ssl3 | SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12;             httphandler.CheckCertificateRevocationList = true;             httphandler.ServerCertificateCustomValidationCallback = (message, cert, chain, sslPolicyErrors) =>             {                 return true;             };             var httpclient = new HttpClient();             httpclient.DefaultRequestHeaders.TryAddWithoutValidation(Settings.GetSetting(KeycloakSettings.HeaderKey1, &quot;&quot;), Settings.GetSetting(KeycloakSettings.HeaderValue1, &quot;&quot;));             httpclient.DefaultRequestHeaders.TryAddWithoutValidation(Settings.GetSetting(KeycloakSettings.HeaderKey2, &quot;&quot;), Settings.GetSetting(KeycloakSettings.HeaderValue2, &quot;&quot;));             ServicePointManager.Expect100Continue = true;             ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;             Log.Info(&quot;code entered ProcessCore&quot;, this);               var options = new OpenIdConnectAuthenticationOptions             {                 BackchannelHttpHandler = httphandler,                 //Backchannel = httpclient,                 RequireHttpsMetadata = false,                 MetadataAddress = MetadataAddress,                 ClientId = ClientId,                 ClientSecret = ClientSecret,                 Authority = Authority,                 RedirectUri = GetCallbackUrl(args),                 ResponseType = OpenIdConnectResponseType.Code,                 Scope = OpenIdScope,                 AuthenticationType = IdentityProvider.Name,                 RedeemCode = true,                                 TokenValidationParameters = new TokenValidationParameters                 {                     NameClaimType = &quot;name&quot;                 },                   Notifications = new OpenIdConnectAuthenticationNotifications                 {                     AuthenticationFailed = (AuthenticationFailedNotification<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> notification) =>                     {                         Log.Info(&quot;code entered the authentication failed event&quot;, this);                         if (notification.Exception != null)                         {                             Log.Info($&quot;Keycloak authorization fail with exception.\n {notification.Exception.Message}&quot;, this);                               notification.HandleResponse();                               // This exception should no longer be valid if we use inject KentorOwinCookieSaver middleware before OpenIdConnectAuthentication. However, we keep this code to safeguard against future.                             if (notification.Exception.Message.Contains(&quot;IDX21323&quot;))                             {                                 notification.HandleResponse();                                 /* This line of code is the key to solve error                                 IDX21323: RequireNonce is '[PII is hidden]'. OpenIdConnectProtocolValidationContext.Nonce was null, OpenIdConnectProtocol.ValidatedIdToken.Payload.Nonce was not null.                                 The nonce cannot be validated. If you don't need to check the nonce, set OpenIdConnectProtocolValidator.RequireNonce to 'false'. Note if a 'nonce' is found it will be evaluated.                                */                                 notification.OwinContext.Authentication.Challenge();                                 return System.Threading.Tasks.Task.CompletedTask;                             }                         }                           notification.HandleResponse();                         notification.Response.Redirect(accessDeniedRelativePath);                           return System.Threading.Tasks.Task.CompletedTask;                     },                     SecurityTokenValidated = OnSecurityTokenValidated,                     //AuthorizationCodeReceived = ProcessAuthorizationCodeReceived,                     RedirectToIdentityProvider = notification =>                     {                         Log.Info(&quot;code entered the RedirectToIdentityProvider event&quot;, this);                         if (notification.ProtocolMessage.RequestType == OpenIdConnectRequestType.Authentication)                         {                             notification.ProtocolMessage.SetParameter(&quot;kc_idp_hint&quot;, &quot;saml&quot;);                         }                         if (notification.ProtocolMessage.RequestType == OpenIdConnectRequestType.Logout)                         {                             // If signing out, add the id_token_hint                             var idTokenClaim = notification.OwinContext.Authentication.User.FindFirst(idToken);                               if (idTokenClaim != null)                                 notification.ProtocolMessage.IdTokenHint = idTokenClaim.Value;                         }                           return System.Threading.Tasks.Task.CompletedTask;                     }                 }             };               // Sequence of this middleware matters. The KentorOwinCookieSave must comes before OpenIdConnectAuthentication.             args.App.UseKentorOwinCookieSaver();             args.App.UseOpenIdConnectAuthentication(options);         } Once I logged in through KeyCloak it works, but when I try to open the Sitecore login page in another tab in the same browser and again click on KeyCloak to login, it shows a Bad Request error: The size of a request header field exceeds the server limit) error: When I log in for the first time I can see the below two cookies have been created: AspNet.CookiesC1 (Cookie size is 4047 Bytes) AspNet.CookiesC2 (Cookie size is 281 Bytes) and when I do log in for the second time, two new cookies have been created: AspNet.ExternalCookies.C1 (Cookie size is 4047 Bytes) AspNet.ExternalCookies.C2 (Cookie size is 401 Bytes) Any recommendations on how I can resolve the above error?
There is a PopulateManagedSchema.aspx admin page at sitecoreinstance\sitecore\admin folder. When you click on Populate Solr Managed Schema link under the control panel, select the indexes checkbox and hit Populate button, under the hood it triggers the PopulateManagedSchema.aspx page load method to populate schema. Here you will see the populate schema code. It is part of Sitecore.ContentSearch.Client.dll If you want some custom implementation then you can try out to create a custom aspx page and use any decompiler tool to understand and see the code Sitecore.ContentSearch.Client.dll you will find this code at Sitecore.ContentSearch.Client.sitecore.admin.PopulateManagedSchema and customize as per your requirement. You need to mainly use this piece of code: try { bool flag = text2.ToLower().Equals(&quot;all&quot;); Log.Audit(&quot;Start Populating Managed Schema from Admin Page, indexes: &quot; + string.Join(&quot;, &quot;, list.ToArray()), this); foreach (ISearchIndex index in ContentSearchManager.Indexes) { if (flag || list.Contains(index.Name.ToLower())) { SchemaCustodian.PopulateManagedSchema(index); } } stringBuilder.Append(&quot; OK<br/>&quot;); } catch (Exception ex) { stringBuilder.Append(string.Concat(&quot;<textarea class='exception'>&quot;, ex, &quot;</textarea><br/>&quot;)); } You can validate it directly like, if you call it with URL and pass '|' index names it would update the managed-schema and then you can check at solr folder. https://yourSitecoreInstance/sitecore/admin/PopulateManagedSchema.aspx?indexes=sitecore_master_index|test_products_master_index Hope it helps!
Programmatically Populate Schema I would like to create a custom aspx page to populate Solr schema akin to how you create a custom aspx page to rebuild indexes (https://doc.sitecore.com/xp/en/developers/102/platform-administration-and-architecture/rebuild-search-indexes.html) This is part of a larger PaaS deployment automation so I will not be using the endpoint that you can use to populate schema as that requires logging into Sitecore first (https://doc.sitecore.com/xp/en/developers/102/platform-administration-and-architecture/solr-managed-schemas.html) Is there a good way to create a custom aspx page for calling a populate schema akin to the example in the Sitecore docs per rebuilding indexes? I use the Sitecore CLI for my local development but am choosing the custom aspx pages as part of the larger deployment automation for Azure PaaS environments.
Below are the few steps which you need to do: Create a new file MultiRootTreeList.cs and add the below code. namespace Sitecore.Foundation.CustomFields.Fields { public class MultiRootTreeList : TreeList { protected override void OnLoad(EventArgs args) { Assert.ArgumentNotNull(args, &quot;args&quot;); base.OnLoad(args); if (!Sitecore.Context.ClientPage.IsEvent) { // find the existing TreeviewEx that the base OnLoad added, get a ref to its parent, and remove it from controls var existingTreeView = (TreeviewEx)WebUtil.FindControlOfType(this, typeof(TreeviewEx)); var treeviewParent = existingTreeView.Parent; existingTreeView.Parent.Controls.Clear(); // remove stock treeviewex, we replace with multiroot // find the existing DataContext that the base OnLoad added, get a ref to its parent, and remove it from controls var dataContext = (DataContext)WebUtil.FindControlOfType(this, typeof(DataContext)); var dataContextParent = dataContext.Parent; dataContextParent.Controls.Remove(dataContext); // remove stock datacontext, we parse our own // create our MultiRootTreeview to replace the TreeviewEx var impostor = new Sitecore.Web.UI.WebControls.MultiRootTreeview(); impostor.ID = existingTreeView.ID; impostor.DblClick = existingTreeView.DblClick; impostor.Enabled = existingTreeView.Enabled; impostor.DisplayFieldName = existingTreeView.DisplayFieldName; // parse the data source and create appropriate data contexts out of it var dataContexts = ParseDataContexts(dataContext); impostor.DataContext = string.Join(&quot;|&quot;, dataContexts.Select(x => x.ID)); foreach (var context in dataContexts) dataContextParent.Controls.Add(context); // inject our replaced control where the TreeviewEx originally was treeviewParent.Controls.Add(impostor); } } /// <summary> /// Parses multiple source roots into discrete data context controls (e.g. 'dataSource=/sitecore/content|/sitecore/media library') /// </summary> /// <param name=&quot;originalDataContext&quot;>The original data context the base control generated. We reuse some of its property values.</param> /// <returns></returns> protected virtual DataContext[] ParseDataContexts(DataContext originalDataContext) { return new ListString(DataSource).Select(x => CreateDataContext(originalDataContext, x)).ToArray(); } /// <summary> /// Creates a DataContext control for a given Sitecore path data source /// </summary> protected virtual DataContext CreateDataContext(DataContext baseDataContext, string dataSource) { DataContext dataContext = new DataContext(); dataContext.ID = GetUniqueID(&quot;D&quot;); dataContext.Filter = baseDataContext.Filter; dataContext.DataViewName = &quot;Master&quot;; if (!string.IsNullOrEmpty(DatabaseName)) { dataContext.Parameters = &quot;databasename=&quot; + DatabaseName; } dataContext.Root = dataSource; dataContext.Language = Language.Parse(ItemLanguage); return dataContext; } } } Create a new config file and add below code: <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?> <configuration xmlns:patch=&quot;http://www.sitecore.net/xmlconfig/&quot;> <sitecore> <controlSources> <source mode=&quot;on&quot; namespace=&quot;Sitecore.Foundation.CustomFields.Fields&quot; assembly=&quot;Sitecore.Foundation.CustomFields&quot; prefix=&quot;customfields&quot; /> </controlSources> </sitecore> </configuration> Switch to Core Database and Navigate to this location /sitecore/system/Field types/List Types (or you can create your custom folder) Create a new item using this template /sitecore/templates/System/Templates/Template field type Add Assembly and Class. Now you will able to see your custom field in the template where you can select your custom field and add Datasource.
How to use Sitecore Multiroot Treelist Using Sitecore 10.3 I would like to try the Multiroot Treelist field. The requirement is to have an option for the author to choose from multiple locations, in the treelist field. Could anyone please help me how to make use of this - https://kamsar.net/index.php/2015/05/A-Multiple-Root-Treelist-Field/ I have deployed the code. Do I need to add any patch config? Because when I try with different &quot;queries&quot; in the &quot;Source&quot; of that field, nothing happens or it throws an error. I have tried these queries: {6CB91F7C-E722-4B9D-BA10-A909DC3BB80D}|{21329DDA-B575-44EA-A6A8-B172B6E9C738} Those are IDs of two folders under the content node. The field is blank and the select option is unavailable. datasource={6CB91F7C-E722-4B9D-BA10-A909DC3BB80D}|{21329DDA-B575-44EA-A6A8-B172B6E9C738} Throws an error. query:/sitecore/content//*[@templateid='my banners folder template id'] This query works perfect in the rendering datasource field. Wanted the same in the Treelist field also, but no luck.
Instead of merging the AJAX response with the input parameter immediately, you can modify your code to handle the AJAX response asynchronously. This means that you would move the code that merges the response with the input parameter inside the AJAX success callback function. This way, the merging will only occur once the AJAX call has completed and the response is available. function sendPageData(inputParameter) { $.ajax({ url: 'your-api-url', success: function(response) { // Merge the response with the input parameter here var mergedData = mergeData(inputParameter, response); // Use the merged data // ... } }); } function mergeData(inputParameter, response) { // Merge the input parameter array and the response array here // ... return mergedArray; } // Call the sendPageData function on page load $(document).ready(function() { var inputParameter = // Collect data from the home page sendPageData(inputParameter); });
Handling ajax response on page load In JS file, we're collecting some data on home page and sending to JS function called sendPageData() as an input parameter. In this sendPageData() function, we're calling $.ajax call and merging this ajax call response with input parameter. This activity is being done on page load. Finally we're merging input parameter array and ajax response array but ajax call response is missing in final array response because $.ajax call take sometime to respond since it's back-end call. One option is to create one controller rendering component, call REST API call to fetch data and keep the response object in script tag. This way when JS function is called after page load, this object can be used. Is there any better way to capture REST API response on page load?
Azure Search Switch On Rebuild feature is only relevant for the full index rebuild. When configured correctly, it tells Sitecore to perform index rebuild in a new index while keeping the current instance as the primary index. Once the new index is fully built, Sitecore will switch to the new index and make it the primary index, then the old one will be removed. Behaviour you mentioned is not connected to the Switch On Rebuild functionality because updating, creating, deleting and publishing items trigger incremental index updates rather than full index rebuild. Depending on how your indexes are configured, these incremental changes can be processed synchronously, asynchronously, based on an interval, etc. You can read more about different indexing strategies in Sitecore documentation here.
Switch on rebuild Sitecore 9.0.2 issue We are using Azure search in Sitecore 9.0 update 2 version, We enabled switch on rebuild option to achieve 0 downtime during the rebuild. Every time when indexes (_sxa_web_index) rebuilding we notice that this stragies are not working with Unpublish item (when we check unpublish item or delete item) but working with update or create item. No errors or exceptions in logs.
You can use the Below Powershell Script if you want to enable the caching on Multiple Pages having Spotlight Widget Rendering # Set the startPath as per the requirement $startPath = &quot;master:/sitecore/content/Home&quot; $items = Get-ChildItem -Path $startPath -Language &quot;en&quot; -Recurse foreach ($item in $items) { $renderingInstance = Get-Rendering -Item $item -FinalLayout foreach($renderingObj in $renderingInstance) { $renderingItem = Get-Item $renderingObj.ItemID #ADD the Rendering ID on which you want to enable caching if($renderingItem.ID -eq &quot;{DD8E8E1F-5532-4638-9FF2-58D0E0264B08}&quot;) { $renderingObj.Cachable = 1 $renderingObj.VaryByData = 1 Set-Rendering -Item $item -Instance $renderingObj Write-Host &quot;Caching Enabled on --&quot; $item.Name &quot;||&quot; $item.ID } } } Refer - https://insightswithvishalkhera.wordpress.com/2023/03/01/powershell-script-to-enable-caching-on-sitecore-rendering/
How to enable Caching on Page Level for a particular component I want to enable caching on Spotlight Widget Rendering, which is added on multiple pages. And we want to enable it for 2 sites only. Can anyone please help me in this?
I was able to figure this out. You can not add these rules directly into the user group policies, These are automatically created when you add users/groups to a collection. Ex: When you go to a collection page there is a link called User access at top right of the page. Once you click on it, it will open a popup and give you the option to add user/user groups who can access this collection. Once you add any user group, these inbuilt rule will be added to that user group policies automatically.
How to add built-in rules in user group policies? Any idea how can we add built-in rules in user group policies of content hub? There are few built-in rules added in our content hub production instance and I just wanted to replicate them in our lower environment, but could not find how to do that. Screenshot of built in rule(Production). Note: These built-in rules are not allowing me to update any check boxes. Thanks
When it comes to upgrading your Sitecore environment to address PCI compliance issues, it is generally recommended to upgrade all components to the latest version to ensure a consistent and secure setup. While it may be tempting to upgrade only the CD (Content Delivery) server, CM (Content Management) server, and ID (Identity) server, and leave the other services on the 10.0.1 version, it is not the ideal approach. Sitecore releases new versions to address security vulnerabilities, bug fixes, and introduce enhancements. By upgrading all the components to Sitecore 10.0.3, you ensure that your entire environment is up-to-date and benefits from the latest security patches and improvements. Leaving some services on an older version could introduce compatibility issues and potential security vulnerabilities, which may impact the overall security and stability of your Sitecore deployment. Therefore, it is recommended to upgrade all the relevant components, including CD, CM, ID, and any other services, to Sitecore 10.0.3 to ensure a consistent and secure environment.
Upgrade from Sitecore 10.0.1 (update 1) to Sitecore 10.0.3 (update 3) There are some PCI compliance issues reported with Sitecore 10.0.1 (CD) image. I want to upgrade from Sitecore 10.0.1 to Sitecore 10.0.3 so is upgrading CD(10.0.3) , CM and ID (to use sitecore-id6) images sufficient and use 10.0.1 images for rest of the services ?
When you delete a Sitecore item programmatically using the item.Delete() method in C#, any references to the deleted item will remain in the system, resulting in broken links. To remove these broken links, you can use the Sitecore LinkDatabase. Here is an example of how you can remove broken links to a deleted item: var itemToDelete = Sitecore.Context.Database.GetItem(&quot;/path/to/item&quot;); // Delete the item itemToDelete.Delete(); // Get the item's ID var itemId = itemToDelete.ID; // Remove all references to the deleted item from the link database var links = Sitecore.Globals.LinkDatabase.GetItemReferrers(itemToDelete, false); foreach (var link in links) { var item = link.GetSourceItem(); if (item != null) { using (new Sitecore.SecurityModel.SecurityDisabler()) { var field = item.Fields[link.SourceFieldID]; if (field != null) { var value = field.Value; if (Sitecore.StringUtil.Contains(value, itemId.ToString())) { value = value.Replace(itemId.ToString(), string.Empty); item.Editing.BeginEdit(); field.Value = value; item.Editing.EndEdit(); } } } } } In this example, We used Sitecore.Globals.LinkDatabase.GetItemReferrers(itemToDelete, false) to get all the items that refer to the deleted item. This should remove all broken links to the deleted item from the link database.
How to Remove Dependable Links when deleting item using item.Delete() We are programmatically removing items using item.Delete() in C#. Deleted items that were linked to other items are appearing as broken link When manually deleting in Sitecore we get options like below img But when removed from code it not removing links.How to remove links programmatically before deleting item ?
publishcollection is a privilege that is required to be able to publish collections. Please check your user group has this privilege assigned on the Privileges tab. Manage-> Users -> User groups (then user group policies -> Privileges tab)
Getting 'you do not have rights to publish collection' error message In one of my Asset collections, I assigned Manager access level for one user group. However, when I am trying to access this collection using one of the the user that belongs to the user group, it is showing me the option of &quot;share collection link&quot;. When I click on this, I am getting an error &quot;You do not have rights to publish collections&quot;. What could I be missing? See the screenshots for references
The error You do not have access to the system. If you think this is wrong, please contact the system administrator is a Sitecore error which means that the user who tries to log in does not have any roles allowing access to Sitecore CMS. As your externalUserBuilder is configured to create virtual users, their roles should be mapped from claims during login. The recommended approach is to assign groups/roles in the external identity provider (Keycloak) and map them to Sitecore roles in the config. Here is an example of role mapping config: <transformation name=&quot;Role transformation&quot; type=&quot;Sitecore.Owin.Authentication.Services.DefaultTransformation, Sitecore.Owin.Authentication&quot;> <sources hint=&quot;raw:AddSource&quot;> <claim name=&quot;groups&quot; value=&quot;{Group name from claim}&quot; /> </sources> <targets hint=&quot;raw:AddTarget&quot;> <claim name=&quot;http://schemas.microsoft.com/ws/2008/06/identity/claims/role&quot; value=&quot;sitecore\Sitecore Client Authoring&quot; /> </targets> <keepSource>true</keepSource> </transformation> Just replace &quot;groups&quot; with your claim name and insert your group as the value. Sitecore role &quot;sitecore\Sitecore Client Authoring&quot; can be replaced with any standard or custom Sitecore role. You can also have multiple <transformation> config sections for different roles.
Federation Authentication Error: You do not have access to the system. If you think this is wrong, please contact the system administrator I am using Sitecore 10.1 and I want to do federation authentication on the CM server. When I am clicking on &quot;Log in with keycloak&quot; button it is redirecting to Keycloak URL and after entering my username and password, it is coming back to the Sitecore login page. But it is showing the error message &quot;You do not have access to the system. If you think this is wrong, please contact the system administrator.&quot; Below is OnSecurityTokenValidated, I am getting IsAuthenticated true and getting claims as well. Below is my code: <configuration xmlns:patch=&quot;http://www.sitecore.net/xmlconfig/&quot; xmlns:role=&quot;http://www.sitecore.net/xmlconfig/role/&quot; xmlns:env=&quot;http://www.sitecore.net/xmlconfig/env/&quot; xmlns:zone=&quot;http://www.sitecore.net/xmlconfig/zone/&quot;> <sitecore role:require=&quot;ContentManagement or Standalone&quot;> <pipelines> <owin.identityProviders> <processor type=&quot;XXX.KeycloakIdentityProvider, XXX.Website&quot; resolve=&quot;true&quot; /> </owin.identityProviders> </pipelines> <federatedAuthentication type=&quot;Sitecore.Owin.Authentication.Configuration.FederatedAuthenticationConfiguration, Sitecore.Owin.Authentication&quot;> <identityProvidersPerSites hint=&quot;list:AddIdentityProvidersPerSites&quot;> <!-- Defines a list of providers assigned to all sites. --> <mapEntry name=&quot;all sites&quot; type=&quot;Sitecore.Owin.Authentication.Collections.IdentityProvidersPerSitesMapEntry, Sitecore.Owin.Authentication&quot; resolve=&quot;true&quot;> <sites hint=&quot;list&quot;> <site>regexp:.*</site> </sites> <identityProviders hint=&quot;list:AddIdentityProvider&quot;> <identityProvider ref=&quot;federatedAuthentication/identityProviders/identityProvider[@id='keycloak']&quot; /> </identityProviders> <externalUserBuilder type=&quot;Sitecore.Owin.Authentication.Services.DefaultExternalUserBuilder, Sitecore.Owin.Authentication&quot; resolve=&quot;true&quot;> <IsPersistentUser>false</IsPersistentUser> </externalUserBuilder> </mapEntry> </identityProvidersPerSites> <identityProviders> <identityProvider id=&quot;keycloak&quot; type=&quot;Sitecore.Owin.Authentication.Configuration.DefaultIdentityProvider, Sitecore.Owin.Authentication&quot;> <param desc=&quot;name&quot;>$(id)</param> <param desc=&quot;domainManager&quot; type=&quot;Sitecore.Abstractions.BaseDomainManager&quot; resolve=&quot;true&quot; /> <caption>Log in with keycloak</caption> <icon>/sitecore/shell/themes/standard/Custom/24x24/msazure.png</icon> <domain>sitecore</domain> <enabled>true</enabled> <transformations hint=&quot;list:AddTransformation&quot;> <transformation name=&quot;Idp Claim&quot; type=&quot;Sitecore.Owin.Authentication.Services.SetIdpClaimTransform, Sitecore.Owin.Authentication&quot; /> <transformation name=&quot;set id_token claim&quot; type=&quot;Sitecore.Owin.Authentication.Services.SaveIdTokenInClaim, Sitecore.Owin.Authentication&quot; /> <transformation type=&quot;Sitecore.Owin.Authentication.Services.DefaultTransformation, Sitecore.Owin.Authentication&quot;> <sources hint=&quot;raw:AddSource&quot;> <claim name=&quot;http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress&quot; /> </sources> <targets hint=&quot;raw:AddTarget&quot;> <claim name=&quot;Email&quot; /> </targets> <keepSource>false</keepSource> </transformation> </transformations> </identityProvider> </identityProviders> <propertyInitializer type=&quot;Sitecore.Owin.Authentication.Services.PropertyInitializer, Sitecore.Owin.Authentication&quot;> <maps hint=&quot;list&quot;> <map name=&quot;set SSO FullName&quot; type=&quot;Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication&quot; resolve=&quot;true&quot; patch:source=&quot;Project.NAC.AzureAD.config&quot;> <data hint=&quot;raw:AddData&quot;> <source name=&quot;full_name&quot; /> <target name=&quot;FullName&quot; /> </data> </map> <map name=&quot;Given Name&quot; type=&quot;Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication&quot; resolve=&quot;true&quot;> <data hint=&quot;raw:AddData&quot;> <source name=&quot;http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname&quot; /> <target name=&quot;Name&quot; /> </data> </map> </maps> </propertyInitializer> </federatedAuthentication> </sitecore> </configuration> public class KeycloakIdentityProvider : IdentityProvidersProcessor { protected override string IdentityProviderName => &quot;keycloak&quot;; private string ClientId => Settings.GetSetting(KeycloakSettings.ClientId, &quot;&quot;); private string ClientSecret => Settings.GetSetting(KeycloakSettings.ClientSecret, &quot;&quot;); private string Authority => Settings.GetSetting(KeycloakSettings.Authority, &quot;&quot;); private string OAuthRedirectUri => Settings.GetSetting(KeycloakSettings.OAuthRedirectUri, &quot;&quot;); private string MetadataAddress => Settings.GetSetting(KeycloakSettings.MetadataAddress, &quot;&quot;); private readonly string idToken = &quot;id_token&quot;; private readonly string accessDeniedRelativePath = &quot;/custom/errorpages/Forbidden.aspx&quot;; public KeycloakIdentityProvider(FederatedAuthenticationConfiguration federatedAuthenticationConfiguration, Microsoft.Owin.Infrastructure.ICookieManager cookieManager, BaseSettings settings) : base(federatedAuthenticationConfiguration, cookieManager, settings) { } protected IdentityProvider IdentityProvider { get; set; } protected override void ProcessCore(IdentityProvidersArgs args) { Assert.ArgumentNotNull(args, &quot;args&quot;); IdentityProvider = this.GetIdentityProvider(); var identityProvider = this.GetIdentityProvider(); var saveSigninToken = identityProvider.TriggerExternalSignOut; var options = new OpenIdConnectAuthenticationOptions { RequireHttpsMetadata = false, MetadataAddress = MetadataAddress, ClientId = ClientId, ClientSecret = ClientSecret, Authority = Authority, RedirectUri = GetCallbackUrl(args), ResponseType = OpenIdConnectResponseType.Code, Scope = OpenIdConnectScope.OpenIdProfile + &quot; &quot; + OpenIdConnectScope.OfflineAccess, AuthenticationType = IdentityProvider.Name, RedeemCode = true, TokenValidationParameters = new TokenValidationParameters { SaveSigninToken = saveSigninToken }, Notifications = new OpenIdConnectAuthenticationNotifications { AuthenticationFailed = (AuthenticationFailedNotification<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> notification) => { Log.Info(&quot;code entered the authentication failed event&quot;, this); if (notification.Exception != null) { Log.Info($&quot;Keycloak authorization fail with exception.\n {notification.Exception.Message}&quot;, this); notification.HandleResponse(); if (notification.Exception.Message.Contains(&quot;IDX21323&quot;)) { notification.HandleResponse(); notification.OwinContext.Authentication.Challenge(); return System.Threading.Tasks.Task.CompletedTask; } } notification.HandleResponse(); notification.Response.Redirect(accessDeniedRelativePath); return System.Threading.Tasks.Task.CompletedTask; }, SecurityTokenValidated = OnSecurityTokenValidated, RedirectToIdentityProvider = notification => { Log.Info(&quot;code entered the RedirectToIdentityProvider event&quot;, this); if (notification.ProtocolMessage.RequestType == OpenIdConnectRequestType.Authentication) { notification.ProtocolMessage.SetParameter(&quot;kc_idp_hint&quot;, &quot;saml&quot;); } if (notification.ProtocolMessage.RequestType == OpenIdConnectRequestType.Logout) { var idTokenClaim = notification.OwinContext.Authentication.User.FindFirst(idToken); if (idTokenClaim != null) notification.ProtocolMessage.IdTokenHint = idTokenClaim.Value; } return System.Threading.Tasks.Task.CompletedTask; } } }; args.App.UseKentorOwinCookieSaver(); args.App.UseOpenIdConnectAuthentication(options); } private System.Threading.Tasks.Task OnSecurityTokenValidated(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 System.Threading.Tasks.Task.CompletedTask; } private string GetCallbackUrl(IdentityProvidersArgs args) { string settingValue = Settings.GetSetting(&quot;Sitecore.CM.LoadBalanceDNS&quot;); var hostName = string.IsNullOrEmpty(settingValue) ? HttpContext.Current.Request.Url.AbsoluteUri : settingValue; return string.Concat(hostName, &quot;/&quot;, OAuthRedirectUri); } private void HandleAuthorizationError(AuthorizationCodeReceivedNotification notification) { // Log Error notification.HandleResponse(); notification.Response.Redirect(accessDeniedRelativePath); } }
We also just started encountering this STATUS_BREAKPOINT error today when inserting an image and pressing Accept in the rich text editor in Sitecore 10.2. It occurs in both Microsoft Edge and Google Chrome. Opening up the browser dev tools, selecting the Network tab, and checking &quot;Disable cache&quot; seems to prevent the error, which can be used as a temporary workaround. It doesn't generally occur for us the first time someone attempts to insert an image. It occurs pretty reliably after inserting an image on one item, navigating to another item, navigating back to the first item, and attempting to insert an image again.
Is "STATUS_BREAKPOINT" a Known Error in Rich Text Editor We have a user who's having this problem in Sitecore 9.2. In the Rich Text Editor (RTE), they insert an image from the media library into their text; when they then click the Accept button to exit the RTE, they get a &quot;STATUS_BREAKPOINT&quot; error dialog. It gives little information about what's wrong (and the internet implies STATUS_BREAKPOINT is largely used as a blanket category for ambiguous forms of browser errors.) This does not seem to happen with all images - just some. Is there a known cause in Sitecore for this problem?
It is not required to install Sitecore using docker. You can easily install it using Sitecore Installation Assistant (SIA). Installing Sitecore 10 using Sitecore Installation Assistant (SIA) is quick and easy. Below are the 10 steps to get you started. Install SQL Server 2017 or 2019 and SQL Server Management Studio (SSMS). Download Sitecore 10 Graphical setup package for XP Single. Extract the content of the zip and initiate the setup. On the Welcome screen, click Start to begin the setup. Install the pre-requisites. This should install SIF and Windows Server prerequisites including IIS and other modules. Once prerequisites are installed successfully, you may have to restart the machine. Install Solr search service. Sitecore 10 needs SOLR 8.4 After SOLR is installed enter the Sitecore settings i.e. admin password and provide a license file. Provide the SQL server settings i.e. SQL server name, admin username, and password. Provide the SOLR details – service URL, root path the cores should be created and SOLR service name. Optionally select Sitecore modules (SXA). That’s it, SIA takes care of everything to successfully install Sitecore 10 on a dev machine Refer to this article to know more about the installation steps. https://assurex.co/quick-tips/10-steps-to-install-sitecore-10-using-sia/
Can I install sitecore10 without installing container with it? I don't need to use docker in my local training env. Is it possible to not install containers when installing Sitecore 10 or is it mandatory?
That's expected behavior. In your scenario, you have an item which does not have any version in final workflow state so it's being removed from web database while publishing. When you start editing an item which is already published, a new version of that item should be created. Then if you execute publish and new version is not ready yet, it will keep existing version of that item published in web database. You can still edit new version and finally when it's ready and processed to the final workflow state, it will be published to the web database. And if any further changes are necessary, you create new draft version of that item again.
PublishManager.PublishSmart Deletes an existing item from web db I am using PublishManager.PublishSmart to auto publish items from master db to web db. New items which are in final workflow state are getting published as expected but for the existing items if I make the changes and reset the workflow state other than final, after auto publish runs this existing item gets deleted from web db. Here is my code Database master = Database.GetDatabase(&quot;master&quot;); Database targetDB = Factory.GetDatabase(&quot;web&quot;); // passing the rootItemID GUID here var rootItem = master.GetItem(new ID(rootItemID)); Database[] targets = new Database[1] { targetDB }; Language[] array = rootItem.Languages; PublishManager.PublishSmart(rootItem.Database, targets, array);
That's not possible with Restful Api for ItemService. The only method that allows create items there is Create Item (read https://doc.sitecore.com/xp/en/developers/103/sitecore-experience-manager/the-restful-api-for-the-itemservice.html for more information). And that method accepts template ID. When it processes request, it only checks for template with that ID using database.GetTemplate(new ID(request.Template)) code and this code does not allow template branches. I guess you can create a Sitecore Support ticket asking them to extend the functionality, but that will be a feature request.
REST client API, item creation using branch template it's the same issue mentioned in: Create Item using REST API and Branch as template. Wanted to know if any solution was found for the issue mentioned in the above post. I am using version Sitecore 10.3 and API response returns the same issue Template is invalid/Bad request. API Response error attached. p.s. : Couldn't add a comment previous post, so posted a new question. I can add more details
Please check the following things: Ensure that tracking is enabled for the site definition that uses the pub database: <site name=&quot;pub&quot; content=&quot;pub&quot; ... enableTracking=&quot;true&quot; /> Note: if this attribute is omitted, it is set to true by default. Confirm that your test definition item is published to the pub database: Switch to the pub database Navigate to the folder /sitecore/system/Marketing Control Panel/Test Lab Find your test definition item in this folder, this is an example of how it should look: If you can't find it, switch back to the master database and publish the test definition item
AB Testing is not working on custom database but working on web database I have started AB Testing in Sitecore 10.0.1 and in local it is working fine, I am able to see 2 different content. On higher environment it is working on server with web database, but not working with pub database(our custom third database). Is there any config Sitecore has setup which works for web database only and dont work on custom database? If yes where it can be, any function we can override?
I encountered a similar problem while attempting to convert my Sitecore package to an SCWDP package. The issue appeared when running the command in Windows PowerShell 7. However, I found that running the same command in PowerShell 5.1 resolved the problem.
ConvertTo-SCModuleWebDeployPackage: The type initializer for 'DotNet.Basics.IO.SystemIoPath' threw an exception I am trying to convert the Publishing Service Module to a WDP, but I am receiving this error. I have searched and do not see a solution that applies to the Sitecore Azure Toolkit ConvertTo-SCModuleWebDeployPackage: The type initializer for 'DotNet.Basics.IO.SystemIoPath' threw an exception. My PowerShell (running PowerShell 7 in admin mode after loading both the module and dll is as follows. I have dacpac installed): ConvertTo-SCModuleWebDeployPackage -Path &quot;C:\Sitecore Azure Toolkit\SitecorePublishingModule1020rev00631.zip&quot; -Destination &quot;C:\Sitecore Azure Toolkit&quot; -force -verbose
The MVC model binder needs to create an instance of every object in the postback model in order to bind the form values to it. If the postback model contains a property of an interface type (instead of a concrete type) then the model binder won’t be able to create an instance of that property – because it won’t know which concrete type to create, hence the error. I agree with @Marek that you can the ItemId and retrieve/process information like this using Html.BeginRouteForm. View: @using (Html.BeginRouteForm(Sitecore.Mvc.Configuration.MvcSettings.SitecoreRouteName, FormMethod.Post)) { @Html.Sitecore().FormHandler(&quot;LoginController&quot;, &quot;Login&quot;) @Html.Hidden(&quot;itemId&quot;, @viewModel.Id.ToString()) } Controller: [HttpPost] public ActionResult Login(string itemId) { var Item = Sitecore.Context.Database.GetItem(new ID(itemId)); if (Item == null) { //// TODO: Put the code for the error handling } ////TODO: Perform your custom business logic here. return View(); } Hope it helps!
Unable to submit MVC form with Interface model type in Sitecore 9.3 Currently we're using view rendering for login form but as per new requirement we need to change to Controller rendering to perform some logic in backend during submission. This looks like as given below. We're using Glass mapper so given Sitecore field( Header,UsernameLabel,LoginLabel ) render the field value directly from Sitecore on form load. login.cshtml @model ILogin <form id=&quot;loginForm&quot; name=&quot;loginForm&quot; action=&quot;/someurl&quot; method=&quot;POST&quot;> <h2>@Html.Glass().Editable(m => m.Header)</h2> ... <label>@Html.Glass().Editable(m => m.UsernameLabel)</label> ... <button type=&quot;submit&quot;>@Html.Glass().Editable(m => m.LoginLabel)</button> </form> We created new Controller Rendering and Login GET and POST Action method in Controller GET public ActionResult Login() { var model = _mvcContext.SitecoreService.GetItem<ILogin>(_mvcContext.DataSourceItem); return View(&quot;~/public/Views/login.cshtml&quot;, model); } POST [HttpPost] public ActionResult Login(ILogin model) { } During GET operation,login form is loading properly but getting below error during submission: Cannot create an instance of an interface. Description: An unhandled exception occurred. Exception Details: System.MissingMethodException: Cannot create an instance of an interface. [MissingMethodException: Cannot create an instance of an interface. Object type 'Models.ILogin'.] System.Web.Mvc.DefaultModelBinder.CreateModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Type modelType) Then while searching online we found that create a new class and implement interface. That means in GET method we need to get data source item, fetch values from Sitecore, fill values in class properties and return new class model. In POST method, replace ILogin with new class. This seems alternate options but Is there any other way we can handle submission instead of adding new class?
You should run your code in the below code snippet for the specific user. Here is the code. Sitecore.Security.Accounts.User user = Sitecore.Security.Accounts.User.FromName(@&quot;extranet\Anonymous&quot;, true); using (new Sitecore.Security.Accounts.UserSwitcher(user)) { // Add your logic } Refer to this article for more code snippets. https://www.nehemiahj.com/2012/03/how-to-use-securitydisabler-and_15.html Hope this helps.
how can I run code on Sitecore on an event under a specific security account? The events handlers in Sitecore run under default\anonymous (i.e. onpublish:end:remote). Can I run the code under Extranet\anonymous account?
The issue was resolved by creating a validation class inheriting Sitecore.ExperienceForms.Mvc.Models.Validation.ValidationElement, where the re-captcha response from the client fetched using HttpContext.Current?.Request?.Form[&quot;g-recaptcha-response&quot;] is matched using google API mentioned here
Does Intercepting and manipulating the Google reCaptcha response on client side, can provide a false sense of security? I have integrated Google Recaptcha in Sitecore form (10.2 ). While doing a security audit, it was found that while submitting the form data, post request can be intercepted (via tools like Burp Suite), and the response value ( mentioned here) can be deleted from the request body and forwarded without any error, which gives the impression of false security. Thus while debugging the response results from a custom validation class, and from the submit button script on the client side, the Google captcha response was available even after deleting it from the request body using the tool. So, I want to understand, does the Interception of Google Recaptcha using tools like Burp Suite, actually affect the captcha response, if yes, what could be the possible ways to stop such vulnerability? Thanks in advance.
I had similar issue twice already. Both times it was related to cookies. First time it was an SXA site which included space character in it's name. As a result it used cookie called like sxa site name#lang and spaces in cookie name are not allowed ( https://curl.se/rfc/cookie_spec.html ) so it broke lot of functionality in Sitecore backend, starting from Forms, through Experience Analytics, Experience Profile and Marketing Automation. Second time it was custom Matomo tracking script added on CM servers as well. It again resulted in incorrect cookie values and again, Sitecore backend wasn't working properly. If forms do work for you in incognito mode, it may be related to cookies for you. Just open dev tools in your browser and try clearing suspected cookies.
No Forms displayed in Forms Dashboard in Sitecore 10.3 with The required anti-forgery cookie error I am using Sitecore 10.3. I have seen no Forms after I created some in Forms Dashboard in Forms Builder. I did rebuild of indexes after which they appeared but then they disappeared again. I suspect that it's due to missing language selector and also publishing targets: I can see these in network tab: { &quot;message&quot;: &quot;An error has occurred.&quot;, &quot;exceptionMessage&quot;: &quot;The required anti-forgery cookie \&quot;__RequestVerificationToken\&quot; is not present.&quot;, &quot;exceptionType&quot;: &quot;System.Web.Mvc.HttpAntiForgeryException&quot;, &quot;stackTrace&quot;: &quot; at System.Web.Helpers.AntiXsrf.TokenValidator.ValidateTokens(HttpContextBase httpContext, IIdentity identity, AntiForgeryToken sessionToken, AntiForgeryToken fieldToken)\r\n at System.Web.Helpers.AntiXsrf.AntiForgeryWorker.Validate(HttpContextBase httpContext, String cookieToken, String formToken)\r\n at Sitecore.Web.Http.Filters.ValidateHttpAntiForgeryTokenAttribute.OnAuthorization(HttpActionContext actionContext)&quot; } Same for languages request:
It is not expected that Solr cores were created during the installation for PaaS deployments as mentioned in the documentation: https://doc.sitecore.com/xp/en/developers/101/sitecore-experience-manager/walkthrough--deploying-a-new-sitecore-environment-to-the-microsoft-azure-app-service.html The Solr server is not provisioned by an ARM template, therefore after deploying to Azure, you must manually create a template and populate it with Solr cores. The linked document under &quot;populate it with Solr cores&quot; should have the necessary steps to complete the installation. However, the version of the article for Sitecore 10.2-10.3 doesn't contain this note, which is an issue in the documentation. I have already raised the issue with Sitecore support to correct the documentation. But, to answer your question, you need to manually create and populate the Solr cores.
Sitecore 10.3 (PaaS) - SOLR Core not created I have installed Sitecore 10.3 using Sitecore Experience Cloud (market place) on Azure PaaS. SOLR (SOLR version - 8.11.2) instance is available on Azure App Service. My Sitecore installation went well and can see that vanilla instance is working fine. Only Issue I can see is, I am not finding any SOLR core available. Even I am not finding any core in SOLR as well: I checked connectionString file as well and found that SOLR connectionString mentioned is correct and it is opening SOLR dashboard. Can someone guide what could be wrong here? Thanks in advance.
Yes, you can achieve that with OOTB functionality of Sitecore forms. Place second radio button inside a Section form element. On the section use conditional rendering to only show the section when first radio button has chosen value - you can combine &quot;yes&quot;/&quot;no&quot; options with or condition if you want:
Sitecore forms - display fields one after the other I have a sitecore form with 6 questions which are radio button options yes/no. If first question is answered, only then display 2nd question and then etc. Is there any way I can do this?
I had face same issue in past, you have to rebuild your master and web indexes, then form will start showing in form application. Hope this helps you.
Sitecore Forms not getting indexed Sitecore Forms are not showing in the Forms application from launchpad. I tried rebuilding my project forms folder from the developer menu but getting the below error the current item and its descendants can not be indexed. I have tried checking logs but I am not seeing any error in logs.
I faced the same issue. host.docker.internal is available on identity, solr, but is not available on cm, sql containers. You have a few options: You can use ngrok You can update your container manually by running this script: # host.docker.internal is not available on CM, so we need to add it manually $containerId = docker ps --filter ancestor=jss_astro-xm1-cm --format &quot;{{.ID}}&quot; $ip = Get-NetIPAddress | Where-Object -FilterScript {$_.IPAddress.StartsWith(&quot;192&quot;)} $ipAddress = $ip.IPAddress Write-Host &quot;Adding DNS record to container $containerId. Host: host.docker.internal. IP: $ipAddress&quot; $command = &quot;'$ipAddress host.docker.internal' | Out-File -Append -Encoding ASCII -FilePath '$($Env:windir)\system32\drivers\etc\hosts'&quot; docker exec -it $containerId powershell $command This script will add a record to the CM container hosts file. And point host.docker.internal to your host IP address. P.S. I expected that it should be fixed in Docker 4.19, according to release notes: &quot;Reverted to fully patching etc/hosts on Windows (includes host.docker.internal and gateway.docker.internal again). For WSL, this behavior is controlled by a new setting in the General tab. Fixes docker/for-win#13388 and docker/for-win#13398.&quot; But the issue is still there. And it requires deeper investigation: why does it work in the Identity container but fail on CM?
How to connect to an API on the host machine from the CM/CD on docker? Looking at https://docs.docker.com/desktop/networking/ it says I want to connect from a container to a service on the host The host has a changing IP address, or none if you have no network access. We recommend that you connect to the special DNS name host.docker.internal which resolves to the internal IP address used by the host. When I try this I get &quot;The remote name could not be resolved&quot;. I found this open issue which has a script to map the network gateway port to the host.docker.internal but this just results in &quot;Unable to connect to the remote server&quot;.
In order to increase the pace, we have divided the script into multiple scripts and ran all chunks/batchs in parallel. Now, we are able to achieve it in 3 hours.
migration to azure blob taking indefinite time We are enabling Azure Blob Storage in Sitecore 10.2 As a first step, we are migrating all available media to Azure Blob via PowerShell script. We tried this on lower environments for testing. However, it is taking so much time. Like 48 hours for 200000 (two hundred thousand) images. This is not acceptable as production will be having more than triple this number. Is there any better way to migrate the images from Sitecore to an Azure blob?
This error occurs when you try to make an encrypted connection to SQL Server using a non-verifiable certificate. Read more here Solution: There is a function call AddSqlUserToRole in DeployCommerceDatabase.psm1 at \SIF.Sitecore.Commerce.1.2.14\Modules\DeployCommerceDatabase\DeployCommerceDatabase.psm1 need to add -Encrypt Optional parameter. Save the file and reset the IIS the IISRESET then run Deploy-Sitecore-Commerce.ps1 Updated function: function AddSqlUserToRole { param ( [String]$dbServer=$(throw 'Parameter -dbServer is missing!'), [String]$dbName=$(throw 'Parameter -dbName is missing!'), [String]$userName=$(throw 'Parameter -userName is missing!'), [String]$role=$(throw 'Parameter -role is missing!') ) Write-Host &quot;Attempting to add the user $userName to database $dbName as role $role&quot; -ForegroundColor Green -NoNewline try { Invoke-Sqlcmd -ServerInstance $dbServer -Query &quot;IF NOT EXISTS (SELECT * FROM master.dbo.syslogins WHERE name = '$($userName)') BEGIN CREATE LOGIN [$($userName)] FROM WINDOWS WITH DEFAULT_DATABASE=[$($dbName)], DEFAULT_LANGUAGE=[us_english] END&quot; -Encrypt Optional Invoke-Sqlcmd -ServerInstance $dbServer -Query &quot;IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = '$($userName)') BEGIN USE [$($dbName)] CREATE USER [$($userName)] FOR LOGIN [$($userName)] END&quot; -Encrypt Optional Invoke-Sqlcmd -ServerInstance $dbServer -Query &quot;USE [$($dbName)] EXEC sp_addrolemember '$($role)', '$($userName)'&quot; -Encrypt Optional Write-Host &quot; Added&quot; -ForegroundColor DarkGreen } catch { Write-Host &quot;&quot; Write-Host &quot;Error: Unable to add user $userName`nDetails: $_&quot; -ForegroundColor Red } } If intreseted in more details: https://sitecorememories.wordpress.com/2023/06/28/sitecore-experience-commerce-9-unable-to-add-user-csfndruntimeuser/
Unable to add user CSFndRuntimeUser Setting up instance of Sitecore Experience Commerce 9.0 Update-2 in Windows 10 with SQL Server 2016 and SSMS 19. Error occurred while running Deploy-Sitecore-Commerce.ps1 adding roles to commerceservices databases... Attempting to add the user Domain\CSFndRuntimeUser to database SitecoreCommerce9_Global as role db_owner ********************** Command start time: 20230524160916 ********************** PS>TerminatingError(Invoke-Sqlcmd): &quot;The running command stopped because the preference variable &quot;ErrorActionPreference&quot; or common parameter is set to Stop: A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.)&quot; Error: Unable to add user Domain\CSFndRuntimeUser Details: A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.) Attempting to add the user Domain\CSFndRuntimeUser to database SitecoreCommerce9_SharedEnvironments as role db_owner ********************** Command start time: 20230524160916 ********************** PS>TerminatingError(Invoke-Sqlcmd): &quot;The running command stopped because the preference variable &quot;ErrorActionPreference&quot; or common parameter is set to Stop: A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.)&quot; Error: Unable to add user Domain\CSFndRuntimeUser Details: A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.) How to fix it? Thanks!
You just need to use url - https://sitecorecontenthubURL/api/status It will show a json format, search for product_version, it will tell you the Content Hub version.
How to check Content hub version? Is there any way to check the version of Sitecore Content Hub? It should be somewhere inside manage page but i couldn't find that.
A simple rule like that will do the trick: <rule name=&quot;subsite rule&quot; stopProcessing=&quot;true&quot;> <match url=&quot;^([a-z]{2}(\-[a-z]{2})?/)?subsite(/.*){0,1}$&quot; /> <action type=&quot;Redirect&quot; url=&quot;/{R:1}newsubsite/subsite2{R:3}&quot; appendQueryString=&quot;true&quot; /> </rule> Remember to recycle app pool after you edit your config - simple site restart related to config change is not enough usually. Match is for the urls starting (optionally with language code either 2 letters like en or 4 letters with hyphen like en-us), and then with subsite and then either nothing after it or urls starting with subsite/, e.g. https://mainsite.com/subsite https://mainsite.com/subsite/ https://mainsite.com/subsite/subfolder https://mainsite.com/subsite/sub/sub/sub https://mainsite.com/en/subsite https://mainsite.com/en-us/subsite/ https://mainsite.com/en-es/subsite/subfolder https://mainsite.com/en/subsite/sub/sub/sub Whatever comes after subsite will be added to resulting url after /newsubsite/subsite2. appendQueryString=&quot;true&quot; makes sure that if there is query string, it will be included in the new url as well.
Redirect old subsite url to new subsite url using URL redirect generic IIS Rewrite Rule in existing production we have URL structure as follows https://mainsite.com/subsite Now the sub site URL structure changed as follows https://mainsite.com/newsubsite/subsite2 We want to redirect old sub site landing page and all the inner pages to redirect to new url structure I.e., when user browse https://mainsite.com/subsite it should redirect to https://mainsite.com/newsubsite/subsite2 And when user browse https://mainsite.com/subsite/innerpage it should redirect to https://mainsite.com/newsubsite/subsite2/innerpage The inner page name don't have any name changes. Just need to replace &quot;subsite&quot; with &quot;newsubsite/subsite2&quot; Edit: one more scenario need to handle. Some times language code e.g.: &quot;en&quot; will come in the URL as like below https://mainsite.com/en/subsite In this case it need to redirect to https://mainsite.com/en/newsubsite/subsite2 Same for inner pages as well Any body help me to create a generic rewrite rule to do this job.
We can achieve this in one way. Go to \src\RouteHandler.js here sitecore.context will be available. Change the line like below, (This will pass context object to layout) // Original line return <Layout route={layoutData.route} />; // Change this line return <Layout route={layoutData.route} sitecoreContext={this.props.sitecoreContext} />; Goto \src\Layout.js, change the line below // Original line const Layout = ({ route }) => { // Change this line const Layout = ({ sitecoreContext, route }) => { We can access the sitecoreContext object now.
Access layout service response sitecore.context object in Layout.JS file In JSS react how to access the layout service response object sitecore.context in src/Layout.js. If you look at src/Layout.js file, In default we can access only sitecore.route fields but not sitecore.context.
Finally, I found the solution which is mentioned here; https://support.sitecore.com/kb?id=kb_article_view&amp;sysparm_article=KB1002853 Basically, for the newly created app, one more config needs to be added which is serverSideRenderingEngineEditOnly=&quot;false&quot; and done. Check the showconfig.aspx for the above key.
Issue on Submit Action for Sitecore Forms in NextJS app I'm trying to implement Sitecore Forms with the NextJS app using this official document https://doc.sitecore.com/xp/en/developers/hd/211/sitecore-headless-development/implement-a-sitecore-form-in-a-jss-next-js-app.html Since I'm using next js I'm passing sitecoreApiHost={''} as mentioned in the document. I have also followed this document to create Sitecore Form, created rendering, and added the same on the sample page; https://doc.sitecore.com/xp/en/developers/hd/211/sitecore-headless-development/walkthrough--using-a-sitecore-form-in-jss-applications.html To simplify I have just added a redirect to the page as an action on Submit button with a couple of input boxes. When the new rendering is added to the page for forms and after publishing I'm getting the following error; 'Unexpected token '<', &quot;<!DOCTYPE &quot;... is not valid JSON' Appreciate any help on this topic, thank you.
I figured it out. Below is the code snippet for refreshing the renditions through Javascript SDK. // Create the JavaScript SDK client const client = new ContentHubClient(endpoint, oauth); var isAuthenticate = await client.internalClient.authenticateAsync(); console.log(isAuthenticate); var jobEntity = null; jobEntity = await client.entityFactory.createAsync(&quot;M.Job&quot;); jobEntity.setPropertyValue(&quot;Job.Type&quot;, &quot;MassEdit&quot;); jobEntity.setPropertyValue(&quot;Job.State&quot;, &quot;Created&quot;); jobEntity.setPropertyValue(&quot;Job.Condition&quot;, &quot;Pending&quot;); jobEntity.setPropertyValue(&quot;Job.TargetCount&quot;, 0); jobEntity.setPropertyValue(&quot;Job.TargetsCompleted&quot;, 0); var jobId = await client.entities.saveAsync(jobEntity); var descriptionEntity = await client.entityFactory.createAsync( &quot;M.JobDescription&quot; ); var jobConfiguration = { $type: &quot;Stylelabs.M.Base.MassEdit.MassEditJobDescription, Stylelabs.M.Base&quot;, Operations: [ { $type: &quot;Stylelabs.M.Base.MassEdit.RefreshRenditionsOperation, Stylelabs.M.Base&quot;, Renditions: [], FailedOnly: true, RefreshHistory: false, RefreshSubfiles: false, }, ], FinalizeOperations: [], Targets: [assetId], }; console.log(jobConfiguration); console.log(JSON.stringify(jobConfiguration)); descriptionEntity.setPropertyValue(&quot;Job.Configuration&quot;, jobConfiguration); var jobRel = descriptionEntity.getRelation( &quot;JobToJobDescription&quot;, RelationRole.Child ); if (jobRel != null) { jobRel.setIds([jobId]); var descriptionId = await client.entities.saveAsync(descriptionEntity); console.log(descriptionId); var loadConfig = new EntityLoadConfiguration(); loadConfig.propertyLoadOption = new PropertyLoadOption([ &quot;Job.State&quot;, &quot;Job.TargetCount&quot;, ]); loadConfig.relationLoadOption = RelationLoadOption.None; loadConfig.cultureLoadOption = CultureLoadOption.Default; jobEntity = await client.entities.getAsync(jobId, loadConfig); if (jobEntity != null) { console.log(jobEntity); jobEntity.setPropertyValue(&quot;Job.State&quot;, &quot;Pending&quot;); jobEntity.setPropertyValue(&quot;Job.TargetCount&quot;, 1); await client.entities.saveAsync(jobEntity); } }
Refresh renditions using Javascript SDK in Content Hub Is there any way we can refresh renditions using Javascript SDK? I know we can do this with triggers and action scripts or using Web client SDK but I need to do this with Javascript SDK.
JssImport service is unable to create/update an item under Content item. So this is the permission problem. You can use 2 approaches here. Provide access to user sitecore\JssImport to Sitecore\Content and its descendant items as Go to the User Manager and find the User JssImport and make it Administrator. Hope it helps!
Sitecore JSS update content item I have created a hello world JSS application with Angular + Rest application. I have deployed the application to my local sitecore 10.3. Later, i have created a new component and i am able to add the component in the page and then i tried to deploy the application to sitecore with the command &quot;jss deploy app -c -d&quot;, I got the below warning while importing item is happening. &quot;Skipping data update of /sitecore/content/jss-app-demo/home because item already exists and is not writable by import user.&quot; Also, i have noticed that the new component has been included in the config file &quot;\sitecore\manifest\sitecore-import.json&quot;. Is this something related to the permission? or how to update the item (adding new component) which is already in sitecore? If this is related to permission how/where to provide the permission? Any suggestions are helpful.
We had similar scenario and in our case the solution was to wrap the field content in @{ var requiredClass = &quot;&quot;; if(Model.Required){ requiredClass = &quot;required-field&quot;; } } <div class=&quot;form-group @Model.CssClassSettings.CssClass @requiredClass&quot;> YOUR CSHTML HERE </div> so in your case it should be something like: @{ var requiredClass = &quot;&quot;; if(Model.Required){ requiredClass = &quot;required-field&quot;; } var htmlAttributes = new Dictionary<string, object>() { { &quot;class&quot;, &quot;form-control&quot; } }; } <div class=&quot;form-group @Model.CssClassSettings.CssClass @requiredClass&quot;> <label for=&quot;@Html.IdFor(m => Model.Value)&quot; class=&quot;@Model.LabelCssClass&quot;>@Html.DisplayTextFor(t => Model.Title)</label> <input type=&quot;date&quot; style=&quot;display:none;&quot; id=&quot;@Html.IdFor(m => Model.Value)&quot; @if (Model.Min.HasValue) { <text> min=&quot;@Model.Min.Value.ToString(Model.DateFormat)&quot; </text> } @if (Model.Max.HasValue) { <text> max=&quot;@Model.Max.Value.ToString(Model.DateFormat)&quot; </text> } @if (Model.Value.HasValue) { <text> value=&quot;@Model.Value.Value.ToString(Model.DateFormat)&quot; </text> } name=&quot;@Html.NameFor(m => Model.Value)&quot; class=&quot;wfmDatebox @Model.CssClass&quot; data-sc-tracking=&quot;@Model.IsTrackingEnabled&quot; data-sc-field-name=&quot;@Model.Name&quot; data-sc-field-key=&quot;@Model.ConditionSettings.FieldKey&quot; @Html.GenerateUnobtrusiveValidationAttributes(m => Model.Value) /> <div class=&quot;row&quot;> <div class=&quot;col-xs-4 col-sm-4 col-md-4 col-lg-4&quot;> <div class=&quot;input-group&quot; style=&quot;width:100%&quot;> <div class=&quot;input-group-addon&quot;>@Model.DayTitle</div> @Html.DropDownListFor(x => x.Day, Model.Days, htmlAttributes) </div> </div> <div class=&quot;col-xs-4 col-sm-4 col-md-4 col-lg-4&quot;> <div class=&quot;input-group&quot; style=&quot;width:100%&quot;> <div class=&quot;input-group-addon&quot;>@Model.MonthTitle</div> @Html.DropDownListFor(x => x.Month, Model.Months, htmlAttributes) </div> </div> <div class=&quot;col-xs-4 col-sm-4 col-md-4 col-lg-4&quot;> <div class=&quot;input-group&quot; style=&quot;width:100%&quot;> <div class=&quot;input-group-addon&quot;>@Model.YearTitle</div> @Html.DropDownListFor(x => x.Year, Model.Years, htmlAttributes) </div> </div> </div> @Html.ValidationMessageFor(m => Model.Value) </div>
Sitecore Custom form element does not follow bootstrap div "form-group" structure We have created a new date picker field with dropdown options for Month, Year and Day by following the article Sitecore Guide The field data is being saved properly, but we are facing the below issues When set to mandatory, the field validation does not work. All the out of the box elements are wrapped with &quot;&quot; and &quot;required field&quot; if marked as mandatory. But the custom element renders with out the div and we are unable to figure out where to set that up. Attached the screenshot, where the OOTB elements are rendered within div form-group class and custom element elements are not. Could you help in understanding how the bootstrap div structure is generated for the forms and other elements and how can the same be done for the custom fields ? Here is the sample code for the field cshtml @using Sitecore.ExperienceForms.Mvc.Html @model DatePickerViewModel @{var htmlAttributes = new Dictionary<string, object>() { { &quot;class&quot;, &quot;form-control&quot; } }; } <label for=&quot;@Html.IdFor(m => Model.Value)&quot; class=&quot;@Model.LabelCssClass&quot;>@Html.DisplayTextFor(t => Model.Title)</label> <input type=&quot;date&quot; style=&quot;display:none;&quot; id=&quot;@Html.IdFor(m => Model.Value)&quot; @if (Model.Min.HasValue) { <text> min=&quot;@Model.Min.Value.ToString(Model.DateFormat)&quot; </text> } @if (Model.Max.HasValue) { <text> max=&quot;@Model.Max.Value.ToString(Model.DateFormat)&quot; </text> } @if (Model.Value.HasValue) { <text> value=&quot;@Model.Value.Value.ToString(Model.DateFormat)&quot; </text> } name=&quot;@Html.NameFor(m => Model.Value)&quot; class=&quot;wfmDatebox @Model.CssClass&quot; data-sc-tracking=&quot;@Model.IsTrackingEnabled&quot; data-sc-field-name=&quot;@Model.Name&quot; data-sc-field-key=&quot;@Model.ConditionSettings.FieldKey&quot; @Html.GenerateUnobtrusiveValidationAttributes(m => Model.Value) /> <div class=&quot;row&quot;> <div class=&quot;col-xs-4 col-sm-4 col-md-4 col-lg-4&quot;> <div class=&quot;input-group&quot; style=&quot;width:100%&quot;> <div class=&quot;input-group-addon&quot;>@Model.DayTitle</div> @Html.DropDownListFor(x => x.Day, Model.Days, htmlAttributes) </div> </div> <div class=&quot;col-xs-4 col-sm-4 col-md-4 col-lg-4&quot;> <div class=&quot;input-group&quot; style=&quot;width:100%&quot;> <div class=&quot;input-group-addon&quot;>@Model.MonthTitle</div> @Html.DropDownListFor(x => x.Month, Model.Months, htmlAttributes) </div> </div> <div class=&quot;col-xs-4 col-sm-4 col-md-4 col-lg-4&quot;> <div class=&quot;input-group&quot; style=&quot;width:100%&quot;> <div class=&quot;input-group-addon&quot;>@Model.YearTitle</div> @Html.DropDownListFor(x => x.Year, Model.Years, htmlAttributes) </div> </div> </div> @Html.ValidationMessageFor(m => Model.Value) Thanks in Advance.
It looks like during the migration item has been created but not attached. You can re-attach them from downloading from your other instance and try with the following steps. Download the file from another working instance by clicking the Download link on the media item. Go to the new Sitecore instance in the Media Library, locate the existing media file you want to replace, and click on it. Under the Media section, Click Attach and you will be prompted to browse your computer for the new file. Once you locate the file, click on it then choose Open and click on the Attach button. The page will refresh and you’ll see the new file you attached. Save your changes and publish them. Hope it helps!
Azure blob migration issue: no media attachment in themes items Recently, we did Azure blob migration. Installed package Ran scripts Now media items are linked to an azure blob. Images are coming on the website on CM and CD. However, no themes are loading on the site. While looking into the items under the themes folder, I found that no media attachment is visible there. (see the screenshot) and in raw value, [Blob Value] is coming. (see the screenshot) Could you please assist?
I created a sitecore ticket for that and they suggested me to use username instead of email id. The system should then be able to fetch the email from the user's profiles, it worked and it sent email to only that particular user. But if you add any wrong username which doesn't exist in content hub or add email id which is not a user name then it sent that email to all the users created in my content hub instance. Sitecore accepted this as a known issue and that has been fixed in Content Hub 4.2.2. The reference is MONE-32071: https://doc.sitecore.com/ch/en/users/42/content-hub/release-notes--04-02-02--resolved-issues.html To workaround the issue you could: Make sure that at least one usernames in the recipient list is valid Upgrade to the latest Content Hub release Update-1 If you want to know more about how to send email notifications in Content Hub please follow my below blog post. https://logicalmindscom.wordpress.com/2023/06/19/sending-email-notifications-in-sitecore-content-hub/
Issue in sending emails with Content Hub OOTB Email Template Anyone tried sending emails using Content Hub OOTB Email Template through action scripts? It is behaving very strange to me, If I add my personal email in recipient list, it is sending an email to me but it is also sending that email to all the users created in my content hub instance. Is it expected behavior? Content Hub version : 4.0
Go to the Azure portal and log in. Then go to Azure Active Directory -> App registrations. Next click on the New registration button. Fill name, supported account type, and redirect URI and click on register button. Now go to the Manifest tab and update groupMembershipClaims value to SecurityGroup. Go to the Authentication tab and check the ID tokens checkbox. Go to the Groups inside Azure Active Directory, and create a new group if you don't have already one. Make sure you have added members to Demo_Admin group. Finally, go to the Overview tab and save the client Id and tenant Id which are going to be used in the Sitecore config later. Sitecore Identity Server Configuration Open inetpub\wwwroot\identityserverwebsite\sitecore\Sitecore.Plugin.IdentityProvider.AzureAd\Config\Sitecore.Plugin.IdentityProvider.AzureAd.xml and update ClientId and TenantId which was saved in previous step. Restart the Sitecore Identity Application and go to Sitecore Content Management to log in, now Azure AD button will be visible. Uncomment the below line from Sitecore.Plugin.IdentityProvider.AzureAd.xml and Copy the group id from Demo_Admin group and paste it. This I have done only for one group but it can be for multiple groups in a similar manner. Sitecore Configuration Create patch file in code, Now restart your identity website and go to content management URL and click on Azure AD. <configuration xmlns:patch=&quot;http://www.sitecore.net/xmlconfig/&quot; xmlns:role=&quot;http://www.sitecore.net/xmlconfig/role/&quot; xmlns:set=&quot;http://www.sitecore.net/xmlconfig/set/&quot;> <sitecore role:require=&quot;Standalone or ContentManagement&quot;> <federatedAuthentication> <identityProviders> <identityProvider id=&quot;SitecoreIdentityServer/IdS4-AzureAd&quot; type=&quot;Sitecore.Owin.Authentication.Configuration.DefaultIdentityProvider, Sitecore.Owin.Authentication&quot;> <param desc=&quot;name&quot;>$(id)</param> <param desc=&quot;domainManager&quot; type=&quot;Sitecore.Abstractions.BaseDomainManager&quot; resolve=&quot;true&quot; /> <caption>Log in with Sitecore Identity: Azure AD</caption> <icon>/sitecore/shell/themes/standard/Images/24x24/msazure.png</icon> <domain>sitecore</domain> </identityProvider> </identityProviders> <propertyInitializer> <maps> <map name=&quot;set Email&quot; type=&quot;Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication&quot; resolve=&quot;true&quot;> <data hint=&quot;raw:AddData&quot;> <source name=&quot;email&quot; /> <target name=&quot;Email&quot; /> </data> </map> <map name=&quot;set FullName&quot; type=&quot;Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication&quot; resolve=&quot;true&quot;> <data hint=&quot;raw:AddData&quot;> <source name=&quot;name&quot; /> <target name=&quot;FullName&quot; /> </data> </map> </maps> </propertyInitializer> </federatedAuthentication> </sitecore> </configuration> More detail you can check here https://swatiguptablogs.blogspot.com/2022/10/azure-ad-integration-with-sitecore-102.html
Sitecore Azure AD Integration I am trying with Azure AD integration in my Sitecore 10.2 XM. I am not able to find the official documents in the sitecore documentation. But i have followed the following blogs for this and it looks straight forward. But i am facing some difficulties in my case. https://sitecorewithraman.wordpress.com/2021/01/01/sitecore-cms-azure-ad-integration/ https://nabeelafsar.medium.com/a-simple-guide-to-setting-up-sso-with-azure-ad-using-sitecore-7269b2d6d138 https://sitecore.derekc.net/setting-up-azure-active-directory-integration-with-sitecore-identity-server-sitecore-9-1/ I have done the following for this Created new app registration in Azure, After creation of app, go to authentication section and check the &quot;ID tokens&quot; checkbox Updated the maniffest &quot;groupMembershipClaims&quot; as &quot;SecurityGroup&quot; Updated the following parameters in the file Sitecore.Plugin.IdentityProvider.AzureAd.xml ClientId TenantID true Enabled the node &quot;AzureADUserToAdminUser&quot; and updated the newly created AD Group object ID and ensured that group has my id. Logged into Sitecore, got the option &quot;Azure AD&quot; under the default login. when i click it redirected and i am able to login successfully with my AD credentials and getting the following error now. am i missing anything else? I am getting the following line item from the IDS log file. what i have done is, Sitecore is in my local. AD details are my organization details and created the necessary app, group in my organization AD. Does this related to the permission issue between my local and organization AD? 2023-06-05T18:33:52.2891267-04:00 [INF] (Sitecore Identity/My Machine Name Here) Request origin &quot;https://login.microsoftonline.com&quot; does not have permission to access the resource.
To achieve this functionality I created a custom page view event for interactions and below are the steps: Create a Custom Facet Model Create a class CustomPageViewEvent. I have given DefaultFacetKey as &quot; CustomPageViewEvent&quot; and EventDefinitionId id you can give either the existing or create new event. I have added a new field like the Number field. [Serializable] [FacetKey(DefaultFacetKey)] public class CustomPageViewEvent : Event { public CustomPageViewEvent(DateTime timestamp, Guid itemId, int itemVersion, string itemLanguage, string dataKey, string data, string number) : base(EventDefinitionId, timestamp) { this.ItemId = itemId; this.ItemVersion = itemVersion; this.ItemLanguage = itemLanguage; this.DataKey = dataKey; this.Data = data; this.Number = number; } public const string DefaultFacetKey = &quot;CustomPageViewEvent&quot;; public static Guid EventDefinitionId { get; } = new Guid(&quot;CD52B756-21B4-4028-8BA5-E981B8A96F95&quot;); public string ItemLanguage { get; set; } public int ItemVersion { get; set; } public string Url { get; set; } public string Number { get; set; } } Register the Custom Facet Model Create a CustomPageViewEventModel class to register your custom facet model. public static class CustomPageViewEventModel { public static XdbModel Model { get; } = BuildModel(); private static XdbModel BuildModel() { var modelBuilder = new XdbModelBuilder(&quot;CustomPageViewEventModel&quot;, new XdbModelVersion(1, 0)); modelBuilder.DefineEventType<CustomPageViewEvent>(true); return modelBuilder.BuildModel(); } } Deploy custom Facet model to XDB In the console application, generate a JSON file of your model and paste it to the below two locations: \App_data\Models \App_data\jobs\continuous\IndexWorker\App_data\Models class Program { static void Main(string[] args) { var serlizableModel = XdbModelWriter.Serialize(CustomPageViewEventCollectionModel.Model); File.WriteAllText(CustomPageViewEventCollectionModel.Model.FullName + &quot;.json&quot;, serlizableModel); } } Add Custom Facet Model to Configuration Now create a patch file and paste the below code: <?xml version=&quot;1.0&quot;?> <configuration xmlns:patch=&quot;http://www.sitecore.net/xmlconfig/&quot; xmlns:set=&quot;http://www.sitecore.net/xmlconfig/set/&quot;> <sitecore> <xconnect> <runtime type=&quot;Sitecore.XConnect.Client.Configuration.RuntimeModelConfiguration,Sitecore.XConnect.Client.Configuration&quot;> <schemas hint=&quot;list:AddModelConfiguration&quot;> <schema name=&quot;customageviewomodel&quot; type=&quot;Sitecore.XConnect.Client.Configuration.StaticModelConfiguration,Sitecore.XConnect.Client.Configuration&quot; patch:after=&quot;schema[@name='collectionmodel']&quot;> <param desc=&quot;modeltype&quot;>Website.CustomPageViewEventModel, Website</param> </schema> </schemas> </runtime> </xconnect> </sitecore> </configuration> Create a Custom Event Create a new class ConvertPageEventDataToCustomPageViewEvent and override ConvertPageEventDataToEventBase class. public class ConvertPageEventDataToCustomPageViewEvent : ConvertPageEventDataToEventBase { protected override bool CanProcessPageEventData(Sitecore.Analytics.Model.PageEventData pageEventData) { if (pageEventData.PageEventDefinitionId == Guid.Parse(&quot;{CD52B756-21B4-4028-8BA5-E981B8A96F95}&quot;)) { return true; } return false; } protected override Event CreateEvent(Sitecore.Analytics.Model.PageEventData pageEventData) { var number = pageEventData.CustomValues[&quot;Number&quot;]?.ToString(); CustomPageViewEvent ev = new CustomPageViewEvent(pageEventData.DateTime, pageEventData.ItemId, 1, &quot;en&quot;, pageEventData.DataKey, pageEventData.Data, number); return ev; } } Create a Patch File <?xml version=&quot;1.0&quot;?> <configuration xmlns:patch=&quot;http://www.sitecore.net/xmlconfig/&quot; xmlns:role=&quot;http://www.sitecore.net/xmlconfig/role/&quot; xmlns:env=&quot;http://www.sitecore.net/xmlconfig/env/&quot; xmlns:set=&quot;http://www.sitecore.net/xmlconfig/set/&quot;> <sitecore> <pipelines> <convertToXConnectEvent> <processor patch:after=&quot;processor[@type='Sitecore.Analytics.XConnect.DataAccess.Pipelines.ConvertToXConnectEventPipeline.ConvertPageEventDataToGoal, Sitecore.Analytics.XConnect']&quot; type=&quot;Website.ConvertPageEventDataToCustomPageViewEvent, Website&quot;/> </convertToXConnectEvent> </pipelines> </sitecore> </configuration> Register Event Now you can register your event wherever you want and you can pass CustomValues as I pass Number. var ev = Tracker.MarketingDefinitions.PageEvents[new Guid(&quot;{CD52B756-21B4-4028-8BA5-E981B8A96F95}&quot;)]; if (ev != null &amp;&amp; !string.IsNullOrEmpty(model.Number)) { var pageData = new Sitecore.Analytics.Data.PageEventData(ev.Alias, ev.Id); pageData.CustomValues.Add(&quot;Number&quot;, model.Number); Tracker.Current.CurrentPage.Register(pageData); } Now once you hit the page or click any button where you have registered for this event, it will store in the Interactions table in the Events field just like below: { &quot;@odata.type&quot;: &quot;#Website.CustomPageViewEvent&quot;, &quot;CustomValues&quot;: [], &quot;DefinitionId&quot;: &quot;cd52b756-21b4-4028-8ba5-e981b8a96f95&quot;, &quot;ItemId&quot;: &quot;2a00b93f-dab9-4536-b1d2-8ee3e832c7da&quot;, &quot;Id&quot;: &quot;a7816c4f-b7b5-4fac-aca2-08ac17b26cc4&quot;, &quot;ParentEventId&quot;: &quot;c6b1b479-8378-4311-b4b2-4231937399cc&quot;, &quot;Timestamp&quot;: &quot;2023-06-08T13:38:04.9040878Z&quot;, &quot;ItemLanguage&quot;: &quot;en&quot;, &quot;ItemVersion&quot;: 1, &quot;Number&quot;: &quot;6OEVv0sFCjZ0OASiQcpvuDYg18o9lH94CQOWgmyGkeahLxXzlfckSwMXrT999tr4zrHN3a9r91BUFNEnQpQ2&quot;, }
Capture Interactions with Correct StartDateTime and EndDateTime I have one requirement where when users interact with the page I need to make interaction with some custom facets, start and end times. Suppose the user was on the home page for 5 mins then StartDateTime will have the start time when the user land on a page and on EndDateTime will be the time when the user redirect to another page (+5 mins from StartDateTime in my scenario). I have added interactions with custom facets on InteractionFacets table as mentioned here now I am not sure how EndDateTime will calculate because in Database when I check Interactions table StartDateTime and EndDateTime have few seconds different.
Based on the discussions in the comments, it seems the reason for the bad gateway error is an incorrect version of System.Security.Cryptography.Xml. Sitecore versions 9.3-10.3 all ship with File Version: 4.6.26515.6 If you take a healthy sitecore instance and copy in the latest version of the System.Security.Cryptography.Xml DLL into the bin folder, you will get the following error: 26112 07:53:47 ERROR Unhandled exception detected. The ASP.NET worker process will be terminated. Exception: System.IO.FileNotFoundException Message: Could not load file or assembly 'System.Security.Cryptography.Xml, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. Source: Sitecore.Nexus.Licensing This is stipulating that the assembly has been found, but is not the correct version. Note: Version: 4.0.1.0 relates to File Version: 4.6.26515.6 You will also see the error is showing &quot;The ASP.NET worker process will be terminated&quot;. Which explains why there is nothing to map through to in Docker Desktop. You mention in your comments that there are: No customizations as these are the default Sitecore images Yet, you also say: Our solution layers on top of it By layering your solution over the top of the Sitecore images, you are in turn creating a custom image. Due to the fact that Sitecore ships with version 4.6.26515.6 and you have identified version 7.0.22.51805 in the deployed code, therefore your solution must be layering the new DLL over the top. Please review your solutions nuget packages and make sure that all references point to the same version 4.6.26515.6.
Docker Desktop Bad Gateway (502) I am running Sitecore 10.2 XM in Docker Desktop. It has no issues loading the site in a browser on my laptop but throws a bad gateway error in a VM that has nested virtualization. It used to run fine in the VM until a Docker Desktop upgrade I believe. I do not see any errors on docker compose up as all the Containers create. When I try to access my site at cm.mysite.localhost it gives an all blank page with &quot;Bad Gateway&quot; in text. Of note: Windows Firewall is not enabled I am using WSL2 with Docker Compose V2 and tested with a Hyper-V backend and receive the same error The VM has 4 Cores and 16GB of RAM with a 24GB Swap file Host file entries added by Docker Desktop are as follows: 10.23.124.5 host.docker.internal 10.23.124.5 gateway.docker.internal # To allow the same kube context to work on the host and the container: 127.0.0.1 kubernetes.docker.internal
I was able to find out the answer. I created a new template for redirects that were declared as navigable, then created a new item with the new redirect template.
How do I add an external URL to my site's navigation menu? I am new to Sitecore and I am trying to figure out how to add an external URL link to the site's navigation menu. The URL in question is supposed to link to the business's YouTube channel. I've created a redirect object (under /sitecore/templates/Feature/Experience Accelerator/Redirects/Redirect) with the URL I need, but it does not appear on the dropdown menu or sitemap. How can I make the external link appear on the menu?
After taking a look at Sitecore query documentation I found that https://doc.sitecore.com/xp/en/SdnArchive/SDN5/Reference/Using%20Sitecore%20Query/Sitecore%20Query%20Syntax.html So in the end my query was like that /sitecore/content/Home/Articles//*[@@templatename = 'PromotionContent']/.. This is what I wanted, by doing this I can get all Items that have at least a PromotionContent as a child.
How to filter items that have at least one child with an specific template using Sitecore query It's easier to explain what I'm trying to do with an image, so let's go! I need a query to get all parent items that have at least one Promotion Content as a child. The same for the contrary, I need to get all parent items that do not have promotion content as a child. Here is how my query is currently. /sitecore/content/Home/Articles//*[@@templatename = 'Article' and @__Never publish = ''] I have no idea how I can filter parent items based on their children's templates using Sitecore queries. I know we can do this in many ways using PowerShell scripts but my intention here is to figure out whether it's possible to filter like this using only Sitecore queries.
So, actually, it is enough to inherit your implementation from Sitecore.Shell.Applications.Dialogs.GeneralLink.GeneralLinkForm,Sitecore.Client and override with your implementation protected override void OnOK(object sender, EventArgs args) Then you can update GeneralLink.xml file with: <CodeBeside Type=&quot;MyAssembly.MyImplementation,MyAssembly&quot;/> Or you can copy the updated GeneralLink.xml file under \sitecore\shell\Override\Applications\Dialogs\GeneralLink to follow best practices. OnOK contains logic that processes link targets, so it is enough to fetch mentioned implementation using the decompiler tool and modify the code that will take into account your link target.
How to add new target to Internal Link in Sitecore Experience Editor We are required to bring a custom target attribute in sitecore general link field called “Preview” <a href=”xxx” target=”preview”>XXX</a> We added a new item in Sitecore Core Database called “Preview” under /sitecore/client/Applications/Dialogs/InsertLinkViaTreeDialog/PageSettings/Targets We are able to see the changes in Content Editor and the URL is reflected in the front end as expected. But when we looked at Experience Editor, we did not see the new custom target populated on the target dropdown. On investigation, we found that the dropdowns are coming from the GeneralLink.xml file present in root/sitecore/shell/Override/Applications/Dialogs/GeneralLink So we added it manually in the file post then it reflected in Experience Editor Dropdown. But when I select “Preview” and give OK it is not saving as preview and it saving as “Active Browser” instead. How to ensure that we get the new target Preview when used from Experience Editor, Rich Text Editor ??
Here is the official documentation given by Sitecore where you can find the examples to iterate through the archive items. Hope this document link will work for others to get multiple examples of PowerShell scripts. Here is the link. https://doc.sitecorepowershell.com/code-snippets You will find lots of code snippets and the code you are looking for is under the Restore Recycle bin items section. That is used to restore the items. But in your case you want to delete those items then you can modify your code a little bit. [datetime]$archivedDate = [datetime]::Today.AddDays(-365) #Add the days foreach($archive in Get-Archive -Name &quot;recyclebin&quot;) { $entries = $archive.GetEntries(0, $archive.GetEntryCount()) foreach($entry in $entries) { if($entry.ArchiveLocalDate -ge $archivedDate) { $archive.RemoveEntries($entry.ArchivalId) } } } Hope this helps.
Powershell - Remove recycle bin items older than 1 year Running version Sitecore 9.3 - and the latest version of the Powershell package The Powershell documentation has an example of deleting an individual item. $database = Get-Database -Name &quot;master&quot; $archiveName = &quot;recyclebin&quot; $archive = Get-Archive -Database $database -Name $archiveName Remove-ArchiveItem -Archive $archive -ItemId &quot;{1BB32980-66B4-4ADA-9170-10A9D3336613}&quot; Is it possible to have the Remove-archive item iterate through the whole list of archived items, but only delete items older than 1 year? *** Edit I managed to put a solution together prior to both of the Sumits who posted, but their solutions are cleaner. function GetRecycleBinItems { $database = Get-Database -Name &quot;master&quot; $archiveName = &quot;recyclebin&quot; $archive = Get-Archive -Database $database -Name $archiveName Get-ArchiveItem -Archive $archive } $limit = [datetime]::Now.AddDays(-365) $items = GetRecycleBinItems foreach($item in $items) { if ($item.ArchiveDate -lt $limit) { Remove-ArchiveItem -Archive $archive -ItemId $item.ItemId } }
You can do it with uiUpload processor: <configuration xmlns:patch=&quot;http://www.sitecore.net/xmlconfig/&quot;> <sitecore> <processors> <uiUpload> <processor mode=&quot;on&quot; type=&quot;{YourSolutionName.ProjectName.PublishMediaItem}, AssemblyNameSpace{YourSolutionName.ProjectName}&quot; patch:after=&quot;processor[@type='Sitecore.Pipelines.Upload.Done, Sitecore.Kernel']&quot; /> </uiUpload> </processors> </configuration> Your class will be: namespace YourSolutionName.ProjectName { public class PublishMediaItem: UploadProcessor { public void Process(UploadArgs args) { Assert.ArgumentNotNull(args, &quot;args&quot;); foreach (string index in args.Files) { HttpPostedFile file = args.Files[index]; if (!string.IsNullOrEmpty(file.FileName)) { //write your publish code here args.AbortPipeline(); break; } } } } }
Publish Media item as soon as uploaded I want to publish the Media item as soon as it is uploaded in the Media library. I was looking at different pipelines to resolve this but couldn't figure out which one is the ideal one to do so. As it is a media item item saved event is not triggered.
Checklist field does the whole rendering in backend code. You can find it in Sitecore.Shell.Applications.ContentEditor.Checklist class in the Sitecore.Kernel assembly. RenderOptions method goes through all the options and creates DataChecklistItem object for every option without any encoding. In order to fix it, you can create a class inheriting from original Sitecore Checklist class, override OnLoad method like below and fix encoding for every DataChecklistItem: namespace MyAssembly.MyNamespace { public class Checklist : Sitecore.Shell.Applications.ContentEditor.Checklist { protected override void OnLoad(System.EventArgs e) { base.OnLoad(e); if (!Sitecore.Context.ClientPage.IsEvent) FixEncoding(); } private void FixEncoding() { foreach (var control in Controls) { var dataChecklistItem = control as Sitecore.Shell.Applications.ContentEditor.DataChecklistItem; if (dataChecklistItem != null) { dataChecklistItem.Header = System.Web.HttpUtility.HtmlDecode(dataChecklistItem.Header); } } } } } Then you have to register your custom namespace where you added the class in config with your prefix, e.g. customized: <configuration> <sitecore> <controlSources> <source assembly=&quot;MyAssembly&quot; namespace=&quot;MyAssembly.MyNamespace&quot; prefix=&quot;customized&quot; mode=&quot;on&quot;/> </controlSources> </sitecore> </configuration> And finally you have to set that prefix on the field type /sitecore/system/Field types/List Types/Checklist in core database:
Checklist field not decoding option labels while other field types do On my 9.3 instance (with latest cumulative hotfix), I have 3 different field types, all of which have the same source: Multilist Droplink Checklist One of the selectable items has an HTML entity encoded display name, meaning that the raw value of the __Display name field is GST &amp;#40;Gulf Standard Time - GMT+04:00&amp;#41;. If you are curious about how I got into this scenario, see this post about display name field encoding changes. As you can see in the rendered fields below, droplink and multilist fields appear to decode this value prior to displaying, whereas the checklist does not. I know for a fact that the multilist and droplink fields have some type of JS running a decode on the labels because the raw HTML that is returned from the network call is encoded: This looks like a bug, and it's not clear what is performing this decoding. Any suggestions?
No, that's not possible out of the box. SolrContextFactory class, which is responsible for creating IProviderUpdateContect implementation object, checks if batch mode is enabled for indexing, by checking `Settings.GetBoolSetting(&quot;ContentSearch.Update.BatchModeEnabled&quot;)` If it's not enabled, it creates an object of SolrUpdateContext. And if it's enabled, it creates an object of SolrBatchUpdateContext class with batch size read from configuration - ContentSearch.Update.BatchSize. There is no place there for getting batch size for a single index, unless you create a new implementation of AbstractContextFactory and override GetUpdateContext method to return index-specific batch size.
Amend ContentSearch settings to a single index? I have a bunch of custom indexes and I need to finetune only 1 of them, not affecting the others. Let's say, I want to change ContentSearch.Update.BatchSize, is there a way to apply this setting for 1 particular index?
Yes, you're right. This settings is a general setting that is used by SolrBatchUpdateContext class. It's used both for partial updates and for full index rebuild. With that setting (and ContentSearch.Update.BatchModeEnabled setting set to true ) you can specify how big should be the batches of documents sent to Solr. <setting name=&quot;ContentSearch.Update.BatchModeEnabled&quot; value=&quot;true&quot; /> BatchModeEnabled is set to true by default and BatchSize has default value 100 (or in some version it's 50 if it's not filled in config).
Index rebuild batch sizing setting? I need to change the size of the batches during the index rebuild. The most suitable setting I've found is ContentSearch.Update.BatchSize with the description: The size of document batch before flushing to the database. Am I right that this setting is applicable not only for updating an index, but on rebuild, too?
Sitecore 10 doesn't support this. We had one asp.net application and one HTML site hosted as an Application within the Sitecore site. And in 9.1 these two applications were working fine with IgnoreUrlPrefixes settings. But after Sitecore 10 upgrade we found HTML application is working fine (we need to change the application to a Virtual directory) but asp.net application stops working. We had a discussion with Sitecore support also but no luck. So if you have a media extension with aspx, it is possible that Sitecore will not support that anymore.
Media with aspx extension is not working We have migrated to Sitecore 10.1 from Sitecore 8.7. In Sitecore 8, For-example, if the image location is /-/media/Project/Os-Theme/Styles/images/logo Then the following url returns the same image <site-url>/-/media/Project/Os-Theme/Styles/images/logo <site-url>/-/media/Project/Os-Theme/Styles/images/logo.ashx <site-url>/-/media/Project/Os-Theme/Styles/images/logo.jpg <site-url>/-/media/Project/Os-Theme/Styles/images/logo.aspx. I noticed that media item with .aspx is showing 404 error (The resource cannot be found) in Sitecore 10. Other extensions like ashx,jpg,png shows the correct media item. The following url shows the correct image in Sitecore 10 <site-url>/-/media/Project/Os-Theme/Styles/images/logo <site-url>/-/media/Project/Os-Theme/Styles/images/logo.ashx <site-url>/-/media/Project/Os-Theme/Styles/images/logo.jpg The aspx link doesn't work and shows 404 error. <site-url>/-/media/Project/Os-Theme/Styles/images/logo.aspx. Is there any setting to use aspx in the media item in Sitecore 10? Any suggestion would be appreciated. Thanks
Another approach is to add a CSS class to the html/body element when in experience editor mode: <body class=&quot;@(Sitecore.Context.PageMode.IsExperienceEditor ? &quot;experience-editor&quot; : string.Empty)&quot;> Then in your own CSS files, you can use a descendant selector so the styles only apply when this class is present: .experience-editor .gdWidget { /* Let's style some content when in the Experience Editor */ border: 2px solid red; } With this approach, you can use this class in RTE or anywhere on the website with an experience editor. You can refer to this nice article by Kamruz Jaman: Injecting Resources into Experience Editor in Powerful Ways Hope it helps!
Can you display an indicator for a div in the rich text editor Running version 9.3 I have an editor who mentioned they will paste some code into the rich text editor (usually a div for a widget) and they've had other editors accidentally delete it out because nothing is showing in the design tab. <div class=&quot;gdWidget&quot; data-topicid=&quot;MNHENNE_703&quot; data-copy=&quot;Get updates on grants, programs, and resources available to improve sustainability at schools.&quot; data-position=&quot;bottom&quot;>&amp;nbsp;</div> Is it possible to highlight a div in the RTE only? The placement of these widgets aren't always fixed, so I was hoping to avoid creating a new field. Either route, I appreciate any insight
I saw exactly the same issue when analytics cookie was blocked but form still was configured to use Robots Detection. There were 2 options to fix the issue: disable globally Robots detection with setting: <setting name=&quot;Analytics.AutoDetectBots&quot; value=&quot;false&quot;/> disable robots detection on forms themselves:
Form's submit actions not working after disabling SC_ANALYTICS_GLOBAL_COOKIE cookie I implemented code to block the SC_ANALYTICS_GLOBAL_COOKIE cookie if the consent has not been given (based on this blog post). But after doing that, I noticed, that none of the form's submit actions work (at first I noticed the &quot;Show Page Form&quot; from Sitecore Form Extensions did not work, but tried with &quot;Send Email&quot;, and it did not work anymore as well). It is mentioned in the blog post, that disabling that cookie will disable any features that use XConnect, although I am not sure if Submit Actions are part of XConnect. It feels like aborting the &quot;startAnalytics&quot; pipeline is blocking the submit actions, but I am not sure if that's how it's supposed to be working or could be there another issue. I did not see anything in the logs. Working on Sitecore 10.1.2
This will be because of your using the self signed certificate. If you use a self-signed certificate for SSL, then each client has to import the public-key certificate of the server to establish the trust relationship. Given you have no control over the destination (and are unable to verify the certificate you are presenting is 'trusted'), then I dont believe you will be able to establish the trusted connection. My suggestion would be to create a new certificate for the CA environment, or add some SANs to the one you are using for the CD environment and reuse that.
Device detection in CM server showing error "Could not establish trust relationship for the SSL/TLS secure channel" We have enabled device detection in our Sitecore 10 setup. And in PreProduction it is showing the following warnings and logged when Experience Analytics is trying to process interactions: WARN [Experience Analytics]: Device detection component failed to resolve device information with error: Can not get device information: provider is not initialized. The provider is not initialized due to the following exception: ManagedPoolThread #11 00:09:08 ERROR Could not update device detection database Exception: System.Net.WebException Message: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. We have done the setup as recommended by Sitecore here- https://doc.sitecore.com/xp/en/developers/101/sitecore-experience-manager/configure-sitecore-device-detection.html#configuring-your-firewall_body Also we checked the telnet for the below URLs in 443 port and succeeded- discovery-ces.cloud.sitecore.net devicedetection-ces.cloud.sitecore.net Device detection is working from CD, only not from CM. Only one difference between CM and CD device detection setup I can think is CM site is using self-signed certificate. Can anyone please help me with this?
If it works correctly for your Administrators, then items should already be in the core index. As the issue you described is only happening for non-admin users, I suspect that the problem is in Sitecore access permissions. Please try switching to the Core database and going to the folder /sitecore/client/Applications/Dialogs/InsertLinkViaTreeDialog/PageSettings/Targets. Then check &quot;Security Details&quot; of the folder and its child items. By default this folder does not have any specific security rules and access to it is allowed to all users with the role sitecore\Sitecore Client Users. You can also use the Access Viewer tool to see the final access rights for any user or role. The reason why it starts working when you comment out the <override> line in the config is because it tells Sitecore to switch to the older version of the dialogue where all &quot;Target&quot; dropdown options are hardcoded and, therefore, they are the same for all users including Administrators.
"Target" dropdown in Internal Link options not populating in Sitecore 9.3 for Non Admin Users We are facing the below issue with Sitecore 9.3 where the Target dropdown is blank for non admin users and it has the correct 3 values for the content authors where Administrator checkbox is checked. We have tried the below but with out success. Rebuild Core index Adding new versions of /sitecore/client/Applications/Dialogs/InsertLinkViaTreeDialog/PageSettings/Targets and child items &quot;Target&quot; dropdown in Internal Link options not populating in Sitecore 8.2 Update 3 The only thing that worked for me is commenting the following line in Sitecore.Speak.Applications.config But the Adding Email to the link option is missing in the "internal link.aspx" so due to business restrictions, we could not use the other dialog. <override dialogUrl=&quot;/sitecore/shell/Applications/Dialogs/Internal%20link.aspx&quot; with=&quot;/sitecore/client/applications/dialogs/InsertLinkViaTreeDialog&quot; /> Please suggest.
Go to core database. Find /sitecore/content/Applications/Content Editor/Menues/Languages/More Languages item in Content Editor Set deny in access rights for Everyone like: Administrators will still be able to see the item and the menu and no one else will be able to see the More languages option.
Restricting the "More Languages" button from showing for limited users in Sitecore I tried to restrict the display of the 'More Languages' button for limited users in Sitecore by modifying the read/write language role in /sitecore/system/Languages, but it wasn't sufficient. Is there a way I can manage permissions for this button?
Everything looks good but seems one property is missing here i.e. POS https://files.slack.com/files-pri/T09SHRBNU-F05CB52TAJG/image.png var _boxeverq = _boxeverq || []; // Define the Boxever settings var _boxever_settings = { client_key: 'your key', //Replace with your client key display in screen shot target: 'https://api.boxever.com/v1.2',// Replace with your API target endpoint specific to your data center region cookie_domain: 'dev.sitecorecdp.demo', //Replace with the top level cookie domain of the website that is being integrated pointOfSale: &quot;your POS&quot;, //Replace with newly created POS web_flow_target: 'https://d35vb5cccm4xzp.cloudfront.net' }; // Import the Boxever library asynchronously (function () { var s = document.createElement('script'); s.type = 'text/javascript'; s.async = true; s.src = 'https://d1mj578wat5n4o.cloudfront.net/boxever-1.4.8.min.js'; var x = document.getElementsByTagName('script')[0]; x.parentNode.insertBefore(s, x); })(); I HAVE TRIED IT AND IT IS WORKING FINE ON MY SYTEM. Please try it out, and as you are in learning phase you can start with Engage SDK, for better future support.
Issue with getting the Boxever Id for Anonymous user in CDP I'm getting the following error while trying to get the Boxever Id for anonymous VM121:1 Uncaught ReferenceError: Boxevr is not defined at :1:1 Attached the script screen shot
No, that's not possible in Sitecore. Admins have access rights for all the items. You cannot disallow read or write access rights for them. You should not make users administrators if they are not supposed to have access to something in the system. Instead, create new role with access to pretty much everything, end then remove access to what should be hidden.
Hide items from admins Is there any way to hide items in the content tree from admins? Only specific users would be visible. I already tried with the security editor etc..
Your error looks the same as given in this thread. https://github.com/SitecorePowerShell/Console/issues/944 So to solve this you need to change the app pool to run under the LocalSystem account temporarily to install the package. Check this to configure app pool. Try this and hope this will solve your issue.
Error During SPE 6.2 Installation due to Wrong Path, How to Change the Path? I am trying to install Sitecore Powershell Extension (SPE) 6.2 on my local development environment on Sitecore XP 9.2. As per the official Compatibility table from below link, SPE 6.2 is compatible with Sitecore 9.2. https://doc.sitecorepowershell.com/appendix I downloaded following package from official git repository : When I am trying to install it through Installation Wizard, it is giving me following error because my laptop does not have &quot;E&quot; Drive. So, how can I change the path ? Log file details below : ManagedPoolThread #3 2023-06-14 18:14:59 ERROR Installation failed: System.UnauthorizedAccessException: Access to the path 'E:\install\8CC254CF58A74DCD9DDC7CA1E58178FE' is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost) at System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost) at Sitecore.Install.Files.FileInstaller.Install(Boolean allowOverwrite, String path, Stream stream) at Sitecore.Install.Files.FileInstaller.Install(Boolean allowOverwrite, String path, PackageEntry entry) at Sitecore.Install.Files.FileInstaller.Put(PackageEntry entry) at Sitecore.Install.Framework.SinkDispatcher.Put(PackageEntry entry) at Sitecore.Install.Utils.EntrySorter.Flush() at Sitecore.Install.Zip.PackageReader.Populate(ISink`1 sink) at Sitecore.Install.Utils.EntrySorter.Populate(ISink`1 sink) at Sitecore.Install.Installer.InstallPackage(String path, Boolean registerInstallation, ISource`1 source, IProcessingContext context) at Sitecore.Install.Installer.InstallPackage(String path, IProcessingContext context) at Sitecore.Shell.Applications.Install.Dialogs.InstallPackage.InstallPackageForm.AsyncHelper.<Install>b__8_0() at Sitecore.Shell.Applications.Install.Dialogs.InstallPackage.InstallPackageForm.AsyncHelper.CatchExceptions(ThreadStart start)
Editing Host Configuration In SXA (< 10.3) and Headless SXA (> 10.3 or XM Cloud) you configure your Editing Host within the Site Settings item. /sitecore/content/<<Site Collection Name>>/<<Site Name>>/Settings The fields of interest to you are: Server side rendering engine endpoint URL ServerSideRenderingEngineApplicationUrl Additional Resources https://doc.sitecore.com/xp/en/developers/hd/201/sitecore-headless-development/walkthrough--configuring-the-http-rendering-engine-for-your-jss-app.html How to connect to an API on the host machine from the CM/CD on docker? https://exdst.com/posts/20230525-host-docker-internal-sitecore-containers https://exdst.com/posts/20230521-ngrok-sitecore-containers
Local CM site Experience Editor fetches NextJS static assets from Vercel instead of local I have a local install of NextJS &amp; SC 10.2. The site is running via docker with a setup that is mostly similar to this example: https://github.com/Sitecore/docker-examples/blob/develop/getting-started/docker-compose.yml My local endpoints are: cd.mysite.localhost cm.mysite.localhost id.mysite.localhost hrz.mysite.localhost I can also view the site via localhost:3000. On that endpoint, I see the static assets correctly being loaded from my local: However, when I view my CM site in Experience Editor, the static assets are instead fetched from an upstream publicly accessible Vercel endpoint rather than from my local development endpoint. This source corresponds to a historical Vercel build preview site. I have searched extensively for where this endpoint might be originating from. As far as I can tell, it's not referenced in any of my local code, docker compose files, configs, environment files, and I found no hits when text searching the inetpub directory of the CM container. I also added this Sitecore config change, but the results are still the same. <app name=&quot;MySite&quot; serverSideRenderingEngine=&quot;http&quot; serverSideRenderingEngineEndpointUrl=&quot;http://localhost:3000/api/editing/render&quot; serverSideRenderingEngineApplicationUrl=&quot;http://localhost:3000&quot;/> Where might the Vercel endpoint be coming from, and which config/environment settings must be adjusted to use my local assets instead?
I've used this script to fetch the data of items with API and works well. Try this script. $url = 'https://yourserver/sitecore/api/ssc/auth/login' $Body = @{ domain = 'sitecore' userName = 'admin' password = 'b' } $json = $Body | convertto-json Invoke-WebRequest -Uri $url -ContentType 'application/json' -Method 'POST' -Body $json -usebasicparsing -sessionvariable mysession $jsonContent = Invoke-WebRequest 'https://yourserver/sitecore/api/ssc/item/8792E70C-E8F1-475C-9AA9-FA57228C8EA1' -WebSession $mysession -METHOD 'GET' -usebasicparsing $jsonContent.content | convertfrom-json Hope it helps!
Not able to login into sitecore with invoke-restmethod I need to fetch the data of item with API - https://doc.sitecore.com/xp/en/developers/90/sitecore-experience-manager/the-restful-api-for-the-itemservice.html I am trying this with PowerShell and tried to login like below: [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 $url = 'https://sc102sc.dev.local/sitecore/api/ssc/auth/login' $password = 'b' $Body = @{ 'Domain'='sitecore' 'UserName' = 'jagmeet' 'Password' = $password } | ConvertTo-Json $LoginResponse = Invoke-WebRequest -Uri $url -Method Post -Headers @{&quot;Content-Type&quot; = &quot;application/x-www-form-urlencoded&quot;} ` -Body $Body -SessionVariable 'Session' $Session $LoginResponse but every time, it is throwing an error and not allowing to login: In the logs, it says below: can anyone assist me with this?
From your laptop, open Powershell and run &quot;docker container ls&quot;. Find the container listed with an unhealthy status. Open Docker Desktop and select the container that is unhealthy (In your case it is CD container). Note: An unhealthy container may not appear unhealthy within the Docker desktop which is why the previous &quot;ls&quot; command is so critical. Check the logs. It will most likely be running the health check periodically and it will write the attempt to the logs. Here is an example of a failing CM health check: GET /healthz/ready - 80 - ::1 Mozilla/5.0+(Windows+NT;+Windows+NT+10.0;+en-US)+WindowsPowerShell/5.1.17763.2268 - 500 0 0 35126 Notice that the health check is trying to visit /healthz/ready and is receiving a 500 status code. This means our application is experiencing a YSOD but we cannot see it in the Sitecore logs (because Sitecore cannot even start). Next, issue this command in the shell to view the raw output: curl http://127.0.0.1/healthz/ready This very quickly showed me that we had a bad reference pushed and we cleaned it up. A similar approach can be utilized on all container types. Each container may have a slightly different health check, but this approach gets directly to the root of the problem.
CD docker container unhealthy due to "error in log file monitor. Failed to query file information." When running docker compose up -d, the cd container shows as unhealthy. It was functioning properly yesterday. I am seeing these errors when the CD container is starting up, and I can see the site shutting down and starting back up in a continuous loop: [LOGMONITOR] ERROR: Error in log file monitor. Failed to query file information. File: \\?\c:\inetpub\wwwroot\App_Data\logs\log.20230614.143115.txt. Error: 50 [LOGMONITOR] ERROR: Error in log file monitor. Failed to query file ID. File: \\?\c:\inetpub\wwwroot\App_Data\logs\log.20230614.143115.txt. Error: 50 2023-06-14 15:01:29 2800 15:01:19 INFO ************************************************** 2023-06-14 15:01:29 2800 15:01:19 WARN Sitecore shutting down 2023-06-14 15:01:29 2800 15:01:19 WARN Shutdown message: Initialization Error 2023-06-14 15:01:29 HostingEnvironment initiated shutdown 2023-06-14 15:01:52 [2023-06-14T21:01:52.000Z][LOGMONITOR] ERROR: Error in log file monitor. Failed to query file information. File: \\?\c:\inetpub\wwwroot\App_Data\logs\log.20230614.150152.txt. Error: 50 2023-06-14 15:01:52 [2023-06-14T21:01:52.000Z][LOGMONITOR] ERROR: Error in log file monitor. Failed to query file ID. File: \\?\c:\inetpub\wwwroot\App_Data\logs\log.20230614.150152.txt. Error: 50 2023-06-14 15:02:19 2023-06-14 21:01:09 ::1 GET /healthz/ready - 80 - ::1 Mozilla/5.0+(Windows+NT;+Windows+NT+10.0;+en-US)+WindowsPowerShell/5.1.17763.3770 - 500 0 0 18197 Due to this issue, I am unable to access any of the sites. I tried: Restarting Docker client Cleaning out the docker/data/cd folder Running docker system prune Rebuilding the containers via docker compose up --build The only (inconclusive) references I could find related to this error are: https://github.com/microsoft/windows-container-tools/issues/125 https://github.com/microsoft/windows-container-tools/issues/34 EDIT - Solution Using the information provided by others on this post, I was able to drill down and location the issue: my Web/Master/Core databases were missing from the mssql container entirely (despite them being present in the \docker\data\mssql directory), which was resulting in the error: Exception Details: System.Data.SqlClient.SqlException: Cannot open database Sitecore.Web;requested by the login. The login failed. Login failed for user 'sa' Not sure how this happened, but good to know that such database issues can cause endless restarts of CD.
The error in my case was due to the field Predefined application rendering host on the Site's Site Grouping was empty. Navigate to your Site Grouping - /sitecore/content/<Headless tenant name>/<site name>/Settings/Site Grouping/<site name> In the Predefined application rendering host select your Rendering Host drop the DropLink. It's also worth confirming the following fields on the Items listed; /sitecore/content/<Headless tenant name>/<site name>/Settings/Site Grouping/<site name> Site name Target hostname Hostname Start Item Predefined application rendering host The item referenced by the Predefined application rendering host field Server side rendering engine endpoint URL - this should be the url and port your Next app runs on suffixed by /api/editing/render Server side rendering engine application URL - this should be the url and port your Next app runs on Application name - this should match the Name and AppName in the package.json of your next app
XM Cloud - "Unable to connect to the remote server" when viewing a page in Experience Editor When viewing a Site's page in the Experience Editor, the Editor does not load and the following error message is displayed; Unable to connect to the remote server The CM server logs displays the following entry ERROR [JSS] Error occurred during POST to remote rendering host: `http://localhost:5000` ERROR Unable to connect to the remote server Exception: System.Net.WebException Message: Unable to connect to the remote server Source: System at System.Net.WebClient.UploadDataInternal(Uri address, String method, Byte[] data, WebRequest&amp; request) at System.Net.WebClient.UploadString(Uri address, String method, String data) at Sitecore.JavaScriptServices.ViewEngine.Http.RenderEngine.Invoke[T](String moduleName, String functionName, Object[] functionArgs) Nested Exception Exception: System.Net.Sockets.SocketException Message: No connection could be made because the target machine actively refused it 127.0.0.1:5000 Source: System at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket&amp; socket, IPAddress&amp; address, ConnectSocketState state, IAsyncResult asyncResult, Exception&amp; exception) However the page loads correctly when browsing the page directly on the Next app
When retrieving contacts from XConnect, the sitecore API uses the xDB search index. By default the index is set to not include anonymous contacts. What I suspect is happening in your example is that 43 of your contacts are anonymous, and only 2 contacts have been identified and have Isknown flag set to true. If you join the result of your sql statement to the contats, then contactsidentifiers table you should be able to see the number of known contacts. Alternatively, if in test environment you could update settings in xconnect to index anonymous. To do this: Go to sc.Xdb.Collection.IndexerSettings.xml file on search indexer and update: <IndexAnonymousContactData>true</IndexAnonymousContactData> Then rebuild the index. More info here https://doc.sitecore.com/xp/en/developers/91/sitecore-experience-platform/enable-indexing-of-anonymous-contacts-in-the-xdb-index.html
XConnect: Get contacts with at least 1 interaction between dates In a Sitecore 9.3 XP implementation, using XConnect, while trying to retrieve the contacts with at least 1 interaction between a period of time, the number of contacts is not matching what I see when compared to a SQL query. XConnect query: var contactsWithinDateXConnect = new List<Guid>(); var startDate = DateTime.Parse(&quot;2022-03-01&quot;); var endDate = DateTime.Parse(&quot;2022-05-31&quot;); using (XConnectClient client = Sitecore.XConnect.Client.Configuration.SitecoreXConnectClientConfiguration.GetClient()) { var myQuery = client.Contacts.Where(c => c.Interactions.Any(i => i.StartDateTime >= startDate.ToUniversalTime() &amp;&amp; i.EndDateTime <= endDate.ToUniversalTime() ) ); var myResults = myQuery.GetBatchEnumeratorSync(1000); while (myResults.MoveNext()) { foreach (var contact in myResults.Current) { var contactId = contact.Id.Value; if (!contactsWithinDateXConnect.Any(p => p == contactId)) contactsWithinDateXConnect.Add(contactId); } } } This will result in contactsWithinDateXConnect having only 2 contacts. However, if I use a SQL query to retrieve the contacts from the Shard databases directly, the result will have much more contacts (45). SELECT DISTINCT [ContactId] FROM [Sitecore_Xdb.Collection.Shard0].[xdb_collection].[Interactions] WHERE [StartDateTime] >= '2022-03-01' AND [StartDateTime] <= '2023-05-31' UNION SELECT DISTINCT [ContactId] FROM [Sitecore_Xdb.Collection.Shard1].[xdb_collection].[Interactions] WHERE [StartDateTime] >= '2022-03-01' AND [StartDateTime] <= '2023-05-31' Indeed the 2 contacts found by XConnect are present among the 45 contacts found with SQL, however, it looks like XConnect is missing lots of them. Any clues on why that happens, steps to debug &amp; potential fixes are welcome!
Try using the below code. I checked a few articles that show that it works with And operator, but you can try with Or operator. class IndustrySearchResultItem : SearchResultItem { [Sitecore.ContentSearch.IndexField(&quot;industry_sm&quot;)] [string]$Industry [Sitecore.ContentSearch.IndexField(&quot;service_sm&quot;)] [string]$Service } $props = @{ Index = &quot;sitecore_master_index&quot; Where = &quot;Industry.Contains(@0) Or Service.Contains(@1)&quot; WhereValues = &quot;{7451A225-6450-4D26-BE04-624FD2E63B76}&quot;, &quot;{0670EE3C-1D07-4172-9ADB-19127D90C180}&quot; QueryType = [IndustrySearchResultItem] } Find-Item @props Reference: https://doc.sitecorepowershell.com/appendix/indexing/find-item#where-less-than-string-greater-than Powershell get all items that use a template Hope this helps.
Get all results using Find-Item in sitecore powershell I am using Sitecore PowerShell Extension with the below script $indexName = &quot;sitecore_web_index&quot; $criteria = @( @{Filter = &quot;Contains&quot;; Field = &quot;industry_sm&quot;; Value = &quot;{7451A225-6450-4D26-BE04-624FD2E63B76}&quot; }, @{Filter = &quot;Contains&quot;; Field = &quot;service_sm&quot;; Value = &quot;{0670EE3C-1D07-4172-9ADB-19127D90C180}&quot; } ) $list = Find-Item -Index $indexName -Criteria $criteria | Initialize-Item The issue is above script returns items that follow both filter conditions is it possible to get items even if it follows only one filter condition
Thanks for everyones assistance. After working here, in Sitecore Slack, and with Sitecore Support... it was discovered that the SqlMembershipProvider.GeneratePassword Method is not &quot;guaranteed to pass the regular expression in the PasswordStrengthRegularExpression property&quot; - https://learn.microsoft.com/en-us/dotnet/api/system.web.security.sqlmembershipprovider.generatepassword?view=netframework-4.8 Once we removed that setting, the CLI User is getting created. I blogged the full details here: https://thebitsthatbyte.com/sitecore-cli-non-interactive-user-not-created/
Sitecore CLI Not Authorized to perform the task you are attempting: No Sitecore CLI User Created I have 3 Sitecore environments that have the same configs required for non-interactive login with the Sitecore CLI. 2 of the 3 work without issue, but the 3rd is not. despite having the same configuration files per: https://doc.sitecore.com/xp/en/developers/102/developer-tools/configure-a-non-interactive-client-login.html I checked that requiresUniqueEmail is false in the web.config, and all files are the same across environments (except for values that should be different like the URLs of the ID Service, CMS, and CliServerClient). I just don't see the CLI User getting created in the CMS as a User like the other environments. I am wondering if I am missing a step in how this user account gets created as I thought this would create it: dotnet sitecore login --authority https://<sitecore-identity-server> --cm http://<sitecore-instance> --allow-write true --client-credentials true --client-id <client-id> --client-secret <client-secret> When I run this, it reports: Login information has been saved. The error I receive when I try to run something such as a &quot;dotnet sitecore ser push&quot; is as follows: You are not authorized to perform the task you are attempting. You may need to be assigned additional permissions. What am I missing to get the Sitecore CLI user created in the CMS? UPDATE: In the Logs, I am receiving the following. We do have SHA512 enabled but the other 2 environments had them as well before the user was created. 1064 17:53:06 ERROR [Sitecore Identity] 'http://www.sitecore.net/identity/claims/originalIssuer' claim is missing 2820 17:53:06 ERROR Microsoft.Owin.Security.OAuth.OAuthBearerAuthenticationMiddleware - Authentication failed Exception: System.InvalidOperationException Message: Unable to create a user. Reason: InvalidPassword Source: Sitecore.Owin.Authentication at Sitecore.Owin.Authentication.Identity.MembershipUserStore`1.CreateAsync(TUser user) at Microsoft.AspNet.Identity.UserManager`2.<CreateAsync>d__0.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.Owin.Authentication.Services.DefaultApplicationUserResolver.<ResolveApplicationUserAsync>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.Owin.Authentication.Pipelines.Initialize.BearerAuthenticationBase.<ResolveUser>d__34.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.Owin.Authentication.Pipelines.Initialize.BearerAuthenticationBase.<ValidateIdentity>d__31.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 Microsoft.Owin.Security.OAuth.OAuthBearerAuthenticationHandler.<AuthenticateCoreAsync>d__3.MoveNext()
You would need to create your own API to do this, then call the sitecore API from within. Something like this should work: Controller namespace YourNameSpace.Controllers { public class YourController : SitecoreController { public ActionResult TriggerIndexRebuild(string indexName, string token) { bool success=false; // code to confirm token against config try { IndexCustodian.FullRebuild(ContentSearchManager.GetIndex(indexName), true); IndexCustodian.RebuildAll(); success=true; } catch(Exception ex) { // log the exception } return Json(success, JsonRequestBehavior.AllowGet); } } } Class to register route namespace YourNameSpace { public class RegisterCustomRoute { public virtual void Process(PipelineArgs args) { Register(); } public static void Register() { RouteTable.Routes.MapRoute(&quot;SearchReport&quot;, &quot;api/sitecore/triggerindexrebuild/{indexName}/{token}&quot;, new { controller = &quot;Your&quot;, action = &quot;TriggerIndexRebuild&quot; }); } } } Config to register route <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> <configuration xmlns:patch=&quot;http://www.sitecore.net/xmlconfig/&quot;> <sitecore> <pipelines> <initialize> <processor type=&quot;YourNameSpace.RegisterCustomRoute,YourNameSpace&quot; patch:before=&quot;processor[@type='Sitecore.Mvc.Pipelines.Loader.InitializeRoutes, Sitecore.Mvc']&quot; /> </initialize> </pipelines> </sitecore> </configuration> Once setup, you should then just be able to call: https://your-sitecore-instance/api/sitecore/triggerindexrebuild/sitecore-web-index/xxxx-xxxx-xxxx Sitecore Reference here: https://doc.sitecore.com/xp/en/developers/103/platform-administration-and-architecture/rebuild-search-indexes.html
start database reindexing via API I use an Azure DevOps pipeline to refresh test environment databases (master, web, core) with production data. I want to make the re-indexing of the databases part of the Pipeline, is there a way to start the reindexing of a database via an API call?
Yes, Sitecore decided that Horizon will no longer be supported. See release notes of Sitecore 10.3: https://dev.sitecore.net/Downloads/Sitecore%20Experience%20Platform/103/Sitecore%20Experience%20Platform%20103/Release%20Notes Horizon End-of-Support with SXP 10.3 Sitecore is discontinuing support for the Horizon visual page builder beginning with the SXP 10.3 release. If you are using Horizon, you should remain on 10.2, as an upgrade to 10.3 or later will cause you to lose access to Horizon.
Sitecore Horizon for 10.3 (not Managed Cloud) As this documentation page states, Sitecore Horizon got obsolete in 10.3. Unfortunately, there is no any info what to use instead for Sitecore 10.3, k8s, (not Managed Cloud). Is going back to Experience Editor the only option here?
I have faced challenges with this and understood that most of the operations are broken for CLI commands. This is not fully supported by Content Hub and I have registered it as a bug/improvement with Sitecore with below reference numbers. MONE-37210 and MONE-37211 Note: This is considered by the product support team for implementation but not guaranteed that they will implement this in the near future, they can come up with an alternate solution also.
Getting Serialization errors in Content Hub CLI I am trying to use Content Hub CLI for serialization so that I can pull items from dev and push those items into production. I installed CH CLI using below command. dotnet tool install --global --add-source https://slpartners.myget.org/F/m-public/api/v3/index.json ch-cli Connected with my dev environment successfully using below command. ch-cli endpoint add --name dev --url https://mydev.url/ --client-id <OAuth client ID> --client-secret <OAuth client secret> But when I am trying to pull any taxonomy or any entity, it is giving me below error. This feature is not supported in Content Hub version '4.1.14.471'. It was introduced in version '4.2.0.0'. Same with pulling option lists. But when I am trying to pull some action script, it successfully does that. Command : ch-cli scripting pull --name &quot;XMP data&quot; Does it not fully supported with Content Hub version 4.1? I did not find any sitecore document which says it supports only Content Hub version 4.2 and above.
The sitecore dialog windows sometimes get frozen and take a long time to report back on completed operations. I have noticed this on a few things like basic publish (if publishing from non publishing instance) and also deploying marketing definitions. I would recommend the following: Open up a separate window and load <your-domain>/sitecore/admin/jobs.aspx Trigger smaller install package Observe job starting and finishing in jobs queue Confirm finish in jobs viewer matches the entries you have found in the logs If everything matches up then it should be safe to assume both logs and jobs viewer are a safe source of information for completed jobs. As a further precaution, you could reload sitecore client (ad it does after a package install completes) and spot check items are there in the content tree. As an aside, another way to move large volumes of data between instances is to use the sitecore serialization tools. In the content tree: Navigate to parent item Go to developer tools Serialise tree Find serialized items on disk Copy files to new environment Navigate to parent item in new destination Revert from disk The above process is covered in another more detail in this blog post. It is quite old, but I believe still very relevant: https://briancaos.wordpress.com/2012/10/02/migrating-huge-amounts-of-sitecore-content-use-the-site Finally, it you might also look into the new sitecore CLI, which also has tools to serialize and migrate data between instances.
Is it safer to cancel the Sitecore package installation? We have migrated from Sitecore 8 to Sitecore 10.1. During the content migration, we used Sitecore packages. I've observed that smaller packages install quickly, but larger packages (above 200MB) take an extensive amount of time. While tracking the Sitecore logs, I noticed that the 'Installing item:' message appears to complete within a couple of hours. However, the Sitecore package installation window continues to show the 'installing' message for another couple of hours, with no further 'Installing item:' entries in the Sitecore logs. Eventually, the successful installation package message is displayed on the Sitecore package window. My question is whether it is safe to cancel the package installation window if I don't see any more 'Installing item:' entries in the Sitecore log. Additionally, I usually rebuild indexes after installing a large package.
You have a couple of options to use here. Depends on how far you want to develop your own solution or leverage existing integrations. GPI plugin Smartling XTM Languagewire Wordbee Let us know how you get on.
Sitecore Content Hub Localization Is there any 3rd party module/connector available to automate the translation process in Content Hub? I know we can do this manually from translation page where we can enter translations manually and Content Hub also provides a method to export content for translation in Microsoft Excel format where external translator or translation agency performs the translation. But the ask is for automate translation.
I got help from Sitecore Slack Headless group and as suggested I run npm ci command on the Front-end app root directory. That resolved my initial problem. Initially I did npm install instead of npm ci. Then I encountered bellow error- As I am doing local setup and I don't need CDP, so I just disabled CDP from CdpPageView in the src\Scripts.tsx file as suggested in different blogs and YouTube videos.
Sitecore XM Cloud local setup error with Node.js I am preparing am XM Cloud project for local development with Node.js. On completion of the setup I am getting the below error: error - FetchError: request to https://edge.sitecorecloud.io/api/graphql/v1 failed, reason: connect ETIMEDOUT 2606:4700:91b3:c4eb:e83b:421:f8c7:3c32:443 at ClientRequest.<anonymous> (E:\Projects\HeadlessDemo\XMCloudDemo\src\sxastarter\node_modules\next\dist\compiled\node-fetch\index.js:1:65756) at ClientRequest.emit (node:events:513:28) at TLSSocket.socketErrorListener (node:_http_client:502:9) at TLSSocket.emit (node:events:513:28) at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { type: 'system', errno: 'ETIMEDOUT', code: 'ETIMEDOUT', page: '/en/_site_XMCloudDemo' } I can fetch data from GraphQL API using parameter: https://edge.sitecorecloud.io/api/graphql/ide I follow the below URL to setup my local environment: https://doc.sitecore.com/xmc/en/developers/xm-cloud/walkthrough--connecting-the-next-js-application-directly-to-the-experience-edge-endpoint.html Please help me to fix this error.
After investigation, I found that Sitecore does not save all login sessions into the database. All DomainAccessGuard related functionality is available in Sitecore.Web.Authentication.DomainAccessGuard class in Sitecore.Kernel DLL. To get all the sessions then need to call DomainAccessGuard.Sessions and to kick the session programmatically it is required to call DomainAccessGuard.Kick(sessionId) When a user logs in to multiple browsers or devices, multiple entries will be visible on the KickUser page.
Sitecore KickUser Programatically I have implemented some custom functionality to implement to kick the user, which is working fine but when I see sitecore/client/Applications/LicenseOptions/KickUser.aspx page then that kick user still exists. I also implemented DomainAccessGuard.Kick() I know when the Sitecore login user exceeds then Sitecore redirects to sitecore/client/Applications/LicenseOptions/KickUser.aspx page and for all login sessions I can check in DomainAccessGuard.Sessions but my question is in which database table Sitecore store this all login session and in which pipeline it do the entry into DB
Dean is correct when saying: xConnect/xDB does not need to be fully enabled for rendering personalization rules to work However, there is a major caveat which was revealed after additional testing. If you have xDB enabled in your settings but your xDB sites are inaccessible or experiencing any kind of major issue related to SSL/TLS (which is a common issue), this WILL cause unexpected behavior. Regular personalization rules are not supposed to depend on xDB (which is implied by Sitecore's docs), but there certainly does seem to be a dependency somewhere.
Does xConnect/xDB need to be fully enabled and working for rendering personalization rules to work? I'm looking at an XP implementation that uses personalization rules to hide/show renderings based on a set of custom defined rules (sources 1, 2). For example: Rule: Is user of X type? Action: Run code to inspect user cookie and return true/false Outcome: Hide or show the component based on result of above rule Our custom rules aren't doing anything fancy; they are independent of xConnect/xDB. The problem is that when xConnect is unavailable or experiences errors (ex. certificate issues), or when tracking is disabled, the personalization rules appear to stop working, and renderings fall back to their default display settings. I can reliably replicate this by disabling xDB on my local. The best documentation I found is here (9.3) (10.3). Notably, it breaks down which rules are available to XM vs XP. It also shows all of the personalization conditions. This topic describes the personalization conditions that are available by default in the Sitecore Experience Platform (XP) and indicates which conditions are available in Sitecore Experience Manager (XM or XP with the xDB disabled). This seems to imply that as far as personalization conditions are concerned, if xDB is disabled, an XP implementation essentially becomes an XM implementation. Further, While you can use many conditions from the Rule Set Editor to personalize content when using XM, there are some conditions that are only available when you run xDB and the full XP. This makes sense. And the doc breaks that down very well. It also specifically mentions 2 rules that are relevant to this question: xDB is enabled Tracking is enabled Both XM and XP can use the conditions above for personalization, which implies that xDB and tracking are not required to be enabled for component personalization to work, but that's not the behavior I am seeing. What the documents don't specifically call out is custom code-driven conditions, although it could be this: Is the behavior I'm seeing normal? Beyond having an XM/XP license, what prerequisites are required to personalize the presentation of a component with custom conditions / rules?
My analysis proved correct. Some Sitecore util functionality will behave differently in unit tests than when debugging the site because the unit tests don't natively inherit the site's Sitecore config settings. Those values must be fed to the unit tests according to the suggestions listed here. In this specific case, modifying my app.config of the test project resolved the issue to provide the expected server time zone resolved the issue: <sitecore> <settings> <setting name=&quot;ServerTimeZone&quot; value=&quot;Eastern Standard Time&quot;/> </settings> </sitecore>
DateUtil.ToUniversalTime() and DateUtil.ToServerTime() return unexpected values in unit tests I have a case where the following code returns a different result depending on if I am debugging the site, or running the code in a unit test: var start = DateUtil.ToUniversalTime(@event.Start_Date); Where @event.Start_Date is 12:00PM, December 1, 2030 and the Kind of the date is Unspecified. This is the case regardless of where the code runs. That is, I have confirmed that the input is always the same. When I run this code in a unit test, start evaluates to 7:00PM, whereas if I run this code while debugging the site, it's 5:00PM. I suspect that this has to do with how the DateUtil.ToUniversalTime() works: public static DateTime ToUniversalTime(DateTime serverTime) { if (serverTime.Kind == DateTimeKind.Utc) { return serverTime; } if (serverTime == DateTime.MinValue || serverTime == DateTime.MaxValue) { return serverTime.SpecifyKind(DateTimeKind.Utc); } if (serverTime.Kind == DateTimeKind.Local) { return TimeZoneInfo.ConvertTimeToUtc(serverTime); } return TimeZoneInfo.ConvertTimeToUtc(serverTime, Settings.ServerTimeZone); } That is, if the Kind of the passed DateTime is Unspecified, the method returns the result of: TimeZoneInfo.ConvertTimeToUtc(serverTime, Settings.ServerTimeZone) The key being that it makes a call to Settings.ServerTimeZone. My Sitecore site uses the Eastern timezone, whereas my local machine uses Mountain timezone, so the delta (2 hours difference) matches up with what I think is going on. I see two options: Avoid the use of DateUtil.ToUniversalTime() and instead use TimeZoneInfo.ConvertTimeToUtc(serverTime, Settings.ServerTimeZone) for this specific case Mock Settings.ServerTimeZone as Eastern time in my tests One revelation that has come out of this for me is that Sitecore.DateUtil isn't always going to behave as expected when running unit tests, nor any Sitecore util class that reference config settings under the hood.
This issue appears consistent with problems revealed around the release of Security Bulletin SC2023-003-587441. Can you see if the file Sitecore.Reflection.Filtering.config exists and determine if the SPE events are blacklisted or allowed? More information in this issue and blog post. We recently noticed that the SPE upload dialogs were not working properly and therefore we added these on top of what was provided by Sitecore. This should be fixed in the 10.2.2 hotfix. <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> <configuration xmlns:patch=&quot;http://www.sitecore.net/xmlconfig/&quot; xmlns:set=&quot;http://www.sitecore.net/xmlconfig/set/&quot; xmlns:role=&quot;http://www.sitecore.net/xmlconfig/role/&quot; xmlns:environment=&quot;http://www.sitecore.net/xmlconfig/environment/&quot; xmlns:runInContainer=&quot;http://www.sitecore.net/xmlconfig/runInContainer/&quot;> <sitecore role:require=&quot;Standalone or ContentManagement&quot;> <reflection> <allowedMethods> <descriptor type=&quot;Spe.Client.Applications.UploadFile.PowerShellUploadFileForm&quot; methodName=&quot;OKClick&quot; assemblyName=&quot;Spe&quot; hint=&quot;OK&quot;/> <descriptor type=&quot;Spe.Client.Applications.UploadFile.PowerShellUploadFileForm&quot; methodName=&quot;StartUploading&quot; assemblyName=&quot;Spe&quot; hint=&quot;StartUpload&quot;/> <descriptor type=&quot;Spe.Client.Applications.UploadFile.PowerShellUploadFileForm&quot; methodName=&quot;EndUploading&quot; assemblyName=&quot;Spe&quot; hint=&quot;EndUpload&quot;/> </allowedMethods> </reflection> </sitecore> </configuration>
OKClick method through reflection is not allowed error with SPE We are upgrading our Sitecore version from 8.2 to 10.2. At the moment we are having an issue with Sitecore PowerShell Extension (version 6.4) with the below snippet $uploadDirectory = Join-Path -Path $SitecoreDataFolder -ChildPath &quot;temp&quot; $importFilePath = Receive-File -Overwrite -Title &quot;Import Data&quot; -Description &quot;Choose a valid CSV file to import.&quot; -Path $uploadDirectory -OkButtonName &quot;Next&quot; When we try to run it we keep getting error below. We're not sure what's wrong with it. Server Error in '/' Application. Calling Spe.Client.Applications.UploadFile.PowerShellUploadFileForm.OKClick method through reflection is not allowed. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: Sitecore.Exceptions.AccessDeniedException: Calling Spe.Client.Applications.UploadFile.PowerShellUploadFileForm.OKClick method through reflection is not allowed. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [AccessDeniedException: Calling Spe.Client.Applications.UploadFile.PowerShellUploadFileForm.OKClick method through reflection is not allowed.] Sitecore.Reflection.MethodFilter.Filter(MethodInfo method) +1167 Sitecore.Shell.Framework.Commands.CommandManager.GetMethodCommand(String command) +701 Sitecore.Web.UI.Sheer.ClientPage.Dispatch(String command) +35 Sitecore.Web.UI.Sheer.ClientPage.RaiseEvent() +144 Sitecore.Web.UI.Sheer.ClientPage.OnPreRender(EventArgs e) +806 System.Web.UI.Control.PreRenderRecursiveInternal() +200 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +7479 Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4494.0 Regards, Yos
We faced similar issue after creating a new field validator. Surprisingly, RegularExpressionValidation could not evaluate this.Parameters?.RegularExpression So we created a custom regex validator, //Sitecore namespace - Sitecore.ExperienceForms.Mvc.Models.Validation public class CustomRegularExpressionValidation : ValidationElement<RegularExpressionParameters> { public override void Initialize(object validationModel) { base.Initialize(validationModel); if (validationModel is StringInputViewModel stringInputViewModel) this.Title = stringInputViewModel.Title; // This was not evaluating as expected //this.RegularExpression = this.Parameters?.RegularExpression ?? string.Empty; // so added this this.RegularExpression = this.ValidationItem.Parameters ?? string.Empty; } }
Regex not working in Sitecore Forms In Sitecore 10 forms, I am trying a very simple regex {&quot;regularExpression&quot;:&quot;^(?:\+[0-9]{9,}|[0-9]{10,})$&quot;} This regular expression matches strings that either start with a plus sign followed by at least 9 digits or consist of at least 10 digits alone. The plus sign at the start is optional, and the overall minimum length is 10 characters This is not even showing in the front-end. The attribute **data-val-regex-pattern is missing. I tried this regex {&quot;regularExpression&quot;:&quot;^[0-9]*$&quot;} which is working and also showing the attribute data-val-regex-pattern=&quot;^[0-9]*$&quot; but not the regex with option to have '+' sign in the start. Is there anything I am doing wrong?
The parameters.xml file is used by Sitecore installation of the scwdp packages in Azure. You generally don't need to touch or edit this file in the package. There will be .json files like azuredeploy.json, parameters.json where you'll specify the necessary settings and configurations like Azure instance names, sql server database prefixes, etc and the installation takes care of passing this information to the parameters.xml file inside the scwdp package accordingly.
Parameters.xml in scwdp. What and how? I was looking into Sitecore set-up on Azure. I downloaded the scwdp packages from the Sitecore portal. Inside the scwdp packages, there is a file with the name parameters.xml. I am not being able to: what is the use of the file how to use the file
I've got it working now by adding language IDs under the &quot;languages&quot; node in the &quot;Sitecore.ContentTagging.OpenCalais.config&quot; configuration file. Check out the sample configurations below. full path : C:\inetpub\wwwroot\your instance name\App_Config\Sitecore\ContentTagging\Sitecore.ContentTagging.OpenCalais.config <openCalais> <languages> <language id=&quot;ja&quot;/> <language id=&quot;en&quot;/> <language id=&quot;vi&quot;/> </languages> </openCalais> You can obtain the valid language IDs from the &quot;C:\inetpub\wwwroot\your instance name\App_Config\LanguageDefinitions.config&quot; configuration file.
Issue with Sitecore Content Multi Lingual Tagging: "Could not perform tagging, Providers list is empty" message and warning I have successfully configured content tagging in Sitecore for the &quot;English&quot; language content. However, I am facing an issue where it is not working for &quot;Japanese&quot; language content. I have provided the configuration details below. Configuration Patch file: <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> <configuration xmlns:patch=&quot;http://www.sitecore.net/xmlconfig/&quot;> <sitecore> <settings> <setting name=&quot;Sitecore.ContentTagging.OpenCalais.CalaisEndpoint&quot; value=&quot;https://permid.org/api/calais&quot; /> <setting name=&quot;Sitecore.ContentTagging.OpenCalais.CalaisAccessToken&quot; value=&quot;xxxxxxxxxxxxxxxxxxxxxx&quot; /> <setting name=&quot;Sitecore.ContentTagging.OpenCalais.CalaisLanguage&quot; value=&quot;Japanese&quot; /> </settings> </sitecore> </configuration> Upon encountering the following message: &quot;Could not perform tagging, Providers list is empty,&quot; along with a warning stating: &quot;There were warnings during tagging. Please consult your system administrator for further details.&quot; Can you please review and let me know if I missed anything?
You are using below things,to concurrence. React as your front end SSR headless proxy NODEJS - to server your website in SSR mode Looking for experience editor support with http rendering! Question 1 Question 1 : This option 1 is right way to do? As a SSR proxy can act as a rendering host for CMS Experience editor? Then what we missed here ? Answer for Question1: SSR headless proxy meant to serve the FrontEnd website in ServerSideRenderingMode. It's not meant to act as an editing rendering host. So you can't use it as an editing rendering host. Question 2 Question 2 : How to setup rendering host as per this article in APPSERVICE? When we try this , its no make sense to expose to ngrok first of all because we have public url already. Also when we try this we couldn't able to start rendering host server! Node js throwing below error Answer for Question2: Mentioned this article is very clear for local development. Now coming for higher environments like UAT/PROD. Yes we dont need ngrok to expose URL. Then what we need to do is, Remove the tunnelling part from your code.Then you will not get this error related ngrok. // startRenderHostTunnel('{ngrokurl.when.running.from.local}', { port: 443 }) // .then((tunnelUrl) => { // const buildArtifactsPath = path.resolve(__dirname, '../build'); startRenderingHostServer({ hostname:&quot;&quot;, port: 8080, appInvocationInfoResolver: getDefaultAppInvocationInfoResolver({ appPathResolver: (requestJson) => { return path.resolve('./build/server.bundle'); }, }), hooks: { beforeServerStarted: (server) => { server.use( '/static', express.static(path.resolve(__dirname, '../build/static'), { fallthrough: false, // force 404 for unknown assets under /dist }) ); }, }, }); // }) // .catch((err) => { // console.error(err); // }); General steps to achieve http rendering for experience editor for react/angular/vue projects Pre-requisite checks Make sure your FE code is running with out any build error. Build package Please make sure below changes in your source code. In package.json , change the &quot;tunnelUrl&quot;:&quot;https://your-renderinghost-url&quot; Go to \scripts\http-renderer.js and comment out the tunnelling code for ngrok. This is not required in higher environement. // startRenderHostTunnel('{ngrokurl.when.running.from.local}', { port: 443 }) // .then((tunnelUrl) => { Go to \scripts\http-renderer.js and change the folder path /build-rendering-host/ to /build/ Create build package using the command. > npm run build:rendering-host Your final build package should contain below things, build folder (copy your build-rendering-host content to here) node_modules scripts folder package.json deploy this build package in dedicated environement. Example Azure app service OS:linux RunTime:Node-18-lts CMS configuration Make sure below configuration is proper, <javaScriptServices> <apps> <app {...OtherConfigs} serverSideRenderingEngine=&quot;http&quot; <!--Avoid giving the /api/editing/render this is specific to next.js , not for react/angular/vue based--> serverSideRenderingEngineEndpointUrl=&quot;https://your-renderinghost-url&quot; /> </apps> </javaScriptServices> Now test your experience editor, If you face any issue check your CMS log &amp; Rendering host log for more detials. To enable rendering host logs use this environement variable REACT_APP_DEBUG=sitecore-jss:*.
Sitecore JSS react SSR - how to setup higher environment(UAT/PROD) rendering host for experience editor All our resources are in azure! Our Sitecore instance, front end codes are hosted as app-services! We are trying to setup rendering host for experience editor. We are looking for ideal way for SSR headless option and not integrated mode. Developer machine setup: Below is our developer machine setup &amp; its completely working fine, Following this official docs CMS local Sitecore instance: Below is jss app config, <app name=&quot;exp-demo&quot; layoutServiceConfiguration=&quot;default&quot; sitecorePath=&quot;/sitecore/content/exp-demo&quot; useLanguageSpecificLayout=&quot;true&quot; graphQLEndpoint=&quot;/sitecore/api/graph/edge&quot; inherits=&quot;defaults&quot; serverSideRenderingEngine=&quot;http&quot; serverSideRenderingEngineEndpointUrl=&quot;http://localhost:5000/api/editing/render&quot; serverSideRenderingEngineApplicationUrl=&quot;http://localhost:5000&quot; /> Rendering host: In local code tunnelling to the localhost:5000 In package.json we have &quot;tunnelUrl&quot;: &quot;http://localhost:5000&quot;, Also we will build &amp; run rendering host using this cmd npm run build:rendering-host &amp; npm run start:rendering-host. We are using ngrok tunnel url, only for front end resources testing. Experience editor is working as expected! Higher environment setup : (This is the area we are not able to up and running!) Below options tried, option1 : Pointing FrontEnd(SSR proxy) as serverSideRenderingEngineEndpointUrl. We have a headeless SSR proxy(URL:https://exp-demo-fe) followed by this article. This is our UAT website frontend endpoint with SSR. CMS UAT Sitecore instance : Below is jss app config, <app name=&quot;exp-demo&quot; layoutServiceConfiguration=&quot;default&quot; sitecorePath=&quot;/sitecore/content/exp-demo&quot; useLanguageSpecificLayout=&quot;true&quot; graphQLEndpoint=&quot;/sitecore/api/graph/edge&quot; inherits=&quot;defaults&quot; serverSideRenderingEngine=&quot;http&quot; serverSideRenderingEngineEndpointUrl=&quot;https://exp-demo-fe/api/editing/render&quot; serverSideRenderingEngineApplicationUrl=&quot;https://exp-demo-fe&quot; /> This is failed with below error , when we try to open experience editor. Error Rendering Sitecore.JavaScriptServices.ViewEngine.Presentation.JsLayoutRenderer: Unexpected character encountered while parsing value: <. Path '', line 0, position 0. at Newtonsoft.Json.JsonTextReader.ParseValue() Note we already set JSSEDITING secret in both client &amp; server side. In CM No further logs! Even we try to change the serverSideRenderingEngineEndpointUrl as like below, serverSideRenderingEngineEndpointUrl=&quot;https://exp-demo-fe/jss-render&quot; |serverSideRenderingEngineEndpointUrl=&quot;https://exp-demo-fe|serverSideRenderingEngineEndpointUrl=&quot;https://exp-demo-fe/sitecore/api/editing/render&quot; but this is giving the below error, Connection to your rendering host failed with a Not Found error. Ensure the POST endpoint at URL http://***/api/editing/render has been enabled. Question 1 : This option 1 is right way to do? As a SSR proxy can act as a rendering host for CMS Experience editor? Then what we missed here ? Question 2 : How to setup rendering host as per this article in APPSERVICE? When we try this , its no make sense to expose to ngrok first of all because we have public url already. Also when we try this we couldn't able to start rendering host server! Node js throwing below error node:events:491 throw er; // Unhandled 'error' event ^ Error: spawn C:\home\site\wwwroot\node_modules\ngrok\bin\ngrok.exe ENOENT at ChildProcess._handle.onexit (node:internal/child_process:283:19) at onErrorNT (node:internal/child_process:476:16) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) Emitted 'error' event on ChildProcess instance at: at ChildProcess._handle.onexit (node:internal/child_process:289:12) at onErrorNT (node:internal/child_process:476:16) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { errno: -4058, code: 'ENOENT', syscall: 'spawn C:\\home\\site\\wwwroot\\node_modules\\ngrok\\bin\\ngrok.exe', path: 'C:\\home\\site\\wwwroot\\node_modules\\ngrok\\bin\\ngrok.exe', spawnargs: [ 'authtoken', '***************************************' ] }
Update: If you are using OOB SXA Search then SXA Search resolves the index name using 'Sitecore.XA.Foundation.Search.Services.IndexResolver.ResolveIndex' You can check the code, but it takes the index name based on context database from the fields I shared below. If you like you can also override that method to simply return ContentSearchManager.GetIndex({Your index name}). Assuming your index exists in the config Original: Go to /sitecore/content/{Tenant}/{Site}/settings/Site Grouping/{Your site name} and add indexes for web and master DBs as follow:
Sitecore sxa search result not coming from custom index I am using Sitecore 10.2 in local on containers. I have created a custom indexer, and it is reflecting both in Solr and Sitecore showconfig. How do I bring sxa search results from the custom indexers? I am using all the OOTB search result component. Thanks on advance
Yes, the issue impacts all Sitecore XP Core server roles (Content Delivery, Content Management, Reporting, Processing, EXM Dispatch). Apply the solution to different roles. Refer FAQ section here The bulletin outlines two approaches to resolve the vulnerability: Applying as a hotfix Applying as a patch The main difference between these two options is that the patch only fixes the known attack vector (a specific method or pathway that cybercriminals have been observed using to exploit vulnerabilities in software or systems). At the same time, the hotfix addresses the vulnerability more comprehensively - covering scenarios beyond the known attack vector. Due to this critical difference, Sitecore strongly recommends applying hotfixes rather than installing the patch. Reference: https://www.sitecoregabe.com/2023/04/sitecore-security-bulletin-hotfix-vs-patch.html
Sitecore patch from Security Bulletin SC2023-002-576660 I am trying to install Security Bulletin SC2023-002-576660 hotfix over the XP 9.3 and 10.3 instances. We have multiple Sitecore core server roles (CM, CD, Processing, Reporting, EXM Dispatch). Do we need to install/sync same hotfix over the Processing and Reporting core role and is there any impact?
Both the hotfix packages are the same so you can use any of them. Just take care of the on-prem (your local developer environment) and PaaS. For on-prem, from the Sitecore 10.3.x rev. xxxxxx PRE/Platform Patch/OnPremCumulative folder. For PaaS, from the Sitecore 10.3.x rev. xxxxxx PRE/Platform Patch/CloudCumulative folder. To install you can follow the below steps: Create one separate project in your solution named SitecoreHotfix.Patch or any other name convenient for you. Add all the cumulative hotfix package files in the same project with the correct file or folder path. See blog post for more details: Sitecore Cumulative Hotfixes Installation on OnPrem and PaaS
Cumulative hotfix for Sitecore XP 10.3 I am trying to install 'Cumulative hotfix for Sitecore XP 10.3' source at here. I am using Sitecore 10.3.0 (XP0/XP1) currently. which is correct solution for the 10.3.0 site as one of the following solutions, Cumulative Hotfix On Top Of Any Updates - A hotfix is installed on top of the initial release or any other update release. source at here Cumulative Hotfix On Top Of The Latest Update - A hotfix is installed on top of the latest update release. source at here
You can try something like this for handling paths like, local:/Data/Hero Banner $itemRenderings = Get-Rendering -Item $item -Device $defaultLayout -FinalLayout foreach ($renderingItem in $itemRenderings) { $dataSourcePath = $renderingItem.Datasource # Check if the data source path has a special prefix if ($dataSourcePath.StartsWith(&quot;local:&quot;)) { # Handle &quot;local:&quot; prefix $dataSourceItemPath = $dataSourcePath.Replace(&quot;local:&quot;, &quot;$item.Paths.Path&quot;) $dataSourceItem = Get-Item -Path $dataSourceItemPath } else { # Default handling without any prefixes $dataSourceItemPath = $dataSourcePath $dataSourceItem = Get-Item -Path $dataSourceItemPath } # Output the data source item $dataSourceItem }
Get Datasource Item from Rendering with Powershell I am looking for powershell script to get datasource item of a rendering. Right now I am getting path of datasource item. But since I am using SXA, I expect few paths like, local:/Data/Hero Banner Also I could not find any relevant property of RenderingItem object that could suffice my need. Any help is appreciated. Thanks in advance. $itemRenderings = Get-Rendering -Item $item -Device $defaultLayout -FinalLayout foreach ( $renderingItem in $itemRenderings ){ $renderingItem.Datasource }
This issue only happens when xDB is enabled AND when xDB is inaccessible due to being shut down or if it is experiencing SSL/TLS issues (expired certs, incorrect thumbprints, missing cert permissions for app pools). This can cause unexpected behavior that can give the illusion that caching or session state is the issue, when in fact it is not. As is usually the case, if something isn't working as expected, aim to fix any major Sitecore errors that appear in the logs as part of your troubleshooting. Further reading: Does xConnect/xDB need to be fully enabled and working for rendering personalization rules to work?
Which cache settings or session states scenarios could cause a rendering's personalization conditions to not evaluate after app pool recycle? In my 9.0.2 MVC site, I have a personalized rendering on a page that has personalization enabled. Below is a contrived example of a set of rules that should always result in the rendering being hidden. In plain English: If the condition is true, hide. If the condition is false, hide. To drive the point home, I know for a fact that my custom condition always returns false: public class SomeCondition<T> : TrueCondition<T> where T : RuleContext { protected override bool Execute(T ruleContext) { return false; } } While this is a contrived example, the rendering should always be hidden in this scenario. Replicating the Issue The page where this rendering can be viewed requires authentication. When I log in via private browser tab while debugging, I can 100% confirm that my custom condition is evaluated, and that it always evaluates to false, which is what I am expecting. The component is hidden correctly. However, if I recycle the app pool and reload the page, the rendering becomes visible and I can see that the breakpoint for my custom condition is never hit. It is as if personalization has been skipped entirely. I can also see this happening on other renderings. Temporary &quot;Fixes&quot; Method 1 If I clear the cache via /sitecore/admin/cache.aspx and refresh the page, the personalization starts working again, my custom rule gets evaluated, and the rendering is hidden. If I smart publish any item, personalization starts working again, even if the item I publish was skipped. Method 2 The problem seems to disappear entirely when I disable xDB but leave Tracking enabled: <setting name=&quot;Xdb.Enabled&quot; set:value=&quot;false&quot; /> <setting name=&quot;Xdb.Tracking.Enabled&quot; set:value=&quot;true&quot; /> The Question At its core, the rendering appears to be getting cached in a state by which personalization rules have not yet been applied. What could cause this? Why does this issue only happen when xDB is enabled? Analysis &amp; Attempted Fixes I don't see any obvious custom caching that could cause this problem. We do have a custom overridden Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer (which I can see as part of the call stack when the custom condition is evaluated), but I don't see anything related to caching. It just calls base.Process(args); and does some extra processing around error logging. Rendering caching is disabled on both the rendering in question and its parent renderings. The cacheHtml setting is disabled on the site. Removing the custom condition entirely and leaving only the default personalization of always hiding the rendering. Recycling the app pool a second time does not resolve the issue. Subsequent page refreshes does not resolve the issue. Browser cache is disabled. Session state is specified as follows in my web.config: <sessionState mode=&quot;InProc&quot; cookieless=&quot;false&quot; timeout=&quot;20&quot;/> There is also this in my web config: <configuration> <system.webServer> <modules runAllManagedModulesForAllRequests=&quot;true&quot;> <add name=&quot;Session&quot; type=&quot;System.Web.SessionState.SessionStateModule&quot; preCondition=&quot;&quot;/> </modules> </system.webServer> </configuration>
Your second approach is absolutely correct. There are 2 things you should be aware though: With the code you included in your question you will not get fields that have no value, or fields that have only Standard Value defined. If you want to include them, you should call the following line before getting fields: item.Fields.ReadAll(); Why? For performance reasons. You can read more about it here: When is item.Fields.ReadAll() required to be run? With the code you included you will get raw values of the fields. For fields like Single-Line Text or Rich Text it doesn't really matter, but for fields like Image you will get value like <image mediaid=&quot;{648AFD6B-B750-45C9-AF8F-110B22F53454}&quot; /> That's not necessarily what you need. You may try using code like var renderedFieldValue = Sitecore.Web.UI.WebControls.FieldRenderer.Render(item, &quot;Field Name&quot;); but it really depends on what you want to do with the JSON data after you expose it. With all the above, be aware that there is already RESTful API for the ItemService in Sitecore If it's enabled in your website, you can use it with url like https://localhost/sitecore/api/ssc/item/?path=/sitecore/content/home You can use item ID instead of path as well. You can read more about it here https://doc.sitecore.com/xp/en/developers/90/sitecore-experience-manager/the-restful-api-for-the-itemservice.html
How to get all the fields & their values in Json I'm trying to get all the custom field names &amp; their values, in a JSON string. When I tried to serialize the item, it threw a StackOverflow exception: JsonConvert.Serialize(item) Then, I tried this: List<KeyValuePair<string, string>> itemFieldsAndValues = new List<KeyValuePair<string, string>>(); ///This condition to exclude Sitecore's default fields. IEnumerable<Field> fields = item.Fields.Where(x=>!x.Name.StartsWith(&quot;__&quot;)); foreach(Field field in fields) { itemFieldsAndValues.Add(new KeyValuePair<string, string>( field.Name, item.Fields[field.Name].Value )); } JsonConvert.SerializeObject(itemFieldsAndValues); Is there a better or faster way to achieve what I want. Thank you
item:saving and item:saved events are not triggered on refresh of the page in CMS. There is no functionality like that in Sitecore, unless your project has a really really strange custom code. Yes, item:saving and item:saved are triggered when an item is created - that's how Sitecore works and there is no way of disabling that. Plenty of Sitecore functionality depends on that and you don't want to break it. If you don't want to execute your code on item:saving or item:saved for items of a given template, you can add a condition that will return before executing your audit functionality if item is of a certain template. The item you mention in your question /sitecore/system/Settings/Email/Instance Tasks/Content Management Primary/Message Statistics/Today is a built-in scheduled task responsible for updating statistics of EXM messages. It's configured to be executed every 1 hour by default (in Sitecore 10). You can easily disable it by changing Schedule field of that item from value like 20090326T112200|20990426T112200|127|00:01:00 to 20090326T112200|20090426T112200|127|00:01:00 That means the schedule won't be executed after 26th of April 2009 anymore. Remember that if you use EXM, statistics will NOT be populated anymore.
item:saving event is triggered for Schedule Task items on CMS refresh I'm working on logging item events using custom handlers. I observe that whenever the CMS page is refreshed or an item is created, the item:saving and item:saved events are being triggered and those items are of the template - /sitecore/templates/System/Tasks/Schedule Examples: /sitecore/system/Settings/Email/Instance Tasks/Content Management Primary/Message Statistics/Today Is that expected and is there a way to disable auto saving of such items. Patch.config: <events> <event name=&quot;item:created&quot;> <handler type=&quot;Basiscore.CmsAudit.Handlers.ItemEventHandler, Basiscore.CmsAudit&quot; method=&quot;OnItemCreated&quot;/> </event> <event name=&quot;item:saving&quot;> <handler type=&quot;Basiscore.CmsAudit.Handlers.ItemEventHandler, Basiscore.CmsAudit&quot; method=&quot;OnItemSaving&quot;/> </event> <event name=&quot;item:saved&quot;> <handler type=&quot;Basiscore.CmsAudit.Handlers.ItemEventHandler, Basiscore.CmsAudit&quot; method=&quot;OnItemSaved&quot;/> </event> </events> ItemEventHandler.cs public class ItemEventHandler { public void OnItemCreated(object sender, EventArgs args) { ... } public void OnItemSaving(object sender, EventArgs args) { ... } public void OnItemSaved(object sender, EventArgs args) { ... } }