?
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
Medium Priority
?
1,883 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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.
Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

743 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