You need to sign in to do that
Don't have an account?
Steve Bair
Automatically update field based on value in another field
I have created an object (table) with three fields -- number, name, and person. There are only five records in this object each with a unique "number" (1 - 5).
On the account view, I have placed a picklist with the numbers 1 through 5 to match the "number" field in the custom object.
My goal is to place two more fields on the account view such that, when the user selects a pick list value, the other two fields will be filled in with the corresponding "name" and "person" fields from the custom object.
Any help will be appreciated -- or the location of docs.
TIA
Note that you will not be able to do this instantly in edit mode -- it will only happen once you save the account, and then the trigger can run and update the other fields.
That said, are you sure you want to duplicate the data in that custom object into the Account fields? What if you need to change a name -- then won't you have to go through all Accounts and change it in all of them? You might actually be better served by making a lookup from account to your custom object, and setting that lookup through your trigger instead (you'll still need a trigger to set that lookup though). In the Summer release you'll be able to make formula fields that get data from parent objects like your custom object, so you could make those name and person fields as formula fields. Then if you change the data in the custom object, your accounts will just automatically inherit that change.
Thanks. You are right, I do not want to duplicate the data in the account fields -- I just want the user to see the info that corresponds to the "number" field selection. It's ok if these don't show up until the record is saved.
It seems like a trigger would be overkill. Could this be done with a formula?
Thanks for your help.
Then a trigger it shall be.
Thank you very much for your help.
Rather than creating new fields that are populated from the other object, have the S-Control retrieve and display the information from the other object. It would run a SOQL query to retreive the object matching the selected number, then display it on-screen.
There's plenty of S-Control samples inthe discussions boards and wiki, but let us know if you're having difficulties.
Do you have any examples of triggers where you are using the values of a custom field in object 1 to reference the values in object 2? I've run into the same scenario where I need the system to auto-populate the lookup field of the Lead object with the ID/Name of a related custom object (Employee) based on a value stored in the Lead object. The value in the Lead is created based on workflow, and I need that value to create the relationship with the custom object.
Any help would be greatly appreciated.
T
http://forums.sforce.com/sforce/board/message?board.id=practices&thread.id=6551
trigger EmployeeUpdate on Lead (before insert, before update) {
List EmployeeName = new List();
for (Integer i = 0; i < Trigger.new.size(); i++)
{
EmployeeName.add(Trigger.new[i].EmployeeName__c);
}
List EmployeeList = new List([Select Id from Employee__c where Name in :EmployeeName]);
for (Integer i = 0; i < Trigger.new.size(); i++)
{
if (Trigger.new[i].EmployeeName__c != null)
{
Trigger.new[i].Employee__c = EmployeeList[i].Id;
}
else
{
Trigger.new[i].Employee__c = null;
}
}
}
Do you have the Lookup field of the custom object Employee on the Lead object? In that case you can create formula fields on Lead object to get the values from the Employee object. No need of a trigger.
Regards,
Krishna.
If you have a custom object Employee__c and you have a lookup field on lead to this custom object, you can create formula fields to get the field values from this custom object.
For example if you want to bring the value of fieldA from Employee object then you can create a formula field with the following value
Employee__r.fieldA__c
Hope this helps.
Regards,
Krishna.
Escorts in Abu Dhabi (http://www.uaehotcollection.com) Indian Escorts in Abu Dhabi Call Mannat +971561033256, A well known professional, educated escorts, who offers high class Independent Abu Dhabi Escorts Service.
Indian Call Girls Dubai (https://www.vvipmodel.com) Call/WhatsaPP +971561033256, Indian Escorts in Dubai, Call Girls Dubai. Indian Celebrities Escorts In Dubai Contact Indian Independent Escort in Dubai, Very Cheap Price and safe Independent Escorts Dubai.
Indian Escort in Abu Dhabi (http://www.simmi-patel.com) Indian Escort Girl in Abu Dhabi With. Our Abu Dhabi Escorts and Independent Agency Abu Dhabi Escorts aren't simply standard girls as you will verify.
Dubai independent escort (http://www.tanishaverma.com) If you are searching for the same that is the escort with elegant personality then your search is finish as you have landed in the right site.