Can I still access a sitecore contact facet once session is flushed?

前端 未结 3 1771
礼貌的吻别
礼貌的吻别 2021-01-19 13:23

I\'m hoping I\'ve not gotten the wrong end of the stick here (as always the sitecore documentation is woeful!)

I wanted a way to store information against a visitor,

3条回答
  •  -上瘾入骨i
    2021-01-19 13:58

    Your problem lays in regards how you pulling the contact: If you are in a page request, you should access the current contact via Tracker.Current.Contact. your code is not in a page request, but the user may have a live session, use the ContactManager with the methods described above. If the contact is not in a live session right now, you should use ContactRepository. See an example on how to use it here. Copied from https://sitecore.stackexchange.com/questions/3319/why-are-custom-xdb-facets-being-overwritten-on-session-end answered by Dmitry Shevchenko.

提交回复
热议问题