Question Status

Verified
Dilip Gawas asked a question on 16 Mar 2015 4:28 AM

Hi ,

I am writing an exe to create opportunity.

I have written below code but is giving error "key not present in the dictionary"

Entity opportunity = new Entity("opportunity");

Guid custid = new Guid("38F17546-DDC7-E411-883E-005056C00008");
opportunity["customerid"] = new EntityReference("account", custid);

//create Opportunity record in crm
opportunityId = service.Create(opportunity);

Any help on this will be helpful

Thanks 

Dilip

Reply
Verified Answer
Mahendar Pal MVP responded on 16 Mar 2015 4:39 AM

Hello,

Is there any plugin associated with opportunity ?? try to set topic of your opportunity as well,

opportunity["name"]="Demo opporunity";

also it is better to write your code under try and catch block, and catch fault exception to get complete details error information.


Need help in CRM Contact US | Our Blog | Follow US | Like our Facebook Page | Our Book

Make sure to Vote as Helpful and  Mark As Answer ,if you get answer of your question.

Reply
Dilip Gawas responded on 16 Mar 2015 4:48 AM

Thanks mahender,

It was plugin that giving error. have disabled plugin and opportunity record got created.

Now will need to check plugin code.

Thanks   :)

Reply
Verified Answer
Mahendar Pal MVP responded on 16 Mar 2015 4:39 AM

Hello,

Is there any plugin associated with opportunity ?? try to set topic of your opportunity as well,

opportunity["name"]="Demo opporunity";

also it is better to write your code under try and catch block, and catch fault exception to get complete details error information.


Need help in CRM Contact US | Our Blog | Follow US | Like our Facebook Page | Our Book

Make sure to Vote as Helpful and  Mark As Answer ,if you get answer of your question.

Reply