Using dates and times but accounting for weekends

Posted on 2009-04-29
Last Modified: 2012-06-27
I am using MS CRM 4.0 and have a few workflows on my case management.  One of them is for case exculation based upon case severity.  In essence after so many hours the case priority will be set to esculated.

This works fine but it does not take into account the non workable hours or days.  So if for example a level 4 case is set to esculate within 24 business hours.  If the case is created on Friday at 4pm (we close at 5pm) the case will esculate on Saturday. (Wew are closed on saturday)  The case should not count Saturday and sunday as time opened and the case should esculate on Monday at 4pm.

Is there any way to do what I need within the workflow?
Question by:mcrman
    LVL 10

    Accepted Solution

    The bad news is that this is not natively supported in MS CRM.
    The good news is that there is a free add on that will allow you to do this:
    Post back and let us know if it works.  I've not tried it myself.
    LVL 1

    Author Comment

    Thanks for the reply.  This does look like it will fit the bill.  I was wondering if you could help me further as I have not registed a plugin before.  I downloaded the PluginRegistration tool, and I get connected to the server and see the other plugin but when I try to register this one I get an error that says

    Unhandled Exception: System.ArgumentException: A BadImageFormatException has been thrown while parsing the signature. This is likely due to lack of a generic context. Ensure genericTypeArguments and genericMethodArguments are provided and contain enough context.
       at System.Reflection.Module.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
       at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, Module decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, RuntimeMethodHandle& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
       at System.Reflection.CustomAttribute.GetCustomAttributes(Module decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes)
       at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit)
       at PluginRegistrationTool.AssemblyReader.RetrievePluginsFromAssembly(String path)
       at PluginRegistrationTool.AssemblyReader.RetrievePluginsFromAssembly(String path)
       at PluginRegistrationTool.RegistrationHelper.RetrievePluginsFromAssembly(String pathToAssembly)
       at PluginRegistrationTool.PluginRegistrationForm.btnLoadAssembly_Click(Object sender, EventArgs e)
    Inner Exception: System.BadImageFormatException: Could not load file or assembly 'Microsoft.Crm.Sdk, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. An attempt was made to load a program with an incorrect format.
       at System.ModuleHandle.ResolveType(Int32 typeToken, RuntimeTypeHandle* typeInstArgs, Int32 typeInstCount, RuntimeTypeHandle* methodInstArgs, Int32 methodInstCount)
       at System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
       at System.Reflection.Module.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)

    Any thoughts?
    LVL 10

    Expert Comment

    Hmm, I'm not familiar with that error message and don't have time to do a lot of troubleshooting at the moment.  I'll try to come back to this later today or tomorrow when I can install it in a test environment.
    In the meantime, you may want to post your question on the blog that you downloaded the add-on from to see if the author can answer your question.  My hunch is that his plugin may not be compatible with your current CRM Update Rollup version.
    LVL 1

    Author Comment

    Well, a quick google search showed that it was VISTA and the 64bit OS causing this issue.  I ran the registration tool on the 2003 server and it had no issues working.

    I now seee the new workflow steps.  I will update this thread with my results.

    Thansk for the link.. :)
    LVL 1

    Author Comment

    The new routine do as described.  The look at the work days and wait and adjust accordingly.

    Now if I could get a routine that would do work hours as well. :)

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    This is a walkthrough guide I wrote whilst upgrading my on-premise MS Dynamics CRM 3.0 deployment to 4.0. This covers the actual installation of the product to a working level for my system, I ran into a lot of issues that the steps below fixed so h…
    Automatically creating a Trello card using data from a Microsoft Dynamics CRM record turned out to be an easy project that yielded great results.  Here's how I did this for an internal team at General Code.
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now