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
rvg170550rvg170550 

Fill data with retrieved colums from other entity

In Contact, I have a field called Function, that consists out of a drop-down list of functions, accessed via a Lookup-function from Salesforce.
 
In the Function entity, I have 2 colums next to the Function, Level and Department.
 
Can someone advise me, how to fill these 2 values in Contact screen, after picking a Function in Contact ?
 
Many thanks
RickyGRickyG
rvg170550 -

I am pretty sure you don't want to fill in fields in the Contact record, just display the values on the page.  You can easily create a formula field to display values from a related object.  These values will show up when a user views the record.  You could, of course, add these values to the search dialog for the lookup, which would be the way to get them in entry mode.

Hope this helps.
rvg170550rvg170550

That would be ideal, but when I create a fomula field, I don't see how to specify my Select-statement, to retrieve the info from another object.

For instance, in a list I want to display the person's name, function, etc, but only info available is the ID.

Can you give me a hint / example to do this kind of select ?

That would be great,

 

Thanks,

 

RickyGRickyG
You don't use a select statement - you simply use the Insert Fields button to bring up a list of fields and related objects.  You can click through the objects, indicated with a >, to get the to the fields and select them.'

Hope this helps.
rvg170550rvg170550

Still not solved ...

Let me first define my problem correctly:

We have "Sales"-application with Accounts and Contacts. Every contact has a function (job), that is defined as a lookup relationship to a Custom object (JOB), having one or more colums with job classification in there.

I want, the moment they pick a function from the list, some of these classifications to be shown in Contact Info.

When I define a new custom field, and create a formula to pick-up one of these values, the Custom object (JOB), is not available in the picklist ... (I can only select from $Api, $User, $UserRole, $Profile, $Organisation, Contact).

I had expected to see JOB appear in there as well, since it has a lookup relationship with Contact ...

 

 

RickyGRickyG
You need to use the Advanced Formula tab.  This will include a button for Insert Field, which will bring up a dialog that will let you navigate to related objects and their fields.
rvg170550rvg170550

Thanks, I managed to pick the value, but the problem was, that the info is only visible in the view-format, not in edit mode.

Ok, we can live with that, but I still had 1 extra question:

I only managed to pick up values, when the fields were defined as text fields, but the moment the column contains picklist values, I don't find how to code it:

          What do I have to use as prefix / function, to select such a value ?

           Is there a corresponding function like the ISPICKVAL ?

 

Thank you very much

 

 

RickyGRickyG
rvg170550 -

Great - glad that helped.  As you can see, to display the value in view format is pretty easy.  If you actually want to retrieve the values in edit mode, you will have to get into partial page refreshes in Visualforce pages.  Keep in mind that you can modify the search dialog for the lookup to display the fields you want to put on the page, which would give your users a way to see the values at entry time.

Not sure what your second question entails.  Do you mean you cannot add a formula to display a picklist value?  You will have to use a CASE statement to decode it.
rvg170550rvg170550

Here I come again.

trigger Before_Insert_Special_Event on SFDC_Special_Event__c (before insert) {

for (SFDC_Special_Event__c ne : Trigger.New)

{

ne.name = ne.mce_product__c;

}

}

I want to fill the required field "Name", with data from my input screen. For all new records, I want to allocate the value of that field myself. I want to use the value of input field mce_product__c + eventually a sequence (will add that in a second stage).
 
But when I press save, system says "Name" has to be filled (on screen the field stays empty).
 
Have you any idea, how to tackle this problem ?
 
Thanks