CRM late bound web service RRS feed

  • Question

  • Hi,

    I am creating a web service that creates accounts & opportunities in CRM.
    creating an opportunity with "normal" text fields works fine.

    But, i want to populate the field "parentaccountid", but this doesnt works...

    problem is, the opportunity is created but the field parentaccount is blank ...

    Right now, i am doing it this way:

    accountguid = ac["accountid"].ToString()

    opportunityId = service.Create(opportunity);

    Could someone help me with this? thanks!

    Monday, June 29, 2015 3:54 PM


All replies

  • opportunity["parentaccountid"] = new EntityReference("account", accountId);

    where accountId is the Guid of the account record.

    My blog: www.crmanswers.net - CRM Theme Generator

    Monday, June 29, 2015 4:04 PM
  • Thank you.
    Tuesday, June 30, 2015 6:27 AM
  • Could you also say how i can set a option set field in CRM?

    Right now i tried something like this:

     opportunity.Attributes["purchaseprocess"] = new OptionSetValue(varpurchase));

    The field purchaseprocess has 3 choices (committee, individual, unknown).
    Do i first need to retrieve the option set value? how can i do this?


    Wednesday, July 8, 2015 2:55 PM
  • optionsets need the numeric value

     opportunity["purchaseprocess"] = new OptionSetValue(0);
    so you need to check under customization of the field the numeric values of your 3 choices

    My blog: www.crmanswers.net - CRM Theme Generator

    Wednesday, July 8, 2015 3:08 PM
  • Okay & thanks for the fast responses!

    But what if these values changes? Then do I need to modify the code?

    Wednesday, July 8, 2015 3:12 PM
  • if the numeric values change yes, if just the label (text) change no

    My blog: www.crmanswers.net - CRM Theme Generator

    Wednesday, July 8, 2015 3:29 PM