Created
September 27, 2018 15:37
-
-
Save swapnilshrikhande/5896cce8a1fe0242f87fbecbac8d3e2b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Opportunity opp = [select Reason_for_No_Withdrawal_Symptom__c,Withdrawal_Symptoms__c from opportunity where id='006g000000GVeVq']; | |
Map<String,Object> deserializeMap = (Map<String,Object>)JSON.deserializeUntyped(JSON.serialize(opp)); | |
Map<String,String> oppRecord = new Map<String,String>(); | |
for(String key : deserializeMap.keySet()){ | |
if( 'attributes'.equalsIgnoreCase(key) ) | |
continue; | |
Object value = deserializeMap.get(key); | |
oppRecord.put(key,String.valueOf( value != null ? value : '')); | |
} | |
System.debug(oppRecord); | |
//-- | |
Opportunity updateRecord = (Opportunity)JSON.deserialize(JSON.serialize(oppRecord),Opportunity.class); | |
updateRecord.Name = 'Test Record'; | |
update updateRecord; | |
System.debug(updateRecord); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment