function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
v!nn!v!nn! 

Auto Populating Fields

Hi all,

Can anyone let me know whether we can auto populate a field value based on another  lookup field value??

 

Eg : 

 

We have  STUDENT and COURSE objects. In STUDENT we had two fields like 'Course Interested (Lookup)' and 'Total Fee(currency)' and in COURSE object we had fields like 'course name' and 'fee'. If we select the Course Interested through lookup, the respective fee of that course should be auto populated in the 'Total Fee' field.

RoyGiladRoyGilad
Hi,

the best way to to this would be to add a formula field.
I assume you are implementing it as a many-to-many relationship, and you could create in your registration object (the connector between STUDENT and COURSE objects), a formula that get the course fee out of the course object.

I hope it helps,
Vinita_SFDCVinita_SFDC

Hello,

 

Create a formula field "Total Fee" with output type "Currency". Formula could be like:

 

IF(Course == "A",10
     IF(Course == "B",20
         IF(Course == "C",30)
           )

     )

 

Let me know if you have any questions.

v!nn!v!nn!

I tried it with formula field and it worked. But I can see of the value 'Course Fee' field only after i save the record.

That's not my requirement.

 

As soon as we select the lookup field value(for Course Interested field ), the below field i.e, Course Fee should be poulated there itself.(we should be able to see the value in the page layout itself).

 

It should not be populated after the record is saved

 

 

 

 

Vinita_SFDCVinita_SFDC

Hello,

 

Yes if you implement either by formula field, worflows or trigger it will be shown after saving the record and for this requirement these are the only options available.

 

I would like to suggest you a workaround if you wish to see the value before you save the record. Use dependent picklist concept and create two picklists cousre(Controlling) and course fee(Dependent) on Student object and map them. Now when you will select the course the mapped valued will be auto populated in the record as soon as you choose the Course, but for this the requirement will little change.

 

For dependent picklist overview please refer: https://help.salesforce.com/apex/HTViewHelpDoc?id=fields_about_dependent_fields.htm&language=en_US