Ajouter aux favorisYeturu Srikanth (bigworks) a posé une question dans #Apex21 mai 2020, 14:47what to write in anonymous block for this code to execute..? i am not getting please helpm me in thiscode public class AddPrimaryContact implements Queueable { private Contact s; private String State; public AddPrimaryContact(Contact s, String State) { this.s = s; this.state = State; } public void execute(QueueableContext context) { List<Account> ListAccount = [SELECT ID, Name ,(Select id,FirstName,LastName from contacts ) FROM ACCOUNT WHERE BillingState = :state LIMIT 200]; List<contact> con = new List<Contact>(); for(Account acc: ListAccount) { Contact cont = s.clone(false,false,false,false); cont.AccountId = acc.id; con.add( cont ); } insert con; }}what to wrire here in anonymous block ..?AddPrimaryContact obi = new AddPrimaryContact(s,usa);Database.executeBatch(obj); Afficher plus3 réponsesTriTrier par dateTrier par ordre d’utilitéTrier par dateChargement de commentaires supplémentaires...agustin blanco (Salesforce)21 mai 2020, 15:14yes, you need to also create the contact and the state, for exampleSystem.enqueueJob(new AddPrimaryContact(new Contact(LastName='test'),'usa'));if it helps please like or mark as correct, it may help othersAjouter un commentaireRédiger une réponse...GrasItaliqueSoulignerBarréListe à pucesListe numérotéeAjouter un lienBloc de codeInsérer une imageJoindre des fichiersURL du lienAnnulerEnregistrer0/9000Répondre
agustin blanco (Salesforce)21 mai 2020, 15:14yes, you need to also create the contact and the state, for exampleSystem.enqueueJob(new AddPrimaryContact(new Contact(LastName='test'),'usa'));if it helps please like or mark as correct, it may help others