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
salmanmanekiasalmanmanekia 

Update the already included records

Hi,

 

I have two objects fromUpdated and toBeUpdated. Both the objects have two fields aField and bField. I have to write a code such that when a new record is inserted in toBeUpdated . It checks if the record has been already there previously. The key which is cheked is aField and if the aField is a match between two records then it just updates the another field bField without creating a new record for the toBeUpated object.

 

After this operation i also have to delete all the objects from the fromUpdate object.

 

I know query and delete() would provide this functionality but how to write a SOQL statement for this functionality is what i cannot figure it out.

 

Any help would be appreciated..

 

Thanks

 

 

yvk431yvk431

Your requirement is not very clear,

 

first after getting the match what do you want to update the bfield with?

delete all the objects fromUpdated ? means you want to delete all the records if so with what criteria (whats the relation between these 2 objects)

 

--yvk