I am fetching contact on the basis of "SC_ANALYTICS_GLOBAL_COOKIE". When I am creating Shared session manager client object and trying to fetch contact it's giving me null value every time.

Scenario: On the same browser, Contact [email protected] entered his details and I have saved it into XDB and created a new contact. After some time another contact [email protected] entered his details and saved it into XDB (New Contact Created with email identifier).

I need to populate the latest entered contact data in MVC forms like Name, Mobile, Email, etc.

So I am trying to get the latest details using the ssharedSessionManager object using below code:

ContactKeyCookie contactCookie = new ContactKeyCookie();
            if (!contactCookie.IsNewContact)
                Guid contactId = contactCookie.ContactId;
                var contactManager = Factory.CreateObject("tracking/contactManager", true) as ContactManager;
                var contact = contactManager.LoadContact(contactId);
                var sharedSessionManager = (SharedSessionStateManager)Factory.CreateObject("tracking/sharedSessionState/manager", true);
                // Try to load the contact from the Shared Session.
                Sitecore.Analytics.Tracking.Contact sessionContact = sharedSessionManager.LockAndLoadContact(contactId);

sessionContact always giving me null value instead of giving me latest entry i.e. [email protected]. Thanks.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.