Schedule a Microsoft Dynamics CRM 4.0 Workflow - c#

I am in the process of puting together a custom workflow activity to be used in Microsoft Dynamics CRM 4.0
What I would like to ultimatly acheive is configure a workflow that runs on a schedueled basis i.e run every 2 hours Monday to Friday, rather than on a particular "CRM event" like create, delete status change ect.
Does anyone have any ideas?
Maybe schedule it outside of crm?
Edit 1:
What we are doing is processing rows in a staging table that gets generated from a front-end site. We are creating contact/account and opportunity records in CRM based on the data captured from the front-end.
The more I think about it the more I'm thinking that using workflow is possibly not the best solution?
What about a using a windows service?

Workflow was not best option for this situation due to the following:
Can't schedule it to run
The process can only be triggered by a CRM create, update or similar message
I went with a combination of the following:
A SQL CLR sproc that gets called on an UPDATE trigger on the staging table. The CLR sproc calls a webservice that generates CRM contacts/accounts. That way the front-end site can create records and set a "ready to process" flag once all data has been entered.
The requirement changed from a schedule solution to real time processing (well not ACTUALLY real time). The process needs to run as records are entered from the front end site.
Hope all that makes sense!

A windows workflow using the CRM webservices is one option, a better option would be to change your webform to access the CRM webservce adn enter the data directly.
if you really want to use workflows you can download a tool from http://www.patrickverbeeten.com/pages/TechnicalNet/MicrosoftCrm/PeriodicWorkflows.aspx?id=23 that you install on your CRM server and it allows you to use windows sheduled tasks to triger them.

Related

C# MVC Run controller code weekly

I have a controller that runs and gets data from a database and sends an email through to the client.
This email setting gets set in a form that is saved to a table with the email recipients. I need to run this on a schedule, which the user (client) defines in a form. Here the client can select either weekly, biweekly or monthly.
From here and after this is saved in the database, it is easy enough to pull from the database, but I need a way to run this every time at the time specified by the client (weekly, biweekly, or monthly). I was thinking of using a webjob (Azure) to do this but I am not sure how to approach this.
So
Are there any issues with this approach?
What are some of the other options?
Any recommendations?
Have you taken a look at solutions that are designed for this? Why re-invent the wheel?
Take a look at Hangfire.io
You can then just do the following:
BackgroundJob.Enqueue(BatchClient.Start());
Or you can add a Recurring job:
RecurringJob.AddOrUpdate(() => BatchClient.Start(), Cron.Daily);
There are also other options also worth investigating e.g. Quartz.Net
I don know if this is the best approach out there, but we use this in our company projects (exactly for sending scheduled emails):
We use Cron Expression to define frequency of an action that needs to be perfomed;
We use Quartz.NET to get the next date when this action should be performed;
For the checking the dates and running actions we are using a WCF service, running in a Windows Service on its own thread.
It might be to complex for your need, but it is pretty flexible. You have to decide where and how you store cron expressions and next dates. For the Cron Expression we use the DB next dates we keep in memory.

Is it possible to write a Windows service using .NET that will trigger a function if any changes have occured in my local Access DB

I have local Access database on my computer. The database is used by another application. I want to write a windows service using .net to send an sms when changes have occurred in the local Access database.
Not sure how complex the application is and how often data changes, but You could use FileSystemWatcher to detect the moment when Access Data file has changed, then use some simple logic to check if table of interest is updated, for example look at row count in simplest case.
there is no efficient way for the service to know if the database changed and know which are the changes, why not write a method in the other app to send the sms?
i'm assuming that the other application is developed by you, if that not the case, please give more context to your question so we can help you.
Another possible solution is to use Quartz.net to schedule a job that executes a job every n minutes and runs a query against the database to evaluate if records changed in specific table(s).
I have used TopShelf and Quartz.net to build similar solutions and it works reliably. Here is a good tutorial to get you started: https://prashantbrall.wordpress.com/tag/topshelf/

How do I edit a Business Objects schedule from their RESTful Web Service

I'm working with SAP Business Objects RESTful Web Services and I need to update an existing report. I can see a few pieces of information on what I want but not the whole picture.
In the user guide there is a section on updating properties and it lists those properties. It appears to be an exhaustive list. But what I need is not in there.
My end goal is to pause the report via web services as well as the ability to update items like the recurrance, report format or name of the report to name a few items.
What I'm looking at in the user guide seems to cover the name, but not the others.
What am I missing?
How do I update and/or pause a schedule after it has been created?
Alas, you cannot. The only actions that are available in the REST SDK regarding schedules for Web Intelligence are (up until BI 4.2 SP1):
Getting the list of schedules
Getting the details of a schedule
Adding a schedule
Deleting a schedule
If you want to update/pause schedules, then you'll need to resort to a different SDK (Java might be an option, although SAP is moving everything towards REST).
Another possibility is that you define these actions in your own application. E.g. updating a schedule could consist of:
Getting the details of a schedule
Deleting the schedule
Adding the schedule (with modifications of the original settings of course).

Offline Report genearation Service with Archive in .Net

I am trying to build a web application with large amount of transactions per day with the SQL server in the back end. So I want to generate the reports every day as a offline task and keep it ready in the server for a period of 7 days and then Archive these reports which are more than 7 days old. So I am looking at possible way to achieve this in C#.Net application. Is there a way i can generate these reports offline in some kind of service running in scheduler and display these reports on the web application when the user requests for the report.
I know that there are reporting services like crystal reports, SSRS. but i am not sure whether i will able to achieve my requirements with these.
Any insight would be of great help
Thnaks in advance
Nayan K
Depending on what sort of reporting you are after, this might be more of an SQL question. We do daily roll-ups of certain data to a table using stored procedures, storing the reporting information in tables. We also have vendor-supplied reporting for some of our stuff that generates and emails reports, as well as some of our transactional data loaded into a data warehouse with various reporting options, a couple of C# programs running from Task Scheduler on one of our servers... the list goes on.
Which model is best for you will depend on various factors, including what you personally prefer.
So the short answer is, yes, you can write a C# console application and run it from the Task Scheduler if that's what works for you.

Update External Systems from Dynamics CRM 2011

a bit new to Dynamics CRM and trying to find the best way to update external systems in real time when specific entities are created or updated in Dynamics CRM 4.0 or 2011. What I've gathered thus far is that my best option is to
Write a web service for the downstream LOB system.
Write a custom workflow activity that calls the web service and register the plugin inside CRM.
Attach the custom workflow activity to a record created / updated trigger on the underlying entity that I want to receive updates for.
Am I on the right track or is there a better alternative?
What you have seems a pretty sound design and is probably the way I would approach it.
If you need synchronous behaviour (not sure how real time your real time is here) you might want to consider plugins (different from custom workflow activities) as these can be registered to run synchronously.
Other than that you could have your downstream system read the records from CRM on a frequent, scheduled basis - you can use the modifiedon field to see which records have changed since the last read.

Categories