Let us built upon our previous example where we created a Hello World console application, hosted it as web job in Azure App Service and then scheduled it using Azure Scheduler.
Here we will basically update the code in Console Application to use CRM’s assemblies.
Just for simplicity we’d create a lead record in our app and then schedule it to run every 2 minute for total of 5 occurrences.
In real world, obviously, we’d have different scenarios like checking for the status of records and send mail every 24 hour or so, or delete records periodically etc.
We have added the required CRM assemblies
The code to create lead record.
Publishing the updated code.
Checking the logs.
Inside CRM it creates the lead record
Now let us re visit our Azure Job Scheduler, update the schedule to run 5 times with interval of 2 minutes.
Click on Run now to run the Job.
We can check the history of the Scheduler Job once it completes –
Logs of the Web Job –
5 Records created in CRM with interval of 2 minutes.
Hope it helps..