Surendra Sharma

Surendra Sharma

Search This Blog

Saturday, February 9, 2019

Multiple bucketing structure in single Sitecore instance

When you are bucketing items in Sitecore, by default it will be reorganized all child items by creating folders according to datetime order in year, month, day, hour, and minute.

Datetime Structure
Datetime Structure
But what if you want one datetime order at one place and for some other items you want all child items should rearranged in alphabetic order or may be by creating folders according to GUID characters.
How to achieve it?
 

To create a multiple bucketing structure in Sitecore:

1.    Visit to the “/sitecore/system/Settings/Buckets/Item Buckets Settings”. Click on Edit rule in Rules for Resolving the Bucket Folder Path field:
 
Item Bucket Settings
Item Bucket Settings


2.    Create rules by selecting a condition and an action.
 

Here action specifies the bucket folder structure. Only bucket items that match the condition will use the action.

Bucket Rule
Bucket Rule

For example, above rule creates alphabetic bucket structure as:

Alphabetic Ordering of bucket items
Alphabetic Ordering of bucket items

Now you have bucketing structure according to datetime and alphabetic order in one Sitecore instance. However you can create any number of such ordering by using such rules.

Isn’t that a cool feature???

Saturday, February 2, 2019

Sitecore Headless architecture in Ravana ways


With version 9.1, Sitecore officially started to support JSS(Java Script Services) which bring a capability of true headless CMS.
 
But headless is still a new concept for many developers and if you questioned them during interview what is headless, many developers just started to feel uncomfortable.

This article may help you to understand headless architecture through Ravana(Wikipedia) way.

In India we have one of the greatest epic called Ramayana.

In short it's an epic about lord Rama, Sita, Ravana etc. This Ravana is very interesting mythological character and help me to understand headless architecture.

In many temples, Ravana showed with all his weapons and with 10 heads as

Ravan
Ravan

Ravana kidnapped Sita, so there was a war between Rama and Ravana. During that war Rama cut his head as

Headless Ravan
Headless Ravan


But Ravana was blessed with boon from Brahma and nobody can kill him in normal way.

Here you can imagine Ravana legs as Sitecore databases, his middle body as Sitecore XP and his all weapons represented as xConnect, Sitecore analytics and services, etc. 

But any living creature can't be survive well without any head. Similarly Sitecore can be headless but your final product or website can't be headless. It must have at least one or more head. It's something like

Depicting Sitecore and Ravan

Ravana had 10 heads which were different in look and shape. Each head was master in one field but ultimately, they all were face of Ravana. 

Similarly there are different front-end technologies with different features and uses. Where front end technologies can be angular, React, Vue.js, knockout, ASP.Net, MVC, Ruby etc. 

In short Ravana body represent Sitecore backend parts while his heads represent front end technologies.

That’s it.

I hope Ravana's character help you to understand Headless architecture. So next time someone ask you about headless explain him through Ravana's way.

Happy headless.

Friday, January 25, 2019

Sitecore error - You must remove all users with password before setting the containment property to NONE

I was installing Sitecore 9 and received some SOLR CORE errors so I again re-execute the script and this time received new error “You must remove all users with password before setting the containment property to NONE”.
 
I google it and found out that it’s because of users are exist in Sitecore databases.

So I created this handy SQL script where you have to specify database prefix only and it will remove particular users from all necessary databases.

--Specify your Sitecore instance prefix here
DECLARE @prefix NVARCHAR(50) = 'sc9u2com';
DECLARE @query NVARCHAR(MAX);
SET @query = 'Use [' + @prefix + '_MarketingAutomation]; DROP USER [marketingautomationuser];'
SET @query = @query + 'Use [' + @prefix + '_Messaging];DROP USER [messaginguser];'
SET @query = @query + 'Use [' + @prefix + '_Processing.Pools];DROP USER [poolsuser];'
SET @query = @query + 'Use [' + @prefix + '_ReferenceData];DROP USER [referencedatauser];'
Select @query
exec(@query)

I hope this script will help developers who are facing same issues.

Friday, January 18, 2019

4th Sitecore Marketplace Module – Sitecore Social Feeds Manager

Sitecore Social Feeds Manager
Sitecore Social Feeds Manager

I am very excited to share my 4th module “Sitecore Social Feeds Manager” on Sitecore marketplace. You can download it from here.

We all know the importance of social media for product branding. Almost all websites showing their organization or products related social messages to their website.

I created this helix-based module for getting social feeds from Facebook, Twitter, Youtube and Instagram.

Steps to use this module
1. Download and installed this Sitecore package
2. Fill your Social keys for Facebook, Twitter and Youtube in item "/sitecore/content/Habitat/Global/Social/Social Media Manager"
3. Publish Sitecore items.
4. Access JSON result from URL http://<your.sitecore.instance>/api/sitecore/social/GetSocialFeeds?channelName=youtube&token=accesstoken.

By default, it shows recent 8 feeds from each social channel but you can control the number of feeds from Sitecore.

I also included “All” feeds option where you can access recent 2 feeds from each channel and show mix of total 8 feeds on your front end. Again, you can control total numbers of feeds from Sitecore for “All” use case.

I have excluded HTML part on this module as every website have different HTML and look and feel. So directly consume this JSON output and integrate it in your HTML at desired location.

A sample HTML for calling and using this JSON data by AJAX is

<div id="SocialFeedsDiv">

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

    <script>


        $(document).ready(function () {
            var b = null;
            $("#all").click(function () {
                loadfeeds("All")
            });

            $("#Facebook").click(function () {
                loadfeeds("Facebook")
            });

            $("#Twitter").click(function () {
                loadfeeds("Twitter")
            });

            $("#Youtube").click(function () {
                loadfeeds("Youtube")
            });

            $("#Instagram").click(function () {
                loadfeeds("Instagram")
            });


            function loadfeeds(channelName) {
                $.get("/api/sitecore/social/GetSocialFeeds?channelName=" + channelName + "&token=accesstoken", function (data, status) {
                    var index = 1;
                    $("#feedlist").html("");
                    $.each(data.responseResult, function (i, field) {
                        var imageurl = "";
                        if (field.ImageURL !="" || field.ImageURL != null) {
                            imageurl = "ImageURL : <a href='" + field.FeedURL + "' ><img src='" + field.ImageURL + "' alt='" + field.Title + "' /> </a> <br>";
                        }
                        $("#feedlist").append(
                            "<li>Sr No :" + index + "<br>" +
                            "FeedID :" + field.FeedID + "<br>" +
                            "PlatformName :" + field.PlatformName + "<br>" +
                            "Title :" + field.Title + "<br>" +
                            "Description :" + field.Description + "<br>" + imageurl
                            +
                            "FeedURL :" + field.FeedURL + "<br>" +
                            "Timestamp :" + field.Timestamp + "<br>" +
                            "From :" + field.From + "<br><br><br>" + "</li>"
                        );
                        index++;
                    });
                });
            }
        });

    </script>

     <br />
    <a href="javascript:void(0)" id="all">All</a><br />
    <a href="javascript:void(0)" id="Facebook">Facebook</a><br />
    <a href="javascript:void(0)" id="Twitter">Twitter</a><br />
    <a href="javascript:void(0)" id="Youtube">Youtube</a><br />
    <a href="javascript:void(0)" id="Instagram">Instagram</a><br />

    <div id="feed">

    </div>

    <br />
    <br />

    <div id="HTMLfeed">
        <ul id="feedlist"></ul>


    </div>

</div>

You may interested in my other 3 modules on Sitecore marketplace




I hope you will use these Sitecore modules. Stay tuned for more Sitecore related information.

Till that happy Sitecoring :)

Please leave your comments or share these marketplace modules if it’s useful for you.