user.getService(DfpService.V201302.CUSTOM_FIELD_SERVICE);
// Create statement to select only custom fields that apply to line items.
String statementText =
"WHERE entityType = :entityType LIMIT 500";
Statement filterStatement =
new StatementBuilder(statementText)
.putValue("entityType", CustomFieldEntityType.LINE_ITEM.toString())
.toStatement();
// Set defaults for page and offset.
CustomFieldPage page = new CustomFieldPage();
int offset = 0;
int i = 0;
List<Long> customFieldIds = new ArrayList<Long>();
do {
// Create a statement to page through custom fields.
filterStatement.setQuery(statementText + " OFFSET " + offset);
// Get custom fields by statement.
page = customFieldService.getCustomFieldsByStatement(filterStatement);
if (page.getResults() != null) {