You need to sign in to do that
Don't have an account?

Change ownerId of Accounts
I have an excel sheet with zip to user mapping. Now Accounts with those zip needs to be mapped with corresponding userid. For this I followed following approach,
I created a custom object (to upload data via loader) with user look-up--> written a before insert trigger on custom object to fetch user Id based on name. Now while writing After Insert trigger I would need some zip-account mapping (can be multiple accounts per Zip) but I stuck keeping Select out for loop which would break definately as there are almost 50 K records, Could you please help me with After trigger with optimized code or any altogether different approach.
I created a custom object (to upload data via loader) with user look-up--> written a before insert trigger on custom object to fetch user Id based on name. Now while writing After Insert trigger I would need some zip-account mapping (can be multiple accounts per Zip) but I stuck keeping Select out for loop which would break definately as there are almost 50 K records, Could you please help me with After trigger with optimized code or any altogether different approach.
I am assuming there is a zip field on the account. But is this zip field a custom text field or a lookup, or is it the standard Billing Zip/Postal code field? Based on this I can provide you a sample trigger.
Thanks,
Shashank
I have written this sample assuming zip__c is a custom object with user__c as the user lookup field and the zip code is stored in the default name field, and the zip maps to the BillingPostalCode field on the Account object. You can modify it as per your need.
If this answers your question, please mark this as the Best Answer for this post, so that others can benefit from this post.
Thanks,
Shashank
I ve tried with Apex approach (job)
What do you say about this approach?
Regards
Gaurav
but thanks for providing the trigger approach as well as people might be intrested appraocah as well