-
Notifications
You must be signed in to change notification settings - Fork 162
How to update Tracking Category Options
Phil Alsford edited this page Apr 16, 2018
·
1 revision
Below is a script got updating Tracking Category options.
The call to update requires the updated option as well as a second arg that contains the TrackingCategotyID and the OptionID
import { AccountingAPIClient } from '../AccountingAPIClient';
import { getPrivateConfig } from './helpers/integration.helpers';
import { InvoicesResponse } from '../AccountingAPI-responses';
(async () => {
let xero: AccountingAPIClient;
const config = getPrivateConfig();
xero = new AccountingAPIClient(config);
const allCats = await xero.trackingCategories.get();
const firstCat = allCats.TrackingCategories[0];
const updatedOption = allCats.TrackingCategories[0].Options[0];
updatedOption.Name = 'New Name';
const updateRes = await xero.trackingCategories.trackingOptions.update(updatedOption,
{
TrackingCategoryID: firstCat.TrackingCategoryID,
TrackingOptionID: updatedOption.TrackingOptionID,
});
console.log('updateRes: ', updateRes);
})();