Thursday, October 18, 2012

Updating sObject Dynamically in Salesforce

Recently I came across a requirement where I have to update the sobject dynamically.
Everybody is familiar with inserting the sobject dynamically.

It is very simple and the solution is :

Schema.SObjectType t = Schema.getGlobalDescribe().get('Account');
SObject sObjectAccount = t.newSObject('0013000121Bclpu');
sObjectAccount.put('Name', 'Account Update');
Update sObjectAccount;
 
Just we have to pass the Id in the method newSObject.
  

No comments:

Post a Comment