locked
How can I update a single entity attribute ? RRS feed

  • Question

  • Hi,

    I have an existing CRM entity "contact" and I need to update that contacts phonenumber attribute only. The method "update" will update the whole attributes, so how i can just update the contacts "phonenumber" attribute alone ?

    Thanks a lot
    Wednesday, January 15, 2014 12:56 PM

Answers

  • Hi,

    Try this :

                   Entity _contact = new Entity("contact");
                   _contact.Id = GUID of the contact
                   _contact.Attributes["phonenumber"] = "1234567890";
                   _Service.Update(_contact);


    Hope this helps. If you get answer of your question, please mark the response as an answer and vote as helpful !!!
    Vikram Singh. !!!  My Blog

    • Marked as answer by SB User Wednesday, January 15, 2014 1:29 PM
    Wednesday, January 15, 2014 1:02 PM
  • hi, 

    If u want to update the phone no then u have to use fallowing code

    Entity contact= new Entity("contact");
                   contact.Id = Id(Id of contact)
                   contact.Attributes["phonenumber"] = "7887887";
                   Service.Update(contact);

    Please try this. I think it will work.

    Thanks

    Sangram


    microsoft blog


    • Marked as answer by SB User Wednesday, January 15, 2014 1:29 PM
    • Edited by Sangram.kb Wednesday, January 15, 2014 6:00 PM extra space
    Wednesday, January 15, 2014 1:20 PM

All replies

  • Hi,

    Try this :

                   Entity _contact = new Entity("contact");
                   _contact.Id = GUID of the contact
                   _contact.Attributes["phonenumber"] = "1234567890";
                   _Service.Update(_contact);


    Hope this helps. If you get answer of your question, please mark the response as an answer and vote as helpful !!!
    Vikram Singh. !!!  My Blog

    • Marked as answer by SB User Wednesday, January 15, 2014 1:29 PM
    Wednesday, January 15, 2014 1:02 PM
  • hi, 

    If u want to update the phone no then u have to use fallowing code

    Entity contact= new Entity("contact");
                   contact.Id = Id(Id of contact)
                   contact.Attributes["phonenumber"] = "7887887";
                   Service.Update(contact);

    Please try this. I think it will work.

    Thanks

    Sangram


    microsoft blog


    • Marked as answer by SB User Wednesday, January 15, 2014 1:29 PM
    • Edited by Sangram.kb Wednesday, January 15, 2014 6:00 PM extra space
    Wednesday, January 15, 2014 1:20 PM