0

I have to write a workflow which should run everyday automatically. It should check if anyone has birthday on a specific date so it should send mail to few people..

I am not able to get how to run the workflow everyday automatically.

what would be the different approaches to do this?

1

you can create a site workflow using sharepoint designer and we can make this to work like timer job.

  1. Your complete workflow look like in below image

enter image description here 2. in this step you know how to initialize workflow variable to call rest api list along with fields, you can specify more fields with comma separated to get them

enter image description here 3. build the dictionary variable for accept, content type

enter image description here 4. Call http service in app step(this app step used to run the service call admin privileges

enter image description here 5. see the call http service action properties and mention them as in the image

enter image description here enter image description here

  1. finally retrieving the birthday list using for loop and sending email if birthday is today

    enter image description here

    1. once you created the workflow Save and publish the workflow

    2. now go to site workflows on the site and start the workflow manually and it will start and run like timer job.

1

With the assumption that you are using SharePoint 2010 Workflows, it is a complex problem as:

  1. SP 2010 Workflows do not allow while/loop constructs, i.e. one can not loop through all records in list on a condition or wait for a period in a loop
  2. Workflows can not invoke themselves.

Solution is trick solution rather than native one. Please see steps below:

  1. Add hidden field in the list e.g. SendBirthdayMail (Number) - default - 0
  2. Create Workflow "A" which runs on addition/change of an item in the list.
  3. it calculates the date (Birthday date) on which email is to be sent and start "Pause until date" activity based on this date.
  4. Next activity will update "SendBirthdayMail" with value 1
  5. Create Workflow "B" with runs on addition/change of an item in the list and when "SendBirthdayMail" = 1
  6. After this add "Send Email Activity" in Workflow "B"
  7. Use "Pause for Duration" to pause for 1 day in Workflow "B"
  8. Finally update "SendBirthdayMail" = 0 in Workflow "B"

After step 7, Workflow "A" will fire again and go till step 3 and wait for next birthday.

You may need to fine tune steps. Do let us know if you face any challenges.

NOTE: Do not add item to list using farm administrator as workflows do not fire in that case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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