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,862 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 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

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…
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…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

691 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