I am new to Salesforce, and programming. Is there a way to reference CustomObject__c when adding to list, without hardcoding the name of the field (customObject__c)? Example:
If(Name ='123'){ updateListOpp.add(new Opportunity(customObject__c = null); }
I have multiple custom objects that need to be added to a list, So I just wanted to know if there is a better way, instead of having to hardcode each custom object and having multiple conditional statements.