I have a Wrapper object that I'm using to store values via calculations and callouts. I want to map these values to a custom object's fields. I also have a custom metadata type where I'm storing the mapping of Wrapper object attribute and Custom object field.
The requirement is that I iterate over the key-value pairs of the wrapper object and assign the value to the custom object field that corresponds to that particular wrapper attribute. I do not want to do a hardcoded mapping within my code, and just want to reference the setting to handle the mapping.
I'm so far unable to get my wrapper object converted to Key-value pairs. Any typecasting I do, I'm unable to access the attributes on the wrapper object.
Is there a better way to achieve this?