AdsApp.DraftBuilder
Stay organized with collections
Save and categorize content based on your preferences.
Builder for Draft
objects. Example usage:
//
Create
a
draft
builder
.
var
draftBuilder
=
AdsApp
.
campaigns
()
.
get
()
.
next
()
.
newDraftBuilder
();
//
Create
a
draft
operation
.
var
draftOperation
=
draftBuilder
.
withName
(
"Sample Draft"
)
//
required
.
build
();
//
Optional
:
examine
the
outcome
.
The
call
to
isSuccessful
()
//
will
block
until
the
operation
completes
.
if
(
draftOperation
.
isSuccessful
())
{
//
Get
the
result
.
var
draft
=
draftOperation
.
getResult
();
}
else
{
//
Handle
the
errors
.
var
errors
=
draftOperation
.
getErrors
();
}
Methods:
build()
Creates a Draft
. Returns a DraftOperation
that can be used to get the new Draft (or access any associated errors if
creation failed). Return values:
withName(name)
Sets the name of the new draft to the specified value. Required before
building. Arguments:
Return values:
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-09-03 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-03 UTC."],[[["\u003cp\u003eEnables the creation and management of drafts for Google Ads campaigns.\u003c/p\u003e\n"],["\u003cp\u003eRequires setting a draft name using \u003ccode\u003ewithName()\u003c/code\u003e before building.\u003c/p\u003e\n"],["\u003cp\u003eProvides a \u003ccode\u003ebuild()\u003c/code\u003e method to create the draft and returns a DraftOperation for accessing the result or any errors.\u003c/p\u003e\n"],["\u003cp\u003eDraftOperation can be examined using \u003ccode\u003eisSuccessful()\u003c/code\u003e to determine if the operation succeeded and to retrieve the draft or errors.\u003c/p\u003e\n"]]],[],null,["# AdsApp.DraftBuilder\n\nBuilder for [Draft](/google-ads/scripts/docs/reference/adsapp/adsapp_draft) objects.\n\nExample usage:\n\n```gdscript\n// Create a draft builder.\nvar draftBuilder = AdsApp.campaigns().get().next().newDraftBuilder();\n\n// Create a draft operation.\nvar draftOperation = draftBuilder\n .withName(\"Sample Draft\") // required\n .build();\n\n// Optional: examine the outcome. The call to isSuccessful()\n// will block until the operation completes.\nif (draftOperation.isSuccessful()) {\n // Get the result.\n var draft = draftOperation.getResult();\n} else {\n // Handle the errors.\n var errors = draftOperation.getErrors();\n}\n```\n\n### Methods:\n\n| Member | Type | Description |\n|----------------------------------|------------------------------------------------------------------------------------------|----------------------------------------------------------------------------|\n| [build()](#build) | [AdsApp.DraftOperation](/google-ads/scripts/docs/reference/adsapp/adsapp_draftoperation) | Creates a [Draft](/google-ads/scripts/docs/reference/adsapp/adsapp_draft). |\n| [withName(name)](#withName_name) | [AdsApp.DraftBuilder](/google-ads/scripts/docs/reference/adsapp/adsapp_draftbuilder) | Sets the name of the new draft to the specified value. |\n\n`build()`\n---------\n\nCreates a [Draft](/google-ads/scripts/docs/reference/adsapp/adsapp_draft). Returns a DraftOperation that can be used to get the new Draft (or access any associated errors if creation failed).\n\n### Return values:\n\n| Type | Description |\n|------------------------------------------------------------------------------------------|---------------------------------|\n| [AdsApp.DraftOperation](/google-ads/scripts/docs/reference/adsapp/adsapp_draftoperation) | The associated Draft operation. |\n\n`withName(name)`\n----------------\n\nSets the name of the new draft to the specified value. Required before building.\n\n### Arguments:\n\n| Name | Type | Description |\n|------|----------|-------------|\n| name | `String` | Draft name. |\n\n### Return values:\n\n| Type | Description |\n|--------------------------------------------------------------------------------------|----------------------------------------|\n| [AdsApp.DraftBuilder](/google-ads/scripts/docs/reference/adsapp/adsapp_draftbuilder) | Draft builder with the specified name. |"]]