locked
On saved form RRS feed

  • Question

  • hi all,
    i have a form which has the folowing attributes : { new_startdate , new_enddate , new_delaydays}
    i need to do this scenario:
    once i set start date and delay days values i need  the end date attribute to set value  automaticlly
    i put this js code in on save form event
    crmForm.all.new_enddate.DataValue = crmForm.all.new_startdate.DataValue+ crmForm.all.new_delaydays.DataValue ;
    but i have tha folowing error "object does not support this propriety or method"

    foreach(object HeartBeat in me.heart.Beats) messageBox.show("I miss u !!")
    Sunday, July 19, 2009 8:15 AM

Answers

  • Hi Dany,

    You can not directly add dates in this manner.

    Here is a rough script, that should help you.

    var startDate = new Date(crmForm.all.new_startdate.DataValue);
    startDate.setDate(startDate.getDate() + crmForm.all.new_delaydays.DataValue);
    crmForm.all.new_enddate.DataValue =  startDate;

    I haven't tried this in a CRM environment, but this is how it should go, minor changes in syntax might be needed.
    Regards,
    Chinmay
    http://metrix.blogspot.com
    • Proposed as answer by Chinmay Patel Sunday, July 19, 2009 8:47 AM
    • Marked as answer by Dany85 Sunday, July 19, 2009 8:59 AM
    Sunday, July 19, 2009 8:47 AM

All replies

  • Hi Dany,

    You can not directly add dates in this manner.

    Here is a rough script, that should help you.

    var startDate = new Date(crmForm.all.new_startdate.DataValue);
    startDate.setDate(startDate.getDate() + crmForm.all.new_delaydays.DataValue);
    crmForm.all.new_enddate.DataValue =  startDate;

    I haven't tried this in a CRM environment, but this is how it should go, minor changes in syntax might be needed.
    Regards,
    Chinmay
    http://metrix.blogspot.com
    • Proposed as answer by Chinmay Patel Sunday, July 19, 2009 8:47 AM
    • Marked as answer by Dany85 Sunday, July 19, 2009 8:59 AM
    Sunday, July 19, 2009 8:47 AM
  • thanks Chinmay..
    foreach(object HeartBeat in me.heart.Beats) messageBox.show("I miss u !!")
    Sunday, July 19, 2009 8:59 AM