how to create invoice entity using plugin, ms crm 2011 ?


  • hi,

    im trying to create an "invoice" record using plugin. here is my code.

                    Entity newentity = new Entity("invoice");
                    newentity["name"] = "Something";

    im getting business process error.  when i use the same code to create account record, record is getting created.

    when i debug this plugin, getting exception because of last line (ie:, service.Create(newentity)).

    is it not possible to create "invoice" record using plugin.? 

    or is there any other way to create "invoice" record using plugin.? 

    any suggestions to create invoice record using plugin ?

    here is the error message.

    Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: An error occurred in the plug-in.Detail: 
    <OrganizationServiceFault xmlns:i="" xmlns="">
      <ErrorDetails xmlns:d2p1="">
          <d2p1:value xmlns:d4p1="" i:type="d4p1:string">0</d2p1:value>
      <Message>An error occurred in the plug-in.</Message>
      <InnerFault i:nil="true" />

    [Invoice: NewInvoice.MyPlugin]
    [10160e12-76ef-e111-b84a-000c2944d8a5: NewInvoice.MyPlugin: Update of new_entity]


    Sunday, August 26, 2012 12:48 PM

All replies

  • At the very least you also need to add a customer.

    newEntity["customerid"] = new EntityReference("account", new Guid("509A5DCE-BD56-E111-9BBC-000C29336979"));

    Jason Lattimer

    Monday, August 27, 2012 2:31 AM