web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

how to run a background job Daily ?

(0) ShareShare
ReportReport
Posted on by

i am using  Dynamics 365 CRM online V9.   i am developing a solution, it will call an external API to get data then push to  my CRM.  i want to run this job daily.

this solution will distribute to my clients.  i had thought to use workflow/plugin  to do this job  but i do not know how to get it triggered daily. 

can you help me?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Kokulan Profile Picture
    18,054 on at
    RE: how to run a background job Daily ?

    Hi

    You can create a workflow that waits until the specified time, executes the logic and then starts the waiting for next day and carries on like this but nowadays, flow is used more and more for this sort of recurring tasks.

    You can create the workflow in CRM, and create Custom Workflow Activities to talk to the external API and perform your logic in there

    And then call this workflow from a recurring flow

    community.dynamics.com/.../executing-dynamics-365-workflows-from-microsoft-flow

    The example in the link calls the workflow on a request action, but you can use Recurring action to run it on a recurring schedule basic

    docs.microsoft.com/.../run-scheduled-tasks

    If you do not like using flow or if you are not comfortable using flow, let me know I could provide more detail on how you can do this just using workflow in CRM

  • Community Member Profile Picture
    on at
    RE: how to run a background job Daily ?

    hi ,

    all this customization will be package into a solution and then   sell to my client.    MS Flow seems cannot be packaged.  it seems to require the clients to configure it using their own account.   that's not suitable.  

  • Suggested answer
    Kokulan Profile Picture
    18,054 on at
    RE: how to run a background job Daily ?

    You should be able to export the flow and let your customer import it

    social.technet.microsoft.com/.../51255.develop-and-deploy-microsoft-flow-applications.aspx

  • Community Member Profile Picture
    on at
    RE: how to run a background job Daily ?

    i  want to make a CRM solution and maybe  submit it into  app source.  my clients could install it with out  a lot of configuration/settings.  the solution will connect to my DB via an external API  then sync data  daily.     Even  MS flow could be exported but it cannot be included in the CRM solution, and  it need to set up 'connection'/authentication  etc.   i do not prefer to use it.

  • Suggested answer
    Kokulan Profile Picture
    18,054 on at
    RE: how to run a background job Daily ?

    right, ok yes it makes more sense to stick with CRM workflow as the flow will require extra steps to be followed by customers and there may be few hoops to jump through.

    Since you are planning for publishing on AppSource, better to plan a bit more robust approach for recurring workflows in CRM

    The following approach is more flexible in my view

    "Create an entity called “Task Schedule.” Include the relevant fields like owner/assigned to, next scheduled, subject, description, end date. Populate next scheduled with the first task instance due date, and end date with when the series should end.

    Create a workflow that runs on create of task schedule and on update of the next scheduled date:

    Wait condition timeout 1 minute after next scheduled.

    Check condition is workflow execution time less than end date.

    If so, create task setting due date to 1 week from next scheduled date and mapping the fields from the task schedule record.

    Update task schedule “next scheduled” with the due date from the task created in step 3.

    So yes, it can be done. The above approach could be expanded to handle different types of frequencies (monthly, semi-annually, etc)."

    [View:https://crmtipoftheday.com/1052/recurring-tasks-in-dynamics-365/#:750:50]

  • Community Member Profile Picture
    on at
    RE: how to run a background job Daily ?

    Hi,  i have some concepts  but     what are the following  steps:

    Wait condition timeout 1 minute after next scheduled.

    Check condition is workflow execution time less than end date.

    If so, create task setting due date to 1 week from next scheduled date and mapping the fields from the task schedule record.

    how to set them?

  • Community Member Profile Picture
    on at
    RE: how to run a background job Daily ?

    especially  Wait condition timeout 1 minute after next scheduled.

  • Suggested answer
    Sreevalli Profile Picture
    3,256 on at
    RE: how to run a background job Daily ?

    Hi,

    You can add one custom date field to store next schedule date (within same entity where you want to trigger workflow)

    Workflow triggers should be on create and update of new custom field(next trigger date)

    Then in the workflow steps,

    If next trigger is null, update it to modified on date( I.e current date)

    add a wait condition - timeout duration equals to next trigger

    Then update the current records next trigger to tomorrow (current +1) —-> this triggers another job and wait for tomorrow

    Then follow your logic

  • Suggested answer
    Kokulan Profile Picture
    18,054 on at
    RE: how to run a background job Daily ?

    Please see below

    Wait for condition timeout 1 minute after next scheduled. - This is just to make sure the date time check condition works all the time

    See below to know how you can timeout 1 minute after scheduled DateTime

    ScreenClip-_5B00_538_5D00_.png

    Check condition is workflow execution time less than the end date. - Since you have added extra minute, you can safely use Less than the condition 

    If so, create task setting due date to 1 week from next scheduled date and mapping the fields from the task schedule record.

    how to set them?

    Every session of your task is handled by one record in the scheduling entity. In your waiting workflow, once it executed the main logic, it should then create a record on the Scheduled task entity for the next iteration. When this record is created, the workflow will start and wait.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

#3
ED-30091530-0 Profile Picture

ED-30091530-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans