You need to sign in to do that
Don't have an account?
Preetham 345 SFDC
Custom Batch Process for inserting 'n' number of records
Hi All,
Hope everyone is doing great, I have a scenario where i have to read csv file with multiple objects fields(Accounts,Opportunities,Opportunities Line Items, One Custom Object) in it from apex class and populate them on Visual Force Page using pageblockTable, and has to only insert those populated records into backend, but i have to do this insert operation based on custom batch only . I am unable to figure out how to acheive the insert operation for custom batch and how to relate it Job . If any one face this kind of situation could you please suggest me how to proceed by providing possible solution to it.
Thanks in advance
Hope everyone is doing great, I have a scenario where i have to read csv file with multiple objects fields(Accounts,Opportunities,Opportunities Line Items, One Custom Object) in it from apex class and populate them on Visual Force Page using pageblockTable, and has to only insert those populated records into backend, but i have to do this insert operation based on custom batch only . I am unable to figure out how to acheive the insert operation for custom batch and how to relate it Job . If any one face this kind of situation could you please suggest me how to proceed by providing possible solution to it.
Thanks in advance
From what I understand
1. Load the CSV and show the records on Visualforce Page (Can be Opportunities, Accounts, Line Items etc). Q. Does all the records will be in one CSV or different CSV files?
2. When they are displayed on the page, user clicks some button maybe like Accept? And thats when you need to trigger batch job to insert them? Am I right?
For the above I dont think its hard, but definitely some work to do. First you need to write a custom CSV Parser (make it a helper class). For your reference. He is a code sample from developer blogs
https://developer.salesforce.com/page/Code_Samples#Parse_a_CSV_with_APEX
Once you are able to parse the CSV file you can easily load them as SObject records and insert them in your Batch job.
Hope this gives you a starting point for your app.
Thank you
Kartik
1) It's gonna be a single CSV file which consists fields of multiple objects (Accounts,Opportunities,Opportunities Line Items, One Custom Object)
2) Yes user will be clicking Insert button such away that the Batch Apex shoul be called and insert process should be started.
My question is how to make a Apex batch in custom wise , say if user want to controll the csv load to some perticular n value (n=100) even though if he has 200 records in csv.
Thanks
Preetam