function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Amritesh SinghAmritesh Singh 

Using webservice method to Import large data

HI all,

 

I have to insert Account,contact and Opportunity records coming from .net server as a xml string.i have created a webservice method and getting that xml as string and then parsing the xml.

 

I am able to it,but before inserting i have to check if those account,contact n Opp. is existing in salesfore or not.If not,then insert.I have done every thing and also achieve my goal.

 

But my code is working for small set of data , that is coming from extenal server.Currently i am sending 30-30 information in  xml to sfdc and its working,but more than 30 records at a time causing prblm,giving

 

error System.LimitException: Too many SOQL queries: 101

bcs i m using SOQL for checking the existing Account,contact and Opportunity.

 

Error like

System.LimitException: Too many DML statements : 151

System.LimitException: Too many code statements: 200001

 

Also occuring for more than 30 as i m also inserting Account,contact and Opportunity if it is not existing,

 

If u know any other way to do this pls share the idea,cause i have to import large data at a time from external server.

 

Thanx in adv

marcobmarcob

Hi,

seems you call the web service method with one record each time, instead using a list of records. By using a list as input parameter for your method, you can check with one SOQL statement whether your accounts already exist, and you don't have to do a SOQL statement per record.

Hope this helps.

Br,

Marco

Amritesh SinghAmritesh Singh

Hi Marco,

 

thanx for ur reply,

 

My wesevice method is looks like this,

 

webService static Integer ImportDonationAndMembership(String StrXml)
{
    parseXml(strXml);
}

i am getting all the record in xml format as a string.then i am paasing this xml string for parsing in parseXml method here

And after parsing every record i am passing value to a my method where i am validating Account,Contact an Opp.I am using list of records,but this is not working here in my case.