SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like a workflow to be triggered when a property in a user's profile is edited. Ideally this would be triggered by an edit done either by a user or through the User Profile Synchronization Service.

For example, we have an HR System that needs to be updated when someone's name changes. We would like the employee who's name changed to perform the edit in the profile in SharePoint and then, when the profile is edited, it would trigger a workflow that would send an email to the HR indivudal who performs the update. Again, ideally we would like this to be done if an update to the profile is done through profile sync too.

Is this possible?

share|improve this question

I have not seen any approach that would enable you to connect a workflow to the User Profile Update directly. You could write a timer job that queried the User Profile Change log with a query for the fields in question and then trip an event from there.

share|improve this answer

I didn't worked with workflows a lot but I think you can do something like this,

  1. When User make changes to User Profile Data start a "Approval Workflow" and then update user properties in code manually and do what you want to do after,

Here's the code for workflow completed method,

 public override void WorkflowCompleted(SPWorkflowEventProperties properties)
        if (properties.CompletionType != SPWorkflowEventCompletionType.Completed) return; //only update the Leave days when the leave request get approved.
            using (SPSite site = new SPSite(properties.WebUrl))
                using (SPWeb web = site.OpenWeb())
                    SPWorkflow wf = new SPWorkflow(web, properties.InstanceId);
                    UpdateUserProfile(wf.AuthorUser.LoginName); //update the initiator's profile

Update the user's prfile

    public void UpdateUserProfile(string userAccount) 
        string url = ""; //replace with your site collection
        using(SPSite site = new SPSite(url)){
            SPServiceContext sc = SPServiceContext.GetContext(site);
            UserProfileManager upm = new UserProfileManager(sc); //now you have the manager object
            UserProfile up = upm.GetUserProfile(userAccount); //for example, "adventuer\\jony"
            up["Leave"] = int.Parse(up["Leave"].ToString())-1; //you may want to check if the Leave is more than 0

Source : Approval Workflow to update User Profiles Details

Hope it helps :).

share|improve this answer

An other solution would be to override the edit profile page and add your code to the save button.

I've found it here

To do it, you'll have to create an other page and redirect the edit page.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.