You need to sign in to do that
Don't have an account?
Set Account "fields" dynamically
Hi,
There is a picklist showing all the fields of Account. User will seleect one of the fields and enter any value to it. In the controller, I need to set that particulat field Account to the entered value.
I am able to get the selected field and its value in String format as
String apiName = name__c;
String val = "Test";
But when I am trying to set the Account field as
Account acc;
acc.apiName = val;
I am getting the following Compilation error:
Compile Error: Invalid field apiName for SObject Account
I am not able to figure out its solution. If anyone has experienced such problem, please help.
Its urgent.
Thanks,
Pragati
As you have the name and value combination for the field, you'll need to use dynamic DML (get/put syntax):
All Answers
As you have the name and value combination for the field, you'll need to use dynamic DML (get/put syntax):
Thanks a lot Bob. It helped :)