You need to sign in to do that
Don't have an account?
Krisztian
Set Object's fields by string parameters.
Hi,
I process XML files. The XML has special structura so I create a mapper. Example: Account.ID -> Account.ExternalId__c
I want to set the account's field via string parameters. How can I create this procedure?
void SetByParams(Account acc, String field, String value){
//abstract: acc.'field' = value;
}
you have to use .Put method for dynamically assign field and value.
see below example,
Example:
void SetByParams(Account acc, String field, String value){
//abstract: acc.'field' = value;
acc.put(field,value);
}
Thank You,
Hitesh Patel
SFDC Certified Developer & Administrator & Advanced Administrator & Sales cloud consultant
Email :- hiteshpatel.aspl@gmail.com
My Blog:- http://mrjavascript.blogspot.in/
All Answers
you have to use .Put method for dynamically assign field and value.
see below example,
Example:
void SetByParams(Account acc, String field, String value){
//abstract: acc.'field' = value;
acc.put(field,value);
}
Thank You,
Hitesh Patel
SFDC Certified Developer & Administrator & Advanced Administrator & Sales cloud consultant
Email :- hiteshpatel.aspl@gmail.com
My Blog:- http://mrjavascript.blogspot.in/