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
juice2juice2 

General Batch Usage

I need to update or create multiple Accounts and Opportunites. Currently, i'm using multiple requests which

 

juice2juice2

trying again. Currently, i'm using multiple requests which first search for existing accounts and then, based on the result either issue a create or update.  I repeat this for opportunities as well. However, the performance is not ideal

Is there a better way to do this then through individual query, create and update requests. Should i be using the batch process? Any recommendations?

DevAngelDevAngel

Hi juice2,

I don't think this is documented anywhere, but in the old api you could call the create and if the id was included it would update.  Give it a try and let me know if it works. 

BobLBobL

During processing, we unfortunately do not have id's available to us. Here's a brief summary of the use case: user has a list in Excel of (potentially) new accounts, opportunities & contacts. For each row, if an account name doesn't already exist, create it; otherwise, if only one account matches the name, use it; otherwise if > 1 accounts of the same name exist, refine the query further by adding address information. If found, use it.

For the above bit of processing, we'd like to batch all account names together into a single query & get back all rows which match (for performance purposes). From the result, it would be easy enough to determine which accounts then need to be created, have >1 match, etc. The retrieve() functionality would be ideal, except it only takes id's as criteria. Another possibility might be to string together account names into a huge 'or' clause.

Any thoughts/ideas would be appreciated (I'm an Sforce newbie)... thanks !

DevAngelDevAngel

Hi BobL,

I can't think of any other way to do what you need to do aside from doing some kind of inner/outer join on account names on the client.  In SQL you would probably do a Select ta.Name from Account a, tempAccount ta Inner Join a.Name = ta.Name Where a.Name is null.  (this is probably not exact but you should get the idea).  This would require that you do the join processing on the client and bring down a lot of data.

The best bet is to do one or more queries that use a lot of or operators on the account names.