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
kminevkminev 

Update fields last update after certain date

Hi,

 

I have an .net application utilizing salesforce api and I would like to update collection of sobject, but first to check which fields have been update withing specific date range if they fall under this range update them if not continue to the next field of the object and check if update necessary.

 

The main objective is to update only the value in fields from one object that fall withing the last modified date range.

 

Any help will be appreciated.

 

Thank you in advance.

Best Answer chosen by Admin (Salesforce Developers) 
JPClarkJPClark

the i360_Lead_Source__c in this code is one of our custom objects, but will work for Account, contact, etc. also.

 

 

List<i360_Lead_Source__c> platformLeads = new List<i360_Lead_Source__c>(); DateTime FirstDate = DateTime.Parse("7/29/2009"); foreach (i360_Lead_Source__c ls in i360Leads) { if (ls.LastModifiedDate < DateTime.Today() && ls.LastModifiedDate >= FirstDate) { // -- Make Updates here --- platformLeads.Add(ls.Legacy_ID__c, ls); } } m_Login.ForceServer.update(platformLeads.ToArray());