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

easiest way to run a SOQL statement

I'm pretty new to the SF API, but I do have most of the development tools installed, API access via PHP on my server, the eclipse thing, apex expolorer, workbench, excel data connector, etc...


I need to run this query (in SQL) once now to update current records, and then I can put a little more effort into having it run  nightly:



Update Lead set matchfield = concat(Email, Affiliate_Of__c)  where matchfield is null        


Ideas?  Will that SQL run or do I need to change it?



I've done a few things with the API, and DO know the long way would be to pull every record and then update them (individually or batch)  But I can't help but to believe there must be a simpler way to run that update.







Login to your account, open up the 'System Log' in the top right-hand corner. Put this code in:


list<lead> updateList = new list<lead>();
for (lead l : [select email, affiliate_of__c, matchfield from lead where matchfield = null])
l.matchfield = + l.affiliate_of__c;
update updateList;