You need to sign in to do that
Don't have an account?

decides which field to be changed automaticly
For example, I have two sobjects as below:
SobjectA__c, which has three fields: column1__c, column2__c, column3__c
SobjectB__c, which has one field: column_name__c
What I want to do is, I get the value of column_name__c from SobjectA__c and run a trigger for SobjectB__c.
If column_name__c's value is "column1__c" then I set the field "column1__c" 's value to 1.
If the value is "column2__c" then I set the field "column2__c" 's value to 1, and so on...
The value decides which field to be changed.
Could anyone tell me Is this consideration possible? If it's possible, how to achieve it?
Thank you.
You can use dynamic DML for this - that allows you to get/set field values based on the field name.
E.g.
There's more information at:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_dynamic_dml.htm
All Answers
You can use dynamic DML for this - that allows you to get/set field values based on the field name.
E.g.
There's more information at:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_dynamic_dml.htm
I'm assuming that column_name__c is a lookup to SobjectA__c. If this is the case, you can query for your SobjectA__c from your SobjectB__c query, and then do your work on it.
Trigger help:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_qs_trigger.htm
Thank you, bob buzzard!
That's what I need!!