You need to sign in to do that
Don't have an account?
Sachin Sharma 4089
how to insert 300 contacts for each account if i have 100 accounts
Hi, i have just started salesforce and i have a situation in which i want to insert 300 contacts for each account and i have 100 accounts in my salesforce org. i have already read some articles on batch apex but i'm unable to understand how to do it. Thanks in advance if anyone solve this for me.
This code is working fine for me.
Please wait for atleast 30-40 mintues after excuting the batch.
Note- There are some storage limitations in Dev Org so you must check your org storage limits under Setup -> Data -> Storage Usage.
Due to these limitations the insertion of contact might fail.
Please mark it as the best answer if it helps you to fix the issue.
Thank you!
Regards,
Malika Pathak
All Answers
Greetings!
You need to insert all the contacts which you need to insert in one CSV file and use bulk API to insert either using Data Loader or Workbench without using any code.
Then,the contacts will be assigned to the Account based on AccountId field on the Contact records.
Reference:https://developer.salesforce.com/docs/atlas.en-us.dataLoader.meta/dataLoader/inserting_updating_or_deleting_data.htm
Please mark it as best answer if it helps you to fix the issue.
Thank you!
Regards,
Shirisha Pathuri
Greetings!
Create a batch class-
Execute the above batch class using this code-
InsertContactToAccount bc = new InsertContactToAccount();
Database.executeBatch(bc, 10);
Please mark it as the best answer if it helps you to fix the issue.
Thank you!
Regards,
Malika Pathak
Thanks for your reply. But this code is not generating 30000 contacts. Please reply if you have any other solution.
Thanks and regards
Sachin Sharma
This code is working fine for me.
Please wait for atleast 30-40 mintues after excuting the batch.
Note- There are some storage limitations in Dev Org so you must check your org storage limits under Setup -> Data -> Storage Usage.
Due to these limitations the insertion of contact might fail.
Please mark it as the best answer if it helps you to fix the issue.
Thank you!
Regards,
Malika Pathak
After execute the code again i have checked the storage capacity of my org. Below is the storage capacity of my org. Its limit is 5.0 MB and used space is 42 MB after execute ths code. So i think due to storage capacity 30k contacts are not generating. BTW thank u for your replies.
Regards
Sachin Sharma