I have a list of sObjectsToInsert which will be inserted at the end of a set of scripts. It will contain many different sObjectTypes, so it must be built dynamically (get/put).
One problem I'm running into is when a field type is a non-string, yet I'm passing a string value through via values.get(value)
public void addToInsert(sObject so, Map<String, String> values) {
for (String value : values.keySet()) {
so.put(value, values.get(value));
}
sObjectsToInsert.add(so);
}
How can I cast values.get(value) as the value field type dynamically?