Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • John DeSpirito 1 post 21 karma points
    Dec 18, 2012 @ 20:40
    John DeSpirito
    0

    Change Primary key for Member updating?

    Hello,

    I notice when importing content the GUI allows you to define the primary key which I assume determines whether to add or update a record, however, when importing members you don't have this option.

    The problem I'm running into is that login names might change once in awhile and all future imports we get in CSV from our client will then cause duplicate members.  However, they have a field in the CSV that is a sort of a legacy ID number that if we could use as the primary key, that would solve our problem.

    Does anyone know a way I can use that instead of the login name?

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Dec 19, 2012 @ 06:23
    Richard Soeteman
    0

    HI John,

    From the GUI it's not possible to do this. I've made the tool with the assumption 90% of the users want to use it this way. But it is possible I think with a little bit of coding.

    If you can check the manual for the recordimporting event. This is the event that gets fired every time a record is about to import. On the items collections you get all the items from the datasource also the Id you use. Giving this information you can create a relation table yourself in the database, creat an Id and login column. This is how the content import works all relation info is stored in the cmsimportRelation table. Then in the event check if the login exists based on the id and if the login is different update the login on the member object yourself and set the updateaction to Overwrite. If the record doesn't exist create a relation between id and login in the relation table.

    The rest CMSImport will handle and you don't have duplicates.

    Hope this helps,

    Richard

Please Sign in or register to post replies

Write your reply to:

Draft