SHARE
TWEET

Untitled

a guest Jun 16th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Boolean isIndividualEnable = Schema.getGlobalDescribe().containsKey('Individual');
  2. if(isIndividualEnable == true) {
  3.     Map <String, Schema.SObjectType > sObjects = Schema.getGlobalDescribe();
  4.     Schema.SObjectType individualType = sObjects.get('Individual');
  5.     Map<String, Schema.SObjectField> mSourceFields = individualType.getDescribe().fields.getMap();
  6.     SObject individualObject01 = individualType.newSObject();
  7.     SObject individualObject02 = individualType.newSObject();
  8.     individualObject01.put(mSourceFields.get('Name'), 'Individual 1');
  9.     individualObject02.put(mSourceFields.get('Name'), 'Individual 2');
  10.  
  11.     List<SObject> lstIndividual = new List<SObject>();
  12.     lstIndividual.add(individualObject01);
  13.     lstIndividual.add(individualObject02);
  14.     insert lstIndividual;
  15. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top