You need to sign in to do that
Don't have an account?
SFDC_BigDog
Queueable Apex: Error in Bulk Pattern SOQL for loop
public class AddPrimaryContact implements Queueable { Private Contact conl = new Contact(); Private String sty; Public List<Contact> coninsert = new List<Contact>(); public AddPrimaryContact(Contact conlist, String str) { this.conl = conlist; this.sty= str; } public void execute(QueueableContext context) { for(List<Account> acclist: [Select id,name from Account where BillingState =:sty]); { for(Account accops:acclist)// Error in this statement { conl.lastname = 'testLast'; conl.accountid = accops.id; coninsert.add(conl); } } if(coninsert.size()>0) { insert coninsert; } }}
I am trying Queueable Apex challenge in trial head. In the code I am getting an error in the for loop. Correct me if I am wrong in the below code.
Error: Variable does not exist: acclist
Thanks for help!
Please check below post for same issue
1) https://developer.salesforce.com/forums/?id=906F0000000DBndIAG
2)
Try to update your code like below Let us know if this will help you