locked
Calculated field in CRM View RRS feed

  • Question

  • Hi ,

    I have a date/time attribute in an entity. I would like to split the value into date and time and show them in two columns in the default view of the entity. Could some one tell me if this is achievable in CRM 4.0 ?  Thanks a lot.
    Tuesday, October 20, 2009 10:13 PM

Answers

  • This could be done with a plugin on the Execute (Fetch) message. This will fire whenever data is reutnred for a view, and you can manipulate the data returned to the client as a ResultXml string.

    However, it is probably easier to develop a plugin on the create and update messages that splits the date time value into 2 fields whenever the data is modified
    Microsoft CRM MVP - http://mscrmuk.blogspot.com  http://www.excitation.co.uk
    Wednesday, October 21, 2009 6:28 AM
    Moderator
  • my suggestion to create two new fields in CRM...(may be string type)......

    then put the javascript code on save to populated these two fields (one with date and other with date) from source date field..

    following URL will helps you write javascript code for this..

    http://javascript.internet.com/time-date/date-time-long.html

    now add these two fields in view...
    Wednesday, October 21, 2009 7:59 AM

All replies

  • This could be done with a plugin on the Execute (Fetch) message. This will fire whenever data is reutnred for a view, and you can manipulate the data returned to the client as a ResultXml string.

    However, it is probably easier to develop a plugin on the create and update messages that splits the date time value into 2 fields whenever the data is modified
    Microsoft CRM MVP - http://mscrmuk.blogspot.com  http://www.excitation.co.uk
    Wednesday, October 21, 2009 6:28 AM
    Moderator
  • my suggestion to create two new fields in CRM...(may be string type)......

    then put the javascript code on save to populated these two fields (one with date and other with date) from source date field..

    following URL will helps you write javascript code for this..

    http://javascript.internet.com/time-date/date-time-long.html

    now add these two fields in view...
    Wednesday, October 21, 2009 7:59 AM
  • Thanks, David and Mayank. I was actually thinking in the lines of Mayank's suggestion but wanted to be sure that there is no way of getting it done through customizations. Thank you, friends!
    Wednesday, October 21, 2009 4:29 PM
  • "This could be done with a plugin on the Execute (Fetch) message. This will fire whenever data is reutnred for a view, and you can manipulate the data returned to the client as a ResultXml string." Do you have an example of how to set this up? I need to add a calculated column to the opportunity views (we store a field for ownership begin date and need to display in the view the total number of days owned, so I basically need to do a day datediff on the stored value and the current date and display the integer result). Thanks for any assistance you can provide.
    Wednesday, June 23, 2010 4:55 PM