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 produced record

I have to update the record if it is already in the system. I have an Object named 'Account' and its field 'Account ID'. The condition for updating the record is that for 'Account' the key is 'Account ID'. My question is:

1 : How can i assign the 'Account ID' key to the object 'Account'. I have an idea that i have to use map function here but how to use it i do not know. My understadning was that it should be something like

Map<Account_ID__c,Account__c> map1 = new Map<Account_ID__c,Account__c>(); //ITS AN ERROR !

So whats the right way to do it.

2 : How does mapping helps me in updating record. I mean i am sure it can be done without mapping the values so how (show with code) does it makes easy to update while using the map.

 

Thanks !

Savi3Savi3

Hi,

 

 How about Map<ID,Account__c> Ac = new Map<ID,Account__c>();