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

Help to creating BatchApex
Hi All,
Can any one help for creating batch apex using below requiremet.
We have three fields in Accounts.Those are
1. "Type" equals "Fd Gov't","LL Gov't","ST Gov't"
2. " Entity" Flag equals False
3. "Structure" equals " Agency ".
If Type = "Fd Gov't","LL Gov't","ST Gov't" And "Structure" equals "Agency" then "Entity" Flag Should be "False".
Please help me to create a batch apex for above senario.
Thaks in Advance,
Can any one help for creating batch apex using below requiremet.
We have three fields in Accounts.Those are
1. "Type" equals "Fd Gov't","LL Gov't","ST Gov't"
2. " Entity" Flag equals False
3. "Structure" equals " Agency ".
If Type = "Fd Gov't","LL Gov't","ST Gov't" And "Structure" equals "Agency" then "Entity" Flag Should be "False".
Please help me to create a batch apex for above senario.
Thaks in Advance,
Here is the batch,
Please let me know if it helps.
Thanks for Help.But am facing one error like " line breaks not allowed in string literals at line 3 column -1".The problem is in SOQL .Can you please help me on that.
Thanks
Here is the corrected code,
With out error program was successfully saved.Before running the Batch i want to check the recodrs in workbench when i am trying same SOQL"
SELECT Id,Tpe__c,Entity__c,Structure__c FROM Account WHERE Tpe__c = (\'LL Gov\\\'t\',\'ST Gov\\\'t\',\'Fd Gov\\\'t\') AND Structure__c = 'Agency' AND Entity__c <> false' " Facing error like
"MALFORMED_QUERY: Structure__c FROM Account WHERE Tpe__c = (\'LL Gov\\\'t\',\'ST ^
ERROR at Row:1:Column:108 Bind variables only allowed in Apex code".
Can you please help me on this Issue.
Thanks for All your help
SELECT Id,Name,Type,Structure__c,Entity__c FROM Account WHERE Type IN ('Fd Gov\'t','LL Gov\'t','ST Gov\'t') AND Structure__c = 'Agency' AND Entity__c <> false
And also for the fields mentioned in query, uneed to replace the API names of the fields. I just appended __c to names u gave. For example,for Structure field, get the API name from Account fields list and replce it(in both above query and SOQL query in the batch).
Please select the above code as the best answer if it is the solution of ur issue, so thet it will help others also who r searching for the same issue.