I have a class with more than 10 attributes (fields).
Each attribute is filled depending of a context (conditions "if"):
if(value == '1'){
myobject.attribute1 = value;
}else if(value == '2'){
myobject.attribute2 = value;
}else if(value == '3'){
myobject.attribute3 = value;
}
...
I think it's a dirty way to process. Is there a good way to automate the process? Something like:
myobject.put('attribute' + value, value);
Currently, Salesforce give me an error:
Method does not exist or incorrect signature: void put(String, String) from the type
How do I do it correctly?