Campaign addLocation failing with INCONSISTENT_FIELD_VALUES

65 views
Skip to first unread message

Noah Pluimers

unread,
Sep 27, 2022, 10:14:17 AM9/27/22
to Google Ads Scripts Forum
Hi,

We are trying to update our scripts to the new Google Ads Scripts, and are having trouble assigning locations to our campaign by code

For example:
      var result = campaign.addLocation({
        id: 9064172
      });
      if(!result.isSuccessful()) {
        Logger.log('ERROR adding '+ 9063927 +' : ' + result.getErrors().join(', '));
      }

Results in the following error:

ERROR adding 9064172 : The field's contents don't match another field that represents the same data. ({"errorCode":{"mutateError":"INCONSISTENT_FIELD_VALUES"},"message":"The field's contents don't match another field that represents the same data.","location":{"fieldPathElements":[{"fieldName":"mutate_operations","index":0},{"fieldName":"campaign_criterion_operation"},{"fieldName":"create"},{"fieldName":"resource_name"}]}})

Anybody see this error before?

Thanks, and kind regards,

Noah Pluimers

Martijn Kraan

unread,
Sep 27, 2022, 4:35:54 PM9/27/22
to Google Ads Scripts Forum
Hi Noah,

I'm not from the official Google Ads Scripts Support team, but there are multiple methods for adding a location. Maybe you can try one of the other ones?
See https://developers.google.com/google-ads/scripts/docs/reference/adsapp/adsapp_campaign#addLocation_1
See the example code below:

--------------

function main() {

    var campaign = AdsApp
        .campaigns()
        .withIds([980722014])
        .get()
        .next();

    campaign.addLocation(1010543, 1.15);
}


------------

  • 1010543 = Amsterdam
  • The 1.15 = bid modifier (in this case 15%)

Good luck!
Martijn

Noah Pluimers

unread,
Sep 29, 2022, 3:38:34 AM9/29/22
to Google Ads Scripts Forum
Hi Martijn,

Thanks for your reply! We have tried a number of these functions, and then noticed this https://groups.google.com/g/adwords-scripts/c/WK3GouFU7EU/m/rxkjf8cyDAAJ message in these boards. After reading this we tried running a 'execute' task on our script, and that all worked without errors!

Thanks for the help!
Noah

Op dinsdag 27 september 2022 om 22:35:54 UTC+2 schreef Martijn Kraan:

Martijn Kraan

unread,
Sep 29, 2022, 3:42:48 AM9/29/22
to Google Ads Scripts Forum
Ah yes, that's a bug indeed in Google Ads Scripts: previewing results in an error, but executing the script works fine.
Maybe the Google Ads Scripts Team can bump this one in their backlog 😇?

Google Ads Scripts Forum

unread,
Nov 2, 2022, 10:24:40 PM11/2/22
to Google Ads Scripts Forum
Reposting the last inquiry (https://groups.google.com/g/adwords-scripts/c/efI4lkucZuc) from the forum as it wasn't routed to our support queue.

Regards,
Yasmin
Google Ads Scripts Team

Google Ads Scripts Forum Advisor

unread,
Nov 3, 2022, 3:15:18 AM11/3/22
to adwords...@googlegroups.com

Hi All,

 

This is Yasmin from the Google Ads scripts team. Please excuse us as forum messages fail to be routed to our support queue.

 

Just circling back here, could you please confirm if you are still encountering this error? I believe that the issue INCONSISTENT_FIELD_VALUES with regard to the addLocation function has been fixed. If you are still encountering an issue on your end, kindly provide the following information so we can further investigate and assist you accordingly:

  • Google Ads account ID or CID
  • Script name
  • Shareable link of your spreadsheet, if applicable. (Please check this guide under Share a file publicly)

 

You may send them via `Reply privately to author` option. If the said option is not available on your end, you may send those through the email alias `googleadsscr...@google.com` instead.

 

Regards,

 

Google Logo
Yasmin Gabrielle
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2fzarQ:ref
Reply all
Reply to author
Forward
0 new messages