Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
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,931 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

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…
Desired Skill Set for Microsoft Dynamics CRM Technical Resources – Part III
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

604 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