Smart Campaign ad_optimized_business_profile_setting throws FIELD_HAS_SUBFIELDS

80 views
Skip to first unread message

Oktay Donmez

unread,
May 11, 2023, 7:08:26 AM5/11/23
to Google Ads API and AdWords API Forum

I’m trying to create smart campaign without final_url. When I set ad_optimized_business_profile_setting like below it throws FIELD_HAS_SUBFIELDS error.

m.smart_campaign_setting_operation = client.operation.update_resource.smart_campaign_setting(client.path.smart_campaign_setting(customer_id, SMART_CAMPAIGN_TEMPORARY_ID)) do |scs|
scs.phone_number = client.resource.phone_number do |p|
p.country_code = COUNTRY_CODE
p.phone_number = PHONE_NUMBER
end
scs.advertising_language_code = LANGUAGE_CODE
scs.business_profile_location = business_profile_location
scs.ad_optimized_business_profile_setting = client.resource.ad_optimized_business_profile_setting do |s|
s.include_lead_form = false
end
end

If I set include_lead_form as true it returns success. I also tried:

scs.ad_optimized_business_profile_setting = client.resource.ad_optimized_business_profile_setting

Error with message: The field mask updated a field with subfields: 'ad_optimized_business_profile_setting'.
        On field: mutate_operations
        On field: smart_campaign_setting_operation
        Type: field_mask_error
        Code: FIELD_HAS_SUBFIELDS

Google Ads API Forum Advisor

unread,
May 11, 2023, 12:59:56 PM5/11/23
to oktayd...@gmail.com, adwor...@googlegroups.com

Hi Oktay,

Thank you for reaching out to us.

With regard to the error you've encountered, the "FIELD_HAS_SUBFIELDS" means that the field mask updated a field with subfields. Fields with subfields may be cleared, but not updated. To fix this, the field mask should select all the subfields of the invalid field. Upon further checking, I've seen this documentation for Field Masks (https://developers.google.com/google-ads/api/docs/client-libs/ruby/field-masks), which has explained and has an example of how to avoid this error (https://developers.google.com/google-ads/api/docs/client-libs/ruby/field-masks#message_fields_with_defined_subfields). Kindly check it and try it on your end.

Regards,

Google Logo Google Ads API Team


ref:_00D1U1174p._5004Q2lGto8:ref

Oktay Donmez

unread,
May 12, 2023, 3:08:51 AM5/12/23
to Google Ads API and AdWords API Forum
I tried with adding subfields to field mask manually but still getting same error.

Request ID: 7vWv2ujN4BNJB0GVLIE7AA

Mutate request:

client.operation.mutate do |m|
m.smart_campaign_setting_operation =
client.operation.update_resource.smart_campaign_setting(client.path.smart_campaign_setting(customer_id, SMART_CAMPAIGN_TEMPORARY_ID)) do |scs|
scs.phone_number = client.resource.phone_number do |p|
p.country_code = COUNTRY_CODE
p.phone_number = PHONE_NUMBER
end
scs.advertising_language_code = LANGUAGE_CODE
scs.business_profile_location = business_profile_location
scs.ad_optimized_business_profile_setting = client.resource.ad_optimized_business_profile_setting
end
m.smart_campaign_setting_operation.update_mask.paths << "ad_optimized_business_profile_setting.include_lead_form"
end

Update mask:

<Google::Protobuf::FieldMask: paths: ["phone_number.phone_number", "phone_number.country_code", "advertising_language_code", "ad_optimized_business_profile_setting", "business_profile_location", "ad_optimized_business_profile_setting.include_lead_form"]>

11 Mayıs 2023 Perşembe tarihinde saat 19:59:56 UTC+3 itibarıyla Google Ads API Forum Advisor şunları yazdı:

Google Ads API Forum Advisor

unread,
May 12, 2023, 8:24:27 AM5/12/23
to oktayd...@gmail.com, adwor...@googlegroups.com
Hi Oktay,

Thank you for getting back to us.

For us to further investigate this issue, could you provide the complete request and response logs with request ID and request header generated on your end? You can provide it via Reply privately to the author option. If this option is not available, then send it instead on this email address googleadsa...@google.com. If you haven't enabled the logging yet, logging can be enabled by following the guide in this link https://developers.google.com/google-ads/api/docs/client-libs/ruby/logging.

Reference links:
Kind regards,
Reply all
Reply to author
Forward
0 new messages