Skip to content

Conversation

@jordanwalsh23
Copy link
Contributor

Add support for multi item push using the following code:

       var sampleItem = {
            Code: 'Item-' + Math.random(),
            Name: 'Fully Tracked Item',
            Description: '2014 Merino Sweater',
            PurchaseDescription: '2014 Merino Sweater',
            PurchaseDetails: {
                UnitPrice: 149.00,
                AccountCode: salesAccount
            },
            SalesDetails: {
                UnitPrice: 299.00,
                AccountCode: salesAccount
            }
        };            
            
            var items = [];

            for (var i = 0; i < 10; i++) {
                sampleItem.Code = 'Item-' + Math.random();
                items.push(currentApp.core.items.newItem(sampleItem));
            }

            currentApp.core.items.saveItems(items)
                .then(function(response) {
                    expect(response.entities).to.have.length.greaterThan(9);
                    done();
                })
                .catch(function(err) {
                    done(wrapError(err));
                })

@jordanwalsh23 jordanwalsh23 merged commit bd81184 into XeroAPI:master Jun 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant