Solved

Is there a way to find the difference between two dates using workflows in MS CRM 4.0?

Posted on 2009-05-15
4
1,778 Views
Last Modified: 2012-05-07
I need to find out the difference between to dates and post that info to a new field.

Example:  I create a case and the creation date and time is stamped.  The modified date and time is updated whenever the case is edited.  I would like to calculate the time difference between the creation and modified in days, hours, minutes.

I would ideally like to use this is a workflow, but if it can be done with a java scripts in the onchange event that is doable as well.
0
Comment
Question by:mcrman
  • 2
  • 2
4 Comments
 
LVL 11

Expert Comment

by:rakeshAgarwal
ID: 24421919
Hi

 You have to write  custom assembly for this.  if you want to do it in work flow. My recomendation  you should do this  by javascript . on save event

You have to get this both the field on the form in crm

 I have not tested this javascript
var createdTime = crmForm.createdon.DataValue
var modifiedTime = crmForm.modifiedon.DataValue

crmForm.<<newfield>>.DataValue = modifiedTime -createdTime

Just try above code hope that helps
reakesh
0
 
LVL 1

Author Comment

by:mcrman
ID: 24422156
If the new Field is a DATE field, and I belive it would be then this would result in the time since 01/01/1900

For example Created on is 05/10/2009 11:00am and the modifed on is 05/15/2009 12:00pm Using you formula above would result in a date time of 01/06/1900 1:00am

What i really want is 5 Days, 1 Hour.

I think I may be able to do this better in an SQL script that runs nightly.  I could perfomr all the calculation needed to get this data.

Ill post what I find and if you have any other ideas let me know.
0
 
LVL 11

Assisted Solution

by:rakeshAgarwal
rakeshAgarwal earned 250 total points
ID: 24440628
0
 
LVL 1

Accepted Solution

by:
mcrman earned 0 total points
ID: 26080791
Instead of directly executing a script against the SQL database I had a custom plugin created to calculate the day, hour, min difference between to date variables.

This way I can use workflows to perform and store these calculations
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

On Sep 22nd 2014 Microsoft released Update Rollup 1 for Microsoft Dynamics CRM 2013 Service Pack 1 and back in July Update Rollup 3 was released.  So we now have:   Update Rollup 1Update Rollup 2Update Rollup 3Service Pack 1Update Rollup 1 for S…
For cloud, the “train has left the station” and in the Microsoft ERP & CRM world, that means the next generation of enterprise software from Microsoft is here: Dynamics 365 is Microsoft’s new integrated business solution that unifies CRM and ERP fun…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

757 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

19 Experts available now in Live!

Get 1:1 Help Now