You need to sign in to do that
Don't have an account?
Rajevls
Update a field on opportunity by custom settings
I want to udpate a field on opportunity (Area) . Country is a field on account and related area is mapped in the custom setting (Area Mapping) . How can i use this custom setting to update the field on opportunity
Hi Rajeev,
Please write a trigger on Opportunity object and using relationship get the value of field country from Account. After that use SOQL or get methods to retreive value from custom setting and store in a Map.
Use this map to get Area by passing Country or similar kind of logic.
Regards
Sonu Sharma
Try using getall method of Custom settings and fetch the required field value,something like below :-
List<TestCustom__c> mcs = TestCustom__c.getall().values();
Opportunity opp = new Opportunity(Id=opp.id,AccountId=acc.id);
opp.Area__c = mcs[0].Location__c; // here,Location__c is field on custom settings TestCustom__c
for more methods of custom setings please refer below :
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_custom_settings.htm
It worked .. Thanks
Hi Rajeev,
could you please copy your Trigger code and custom setting snapshot.
I am new to programming or hardly write code/programs
I am also looking for something like this.
Thanks and regards
Sonu