Hi @fernando_jardim ,
first if you import multiple times the value of multiple select field will get overriden or ignored if the contact exists and you do not give the permission to override.
there are several ways to go about this, I will assume you are after the one the requires the least technical knowledge.
Create fields on contacts:
- events - multiple select - - contains list of all events and you select only the ones contact has attended
- firstevent - string value of the event contact has attended first
- lastevent - string - same as first event only for the last event
- eventpoints - new points for the event - you specify how much points lead is getting because he/she attended some event
when you are importing contacts for specific event in csv you only specify first and last event and eventpoints and allow field override in import settings.
Once you have that structure and data in the database all you need to do is add extra cronjob that runs query like so: (not tested):
/usr/bin/mysql -e "UPDATE leads SET events = CONCAT(events, '|', lastevent), points = (points + eventpoints), eventpoints = NULL WHERE eventpoints IS NOT NULL; ";
What the above query is doing, is saying OK add last event the lead has been on to the list of all events user has been on add event points to overall lead score.
Even though we have a cronjobs here I think this is the easiest way to achieve what you are asking.
The more proper way of doing this would be to create a custom plugin with lead pre save event listener that checks these fields and adds points.
The most proper way (which I suspect is an overkill in your situation - although I might be wrong) is to extend Point actions and trigger the custom event action on import.
If you do decide to go with a custom plugin, here is the boilerplate I use: GitHub - mzagmajster/plugin-helloworld: Hello World plugin built on the Integration framework
Using the above you only need to add one event listener to LeadEvents::LEAD_PRE_SAVE event and do what I have done above with SQL query.
When you have the fields as the above I think you can easily use the segments to get:
- leads with specific first/last event
- all events the user has attended.