This is the top-level object used in multi-account scripts to get the list of accounts the user has access to and to select the account to manage. After getting the account, use the BingAdsApp object to access its entities.
This object is available for scripts run from the Scripts editor accessed from Accounts Summary in the Bing Ads web application.
|Method Name||Return Type||Description|
|accounts||BingAdsAccountSelector||Gets a selector used to filter the list of accounts the user has access to.|
|select(BingAdsAccount account)||void||Selects the account to process in the script.|
Gets a selector used to filter the list of accounts the user has access to.
|BingAdsAccountSelector||A selector used to filter the list of accounts the user has access to.|
Selects the account to process in the script.
The following example shows how to change the current account that the script is processing with another account.
// Get the account that the script is currently processing. var oldAccount = BingAdsApp.currentAccount(); // Get another account that the user manages. var newAccount = AccountsApp.accounts() .withIds(["123456789"]) .get() .next(); // Make the new account the current account that the script processes. AccountsApp.select(newAccount); // Do something with the new account // Change the current account back to the old account AccountsApp.select(oldAccount);
|account||BingAdsAccount||The account to process in the script.|