Hello, a script notifies our marketing department about low balance:
function main() {
var bgt = AdsApp.budgetOrders().get().next();
var usr = AdsApp.currentAccount();
var adjust = bgt.getTotalAdjustments(); /* Crashes here. */
var limit = bgt.getSpendingLimit();
var total = usr.getStatsFor("ALL_TIME").getCost();
console.log(limit - adjust - total); /* UrlFetchApp.fetch query in reality. */
}
Unless I stub adjust = 0, it fails:
SystemError: Could not read from Google Ads
(Internal details: Missing field accountBudget.totalAdjustmentsMicros
in object {"accountBudget": {
"resourceName": "customers/.../accountBudgets/...",
"status": "APPROVED",
...
"approvedStartDateTime": "2017-...",
...
}})
at g (adsapp_compiled:264:50)
at Ws.getTotalAdjustments (adsapp_compiled:8095:9)
at Object.<anonymous> (adsapp_compiled:15958:46)
How to fix?