Developer forum

Forum » Integration » Send mail when user's email has been updated in an import job

Send mail when user's email has been updated in an import job

Niels Foldager
Reply

Does anyone knows if it is possible to send an email to a user if the user's email is updated when running an import job in the Data Integration module using the UserProvider? Or is there some observer etc. in Dynamicweb which can catch this event?

We have a scenario where an existing user account can get the email updated because a new person takes over the same user account. If this happens there should automatically be sent an email to the new "user" with a welcome message and login information.

Best regards
Niels


Replies

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Niels,

this is not implemented by default in the DataIntegration User provider. But you could use the Dynamicweb api to implement it.

You could use the "Dynamicweb.Data.Integration.TableScript" abstract class and implemet your own ScriptingClass which will process the input rows before they got to the UserProvider.
In this ProcessInputRow method you could check if your source email is not matching the existing users email(you can get exising user details by using Dynamicweb.Modules.UserManagement.User.GetUserByID or GetUserBySql methods) and store those users in some Session key/object.

You could select your script class after uploading it to web site bin folder in the job mappings:

Then you need to subscribe to the "Dynamicweb.Notifications.Integration.JobFinished" notification and check your Session object with updated users and send the emails using Dynamicweb.EmailHandler class.

Hope this helps

Regards, Dmitrij

 

You must be logged in to post in the forum