API Forum

This forum is in read-only mode.
Please refer to our API support in case you have any questions.
We can be reached at api@e-conomic.com
e-conomic API developer forum

The 'id' attribute is not declared. {id=552429879}

0
Hello,

When I am tring to create Invoice Line using CurrentInvoiceLine_CreateFromDataArray function. I am getting error message like shown in below.

createInvoiceLine:Economic.Api.Exceptions.SchemaException(E00500): The 'id' attribute is not declared. {id=552429879}

Using same data with function CurrentInvoiceLine_CreateFromData , I am not getting any problem. I am just passing single object instead of array.

Here are my code example,

function createInvoiceLine($d){

        $order_item_id = $d 'order_item_id';
        $invoiceHandle = new stdclass();
        $invoiceHandle-Id = $d'invoiceHandle';

        $Handle = new stdclass();
        $Handle-Id = $d'invoiceHandle';
        $Handle-Number = $order_item_id;

        $UnitHandle = $this-getUnitGroup();

        $ProductHandle = new stdclass();
        $ProductHandle-Number = $d 'product_number';

        $info = array
        (
                'Handle' = $Handle,
                'InvoiceHandle' = $invoiceHandle,
                'Number' = $order_item_id,
                'Id' = $d'invoiceHandle',
                'Description' = $d 'product_name',
                'DeliveryDate' = $d 'delivery_date',
                'UnitHandle' = $UnitHandle,
                'ProductHandle' = $ProductHandle,
                'UnitNetPrice' = $d'product_price',
                'Quantity' = $d'product_quantity',
                'DiscountAsPercent' = 0,
                'UnitCostPrice' = $d'product_price',
                'TotalMargin' = $d'product_price',
                'TotalNetAmount' = $d'product_price',
                'MarginAsPercent' = 1
        );

        $this-createInvoiceLineArray = $info;

    }
    function createInvoiceLineArray(){
        try
        {
            $info = $this-createInvoiceLineArray;          
            $invoiceLineNumber = $this-client-CurrentInvoiceLine_CreateFromDataArray ( array ('dataArray' = $info ) );
            return $invoiceLineNumber;
        }
        catch ( Exception $exception )
        {           
            print_r($exception);        
            exit;
        }
    }

Does anyone get this kind of same problem during development?
created Jul 20, 2012 by gunjanpatel
0% Accept Rate
Q 2 A 2 C 0

Visma e-conomic A/S
...