开发者

Add Opportunity Record with C#

I am trying to Create an Opportunity record from C# for CRM 2011. This is the code I am using:

Entity opportunity = new Entity("opportunity");

    opportunity["new_source"] = p.LeadOriginDetail;
    opportunity["opportunityratingcode"] = new OptionSetValue(3);
    opportunity["new_lead开发者_如何转开发status"] = new OptionSetValue(100000000);
    opportunity["statuscode"] = p.Type;

    opportunity["ownerid"] = "Lead Share";
    Guid opportunityId = orgService.Create(opportunity);

I keep getting this error "Customer not specified." How do you add Opportunity records. The same code works for adding records to Accounts.

Thanks!


Solved it.

Had to add:

opportunity["customerid"] = new EntityReference("account", accountId);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜