public class IndependantContact {
public static void relateAccount(){
List<Contact> tobeupdated= new List<Contact>();
List<Contact> contactlist=[select id,name, accountid from contact where accountid=null ];
List<Account> acc=[select id, name from Account where Name='Edge Communications'];
for(Contact con :contactlist){
con.accountid=acc[0].id;
tobeupdated.add(con);
}
if(tobeupdated.size()>0)
update tobeupdated;
}
}
from anonomous window call this method as below.
IndependantContact.relateAccount();
This should relate the independent contacts with "Edge Communications" Account.
Let me know if you face any issues.
If this solution helps, Please mark it as best answer.
public class IndependantContact {
public static void relateAccount(){
List<Contact> tobeupdated= new List<Contact>();
List<Contact> contactlist=[select id,name, accountid from contact where accountid=null ];
List<Account> acc=[select id, name from Account where Name='Edge Communications'];
for(Contact con :contactlist){
con.accountid=acc[0].id;
tobeupdated.add(con);
}
if(tobeupdated.size()>0)
update tobeupdated;
}
}
from anonomous window call this method as below.
IndependantContact.relateAccount();
This should relate the independent contacts with "Edge Communications" Account.
Let me know if you face any issues.
If this solution helps, Please mark it as best answer.
One of the biggest issues with students is that they seek for urgent and custom essay writing services to complete their assignments. They enquire and look for "can someone do my essay for me" online. No longer, as we are available to answer all of your urgent do my essay requests. Get the most out of your money when you pay us to (https://royalbritishessaywriters.co.uk/write-my-essay-uk)essay help online (https://royalbritishessaywriters.co.uk/write-my-essay-uk) (https://royalbritishessaywriters.co.uk/write-my-essay-uk)because we have the top British essay writers who can provide an unique essay for a reasonable fee. Consequently, we provide a cost-effective alternative without charging exorbitant prices for custom essays. As we all know, excellent essay writing assistance combines originality and high-caliber writing. By quality, we imply the subsequent.
The apex class can be as below.
from anonomous window call this method as below.
This should relate the independent contacts with "Edge Communications" Account.
Let me know if you face any issues.
If this solution helps, Please mark it as best answer.
Thanks,
All Answers
The apex class can be as below.
from anonomous window call this method as below.
This should relate the independent contacts with "Edge Communications" Account.
Let me know if you face any issues.
If this solution helps, Please mark it as best answer.
Thanks,
Did you try the above code using apex class or do you need the code in anonomous block only?
Thanks,
Are you getting any errors in the code or while executing.
Thanks,
It worked sai praveen