I have a Sobject Record which is already instantiated and fields are added along with values.
sObject sObj = Schema.getGlobalDescribe().get(Name of Object).newSObject() ;
sobj.put(fieldname,fieldvalue); sobjectMap.put('id1',sobj);
Now after some logic processing , i loop through the sobject map and would like to few more fields or update the existing fields and then insert the sobject.So i did something as below , but dont seem to be successfully add new fields or update existing one, any help ?
Sobject sobj = (SObjectMap.get(id1).clone();
sobj.put(new field,new value);//printing sobj after adding new fields , doesnt really add field value
SObjectMap.get(sobjUUID).put(reference,CloneSObjectMap.get(parentUUID).id);//neither do this