Persona data synchronization

thai tran asked on August 23, 2019 04:25

As we cannot use any of the following methods (continuous integration, staging, export) to transfer persona data from one environment to another environment (e.g. from Stage to Production), is there any other way for us to perform this task?

Recent Answers


Roman Hutnyk answered on August 23, 2019 09:05

I don't think Kentico provides such possibility. I can't think of the use case when you might need to sync persona data between environments.

Anyway if you still have a good reason to do that you'll need to use some SQL job or implement .net code to do so.

1 votesVote for this answer Mark as a Correct answer

David te Kloese answered on August 23, 2019 09:41

What is the reason you can't use it?

License, Legal, firewall...?

And do you need the whole persona or just the rules?

0 votesVote for this answer Mark as a Correct answer

thai tran answered on August 23, 2019 10:11 (last edited on August 23, 2019 10:20)

@Roman Thank you for your reply. I have the following use-cases: 1. Developer A creates a number of personas and rules in his local database. He wants to share them with Developer B so that Developer B can test the content personalisation on his local database. Developer B has to create all the persona data manually. 2. Assume we can set up an Authoring site and a Delivery site and we can use Staging module to synchronise the content from Authoring to Delivery. Since we can't sync the persona objects, our users will need to log in the Delivery site to create the personas manually. 3. It is possible that the persona of the same name can have different PersonaIDs on different environments because the ID field is auto-increment. Therefore, if you assign a number of pages to a persona ID in the Authoring site and sync those pages to Delivery, the relationship will no longer be valid. Thanks so much for your suggestion. I will give it a try.

0 votesVote for this answer Mark as a Correct answer

thai tran answered on August 23, 2019 10:14

@David If you look into the PersonaInfo class and also, read Kentico documentation, you will find that Kentico doesn't support transferring personas between environments.

0 votesVote for this answer Mark as a Correct answer

David te Kloese answered on August 23, 2019 11:57

huh

Didn't know... I totally get your point on syncing it!

Think because persona's are very specific, and may require lot of re-calculation based on the rules.


Available methods don't help a lot as the personainfoprovider

CMS.Personas.PersonaInfoProvider pip = new PersonaInfoProvider();       

doesn't have a method to list persona data.

Using the PersonaService you'd be able to get the PersonaInfo object, but requires a dummy contact.

ContactInfo dummyContact = ContactInfoProvider.GetContactInfo("exampleContact@websites.com");

    CMS.Personas.PersonaService ps = new PersonaService();
    CMS.Personas.PersonaInfo pi = ps.GetPersonaForContact(dummyContact);

Which you would send to the 2nd instance and might be able to import,

    CMS.Personas.PersonaInfo piCreate = new PersonaInfo()
        {PersonaName = "abc",
        PersonaDescription = "xyz"}; //etc
    piCreate.Insert();

Where ect also should contains all the logic for the underlying rules... not to mention triggering the recalculation.

Which isn't ideal at all. I suggest to contact Kentico Support if they have any advise. Since I'm also interested please report your solution here!

1 votesVote for this answer Mark as a Correct answer

Roman Hutnyk answered on August 23, 2019 12:08

Another workaround is to implement a routine that will create all the personas and assign them to particular pages using Kentico API (similar to database seed with EF), so you could check in the code into the repo and execute it in different environments. Suggested approach requires some development efforts but addresses your issue.

2 votesVote for this answer Mark as a Correct answer

thai tran answered on August 26, 2019 06:25

Thanks guys. Here's how I can resolve my problem.

public class PersonaLogger : Module
{
    public PersonaLogger() : base("PersonaLogger", false)
    {

    }

    protected override void OnInit()
    {
        base.OnInit();

        PersonaInfo.TYPEINFO.SynchronizationSettings.LogSynchronization = SynchronizationTypeEnum.LogSynchronization;
        PersonaInfo.TYPEINFO.ContinuousIntegrationSettings.Enabled = true;

        ScoreInfo.PERSONASCORETYPEINFO.SynchronizationSettings.LogSynchronization = SynchronizationTypeEnum.LogSynchronization;           
        ScoreInfo.PERSONASCORETYPEINFO.ContinuousIntegrationSettings.Enabled = true;

        RuleInfo.PERSONARULETYPEINFO.SynchronizationSettings.LogSynchronization = SynchronizationTypeEnum.TouchParent;
        RuleInfo.PERSONARULETYPEINFO.SynchronizationSettings.IncludeToSynchronizationParentDataSet = IncludeToParentEnum.Complete;
        RuleInfo.PERSONARULETYPEINFO.ContinuousIntegrationSettings.Enabled = true;
    }
}
2 votesVote for this answer Mark as a Correct answer

David te Kloese answered on August 26, 2019 11:18

Nice, thanks for coming back with this!

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.