locked
CRM 2011 Webservice - Date RRS feed

  • Question

  • Hello,

    I'm trying to create a new activity fax using crm webservice.
    How can I attribute a date :

    string DATE_CONTACT = "05/09/2012"
    otherActivity["scheduledend"] = DATE_CONTACT;

    This is not working.
     

     Entity otherActivity = new Entity("fax");
                    otherActivity["new_reference"] = REF_INTERNE;
                    otherActivity.Attributes.Add("new_category", new OptionSetValue(100000000));
                    otherActivity["scheduledend"] = DATE_CONTACT;
                    otherActivity["subcategory"] = TYPE;
                    otherActivity["new_contact"] = CONTACT;
    

    Thank you in advances


    Wednesday, September 5, 2012 6:43 AM

Answers

All replies

  • Use a DateTime object:

    Entity otherActivity = new Entity("fax");
    otherActivity["new_reference"] = REF_INTERNE;
    otherActivity.Attributes.Add("new_category", new OptionSetValue(100000000));
    otherActivity["scheduledend"] = new DateTime(2012, 9, 5);
    otherActivity["subcategory"] = TYPE;
    otherActivity["new_contact"] = CONTACT;



    --pogo (pat) @ pogo69.wordpress.com

    Wednesday, September 5, 2012 6:50 AM
  • Thank you for your reply.

    It's working for date scheduledend, but not for CreatedOn
    Message = "'fax' entity doesn't contain attribute with Name = 'CreatedOn'."

    Wednesday, September 5, 2012 7:16 AM
  • hi

    you can write "createdon" instead of "CreatedOn"

    Wednesday, September 5, 2012 7:30 AM
  • You're not permitted to set the createdon field, it's not valid for create or update. However, you can use overriddencreatedon instead

    Microsoft CRM MVP - http://mscrmuk.blogspot.com  http://www.excitation.co.uk


    Wednesday, September 5, 2012 7:56 AM
    Moderator