You need to sign in to do that
Don't have an account?

select picklist values
Hi,
my custom field Restaurant__c is defined as a picklist.
I want to read the values of the list in my execute part of my code.
how does the best?
global Database.QueryLocator start(Database.BatchableContext BC)
{
Date d = Date.today();
String query = 'SELECT Account__c,Lieferkosten__c,Preis__c,Restaurant__c,Kunde__c FROM Order__c WHERE DatumZeit__c < :d';
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC, List<Sobject> scope)
{ .....
my custom field Restaurant__c is defined as a picklist.
I want to read the values of the list in my execute part of my code.
how does the best?
global Database.QueryLocator start(Database.BatchableContext BC)
{
Date d = Date.today();
String query = 'SELECT Account__c,Lieferkosten__c,Preis__c,Restaurant__c,Kunde__c FROM Order__c WHERE DatumZeit__c < :d';
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC, List<Sobject> scope)
{ .....
value1;value2;value3
Either way, refernce the field in your query and object like normal.
String query = 'SELECT Account__c,Lieferkosten__c,Preis__c,Restaurant__c,Kunde__c,customfield__c FROM Order__c WHERE DatumZeit__c < :d';
I have a custom field declared as a picklist.
I want to use the stored in the picklist values in my batch script.
Is there a way to retrieve these values from the picklist
http://blogs.developerforce.com/developer-relations/2008/12/using-the-metadata-api-to-retrieve-picklist-values.html
Its a bit dated (2008) but still holds true. Instead of putting your values into a List<SelectOption> you just want them to store possibly in a set<string> or list<string>, etc to be used as needed.