locked
How to create an invoice RRS feed

  • Question

  • I want to create an invoice, based upon a custom contract.

     

    Within a contract we have a lookup to an account, but the invoice class requires a Customer, not an account.

    I don't know how to get a customer, when I only know the contact.

     

    When I try the following code, I get an error message:

    Dim insCustomer As New srv_crm.Customer

    insCustomer.type = srv_crm.EntityName.account.ToString

    insCustomer.Value = insContract.iact_nwaccountid.Value

    Me.Log("insCustomer.Value: " & insContract.iact_nwaccountid.Value.ToString)

     

    Dim insInvoice As New srv_crm.invoice

    insInvoice.totalamount = monMaandbedrag

    insInvoice.totaltax = monTaxRate

    insInvoice.customerid = insCustomer

    <error>

    <code>0x8004022d</code>

    <description>The customer is invalid.</description>

    <type>Platform</type>

    </error>

     

    The customer does in fact exist. This way I cannot create an invoice programmaticaly...

     

    I call the code from a workflow.

     

    I am really stuck with this......

    Thursday, September 6, 2007 1:22 PM

Answers

  • Jean-Paul,

    The customer is either of an account or a contact (the contract entity has a customerid attribute, can you use this if its set?). Does insContract.iact_nwaccountid.Value relate to an existing account?

    You should probably also set the Price List and Name as well as they are both business required fields- although it didn't stop me creating the invoice when i ddin't set the.

    Alex

    Thursday, September 6, 2007 2:51 PM

All replies

  • Jean-Paul,

    The customer is either of an account or a contact (the contract entity has a customerid attribute, can you use this if its set?). Does insContract.iact_nwaccountid.Value relate to an existing account?

    You should probably also set the Price List and Name as well as they are both business required fields- although it didn't stop me creating the invoice when i ddin't set the.

    Alex

    Thursday, September 6, 2007 2:51 PM
  • insContract.iact_nwaccountid.value relates to an existing account, i double checked that.

    A contact also exists, but i do not use that field (yet).

     

    Perhaps there is some place this is (partially) explained?

    Friday, September 7, 2007 7:06 AM