locked
Setting CRMDatetime in custom webservice RRS feed

  • Question

  • Hi Guys,

    I am writing custom webservice which is being called from CRM.

    I am passing xml string as paramater to this webmethod and trying to set date field programatically as shown in below code.

    I am also setting other attributes as well but somehow date field on form doesn't populate after service.(create) operation. rest of the attributes are populated correctly.

    ==================Code snippet================

    new_project  project = new new_project();

    CrmDateTime projectdate= new CrmDateTime();

    projectdate.date = actualdate; // 'actualdate' is passed as a string to this function.

    project.new_projecton = projectdate; //'new_projecton' is crm form field on project entity.


    // some other attributes are created here...

    service.create(project)

    =================== end of code ================================

     

    
    

     

     

    Any help is much appreciated.

    Thanks in advance.

     

     


    Thank you all for your help - CRM Thirsty
    Tuesday, January 18, 2011 6:17 AM

Answers

  • Try this

    projectdate.Value = actualdate

    And also make sure the date is in correct and convert it into mm/dd/yyyy or yyyy-mm-dd format


    • Marked as answer by CRM Thirsty Tuesday, February 15, 2011 5:20 AM
    Tuesday, January 18, 2011 6:23 AM

All replies

  • Try this

    projectdate.Value = actualdate

    And also make sure the date is in correct and convert it into mm/dd/yyyy or yyyy-mm-dd format


    • Marked as answer by CRM Thirsty Tuesday, February 15, 2011 5:20 AM
    Tuesday, January 18, 2011 6:23 AM
  • Hi,

     

    I strongly recommend you transform your string to a DateTime value, then convert this to a CrmDateTime object. This thread might help you: http://geekswithblogs.net/shauryaanand/archive/2007/07/27/114220.aspx


    Cornel Croitoriu - Senior Software Developer - http://bizforward.blogspot.com
    Wednesday, January 26, 2011 9:14 PM