locked
SPD workflow should run on timer service RRS feed

  • Question

  • Hi team,

           I was designed workflow by using Designer. The workflow should run daily basis at midnight .

    not like item added,updated..

    Thanks for advance.

    Friday, July 26, 2013 6:46 AM

Answers

All replies

  • Hi team,

    How to  Run sharepoint designer workflow by daily basis on specific time. I dont want to run manually means automatic, item added and item updated.

    Friday, July 26, 2013 7:07 AM
  • Hello,

    You can't run workflow on specific time. Either you create powershell script or timer job for this.

    Hope it could help


    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Friday, July 26, 2013 10:57 AM
    Moderator
  • If U dont mine can you do how to create timer job from Visual studio 2013.

    I did upto one level.

    I was created  empty sharepoint project ,then created folder, inside folder created class file .

    In Features folder I was created new eature, after that I struckup, what I need to do .

    By refering the below url I did, I was followed upto 12 th point, can you explain where I need to place the code (whatever mentioned in 13th point)

    can you explain pls...

    http://www.sharepointpals.com/post/Step-by-Step-procedures-to-create-a-Timer-Job-in-SharePoint-2013

    Friday, July 26, 2013 11:06 AM
  • Use below line in steps 13 to run your job at 11:50PM everyday: (you can remove SPDailySchedule class code)

    SPSchedule daily = SPSchedule.FromString("daily between 23:50:00 and 23:55:00"); // executes between 11:50 and 11:55PM IST or local time
    timer.Schedule = daily;

    After did all the steps please restart timer service from services.msc.

    Let us know your result


    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, July 26, 2013 11:17 AM
    Moderator
  • I am not getting SPDailySchedule class code, where is it  in the code.

    Actually what I am trying to do is Sending Birthday email to all of the employees.

    If you dont mine can you explain clearly.. or share any urls

    I have a list  it contains all of employees information. need to send Birthday email.

    Friday, July 26, 2013 11:27 AM
  • Hi Hemendra,

    all of the code I was placed in a class file, I was commented the SPDailySchedule class code in FeatureActivated method.

    if I build the code shows the error like error screen shot

    Please guide me ...

    Friday, July 26, 2013 11:51 AM
  • >all of the code I was placed in a class file

    You should not add all code lines in class file. It seems you are very new to sharepoint dev.

    To create timer job you need to have only one class file, where you can put job definition as mention in step 9. You need to write your query or code in Execute() method so your logic could run when timer job executes.

    Now follow the steps 11 and add one feature. You will see feature activate / deactivate and install/uninstall methods. You only need to use activate/deactivate methods.

    >I am not getting SPDailySchedule class code,

    You need to add below namespaces in your feature.

    using Microsoft.SharePoint;
    using Microsoft.SharePoint.Administration;

    I would also suggest, Before creating timer job you should understand timer job concept and it feature then only you can work with it:

    http://msdn.microsoft.com/en-us/library/hh528519%28v=office.14%29.aspx

    Lastly, How good you are with powershell? If you are ok with powershell the create shell script to send birthday email then later you can execute this script daily via windows task scheduler.

    Let me know if you need more help


    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, July 29, 2013 4:56 AM
    Moderator
  • hi,

     Can you share the shell script to send birthday email to all of oue employees.

    I have a list , in the list Colums like EmpName,Designation,Role,Dob...

    Monday, July 29, 2013 5:30 AM
  • No i don't have with me right now. (i am away from my prod machine).

    You can try with laura suggestion with SPD workflow and content expiry policy: (this suggestion will not work with free version. Only available in enterprise version)

    http://social.msdn.microsoft.com/Forums/en-US/e438fe69-7efa-4ee7-9660-26382611bf32/sharepoint-automatic-birthday-emails


    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, July 29, 2013 5:46 AM
    Moderator
  • Hi,

            I was added the code under FeatureEvent Reciever. here I was decalre the code under FeatureActivated method SPSchedule daily = SPSchedule.FromString("daily between 23:50:00 and 23:55:00"); // executes between 11:50 and 11:55PM IST or local time
    timer
    .Schedule = daily; But it shows litle bit error. Can you try to say where I need to add  the code.

    Monday, July 29, 2013 6:12 AM
  • Steps 13 uncomment below line:

    Mytimer timer = new Mytimer("SathishSampleTimer", webapplication, "http:// MysitecollectionURL ");

    Why you are not trying to understand the concept of timer job as suggested before? DO NOT DEPENDS ON COPY/PASTE code


    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Monday, July 29, 2013 6:22 AM
    Moderator
  • ok, Now I am go through the concept of Timerjob
    Monday, July 29, 2013 6:27 AM
  • Hi Hemendra,

         I followed the URL, Build also Succeded ,when I try to deploying it shows one error.

    error occurred in deployment step 'activate features' sequence contains no elements

    Monday, July 29, 2013 9:56 AM
  • Try to use FirstOrDefault instead of First:
    SPService service = results.FirstOrDefault();
    if (service != null){
        DeleteJob(service);
    }


    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, July 29, 2013 10:07 AM
    Moderator
  • Sil same error boss...
    Monday, July 29, 2013 10:25 AM
  • Could you use your first link code to delete job instead of LINQ (this error indicates that there is problem with LINQ and i can't tell you the actual problem without seeing your site)

    foreach (SPJobDefinition job in webapplication.JobDefinitions)
                 {
                     if (job.Name == "SathishSampleTimer")
                         job.Delete();
                 }
      
    


    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, July 29, 2013 10:35 AM
    Moderator
  • Good Morning Hemendra,

       Successfully I was created Timer service and activated, now my concept is to send Birthday Wishes as a mail to all of the employees in our company.

    Can you give the idea how to do it. In my list contains the values of Empname,designation,DateOfBirth....

    Suppose one of the employee DateOfBirth is: 30/07/1983. Now email should trigger.

    Thanks&Regards

    P.Tharak

    Tuesday, July 30, 2013 3:59 AM
  • Follow below suggestion to get employee birth date, month and year using query then add that code in execute() method.

    http://sharepoint.stackexchange.com/questions/28155/caml-to-get-todays-birthdays

    Later you can use SPUtility.SendEmail() to send email:

    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.utilities.sputility.sendemail.aspx


    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, July 30, 2013 5:32 AM
    Moderator