Invoice CreatedByID

I am trying to use the API to obtain the CreatedByID on the Invoice object as follows:

        Guid id;            
        Invoice invoice = null;
        id = Guid.Parse(invoiceId);
        invoice = Invoice.GetInvoice(id, true);

        InvoiceObject io = new InvoiceObject();
        io.CreatedByID = invoice.CreatedByID;

I am not sure if I am missing something, but the CreatedByID will always return “00000000-0000-0000-0000-000000000000”.

I have looked at the front end and the database and there is a valid GUID for the creator.

Please advise.

Unfortunately it looks like you’ve found a bug in our API on the Invoice object. We’ll fix this, you’ll see it in the next public release. Until then, if you want to grab the user by name, you can use the list object (this is used in the UI).

            // Get all jobs
            StockingLocationList jobs = StockingLocationList.GetJobsites(false, JobTreeNodeDisplayType.Name, Guid.Empty);

            // Populate list with guid's of jobs
            List<Guid> locations = new List<Guid>();
            foreach (StockingLocationListItem job in jobs)

            // Fetch all invoices
            InvoiceList invoices = InvoiceList.GetInvoiceList(locations, InvoiceSyncStatus.All, InvoiceExportStatus.All, Guid.Empty);
            foreach (InvoiceListItem inv in invoices)
                System.Diagnostics.Debug.Print(inv.InvoiceNumber + " created by: " + inv.CreatedBy);