How to add the related object's field in the list view

Posted by cayla on 09-Feb-2016 22:09

I got two objects "Company" and "Contact", and they have 1:M relationship.

in the "All contact" view, which is a list of all the contact fields, including a column to display the company name. However, if I'd like to have a column to display  the company's website (which is only a field to Object"Company") in "All contact' view, can it be done?

Thanks.

Posted by Shivani Silveri on 11-Feb-2016 00:30

Hi Cayla.

Suppose if I have object "comany" and object "Contact". I want to display primary contact's phone number in the company's view. Are you suggesting to have one "phone" field for "contact" and another "phone" field for "company"; and get the "phone" field for the primary "contact" and set that value to "phone" field for "company"?

>> Yes, that would be 1 solution. But without using Triggers, you could create a "Template" Field in Company and pull the data from Contacts  (This is a non-editable text field).

Thanks,

Shivani.

All Replies

Posted by Shivani Silveri on 09-Feb-2016 22:27

Hi Cayla,

Yes, it can be achieved.

In the "Contact", create a new field of type "Related Field" and select the Related Field as the Email Address. This will add a column to your View which only renders the Email Address Field of "Company".

For more details, use this doc link

documentation.progress.com/.../index.html

Please let us know if you face any concerns.

Thankyou,

Shivani.

Posted by cayla on 09-Feb-2016 22:55

Thanks Shivani, but I didn't see the "Related Field" option as a field type. and if I change the data in the "All contact" view, will it be updated to "company" as well? I assume yes.

Posted by Shivani Silveri on 09-Feb-2016 23:20

Hi,

I believe you have already established a 1 : M relation with "Company" and "Contacts",i.e One Company to Many Contacts. You will be finding  that Field only in Contact Object.

Can you please confirm the Relationship type.

if I change the data in the "All contact" view, will it be updated to "company" as well?

  >Yes, it will be updated.

Thanks,

Shivani.

Posted by Pradeep Kagithalagudem on 09-Feb-2016 23:20

Try using formula field

documentation.progress.com/.../index.html

Thanks and Regards

Pradeep

Posted by cayla on 10-Feb-2016 00:02

Thanks Shivani, I did have a 1:M relationship set up, (one company to many contacts), and  the related field is only available for the M side "contact", not for the 1 side"company". I thought somehow it is the expected behavior, but what I want is to display the primary contact details(phone, first name, last name, etc.) on the company view, without adding the contact attribute for company and have those fields duplicated.  Any suggestions? 

Posted by Shivani Silveri on 10-Feb-2016 03:28

Hi Cayla,

You can use Object Script Trigger to achieve it.

I have tried it at my end with one Record attached and it worked fine. If you attach multiple records, you will have to use a loop available in the Template helper.

var x =rbv_api.getFieldValue(objName, objId, fieldName);    

rbv_api.setFieldValue(objName, objId, fieldname, x);

Hope this helps.

Thanks,

Shivani.

Posted by cayla on 10-Feb-2016 19:26

Hi Shivani,

Correct me if I misunderstand.

Suppose if I have object "comany" and object "Contact". I want to display primary contact's phone number in the company's view. Are you suggesting to have one "phone" field for "contact" and another "phone" field for "company"; and get the "phone" field for the primary "contact" and set that value to "phone" field for "company"?

That will do, which I will consider as the backup plan. However, is it possible if I don't want to have the field "phone" for "company", just want to display "phone" in the "company" view as it has the relation with contact.

Thanks,

Cayla

Posted by Shivani Silveri on 11-Feb-2016 00:30

Hi Cayla.

Suppose if I have object "comany" and object "Contact". I want to display primary contact's phone number in the company's view. Are you suggesting to have one "phone" field for "contact" and another "phone" field for "company"; and get the "phone" field for the primary "contact" and set that value to "phone" field for "company"?

>> Yes, that would be 1 solution. But without using Triggers, you could create a "Template" Field in Company and pull the data from Contacts  (This is a non-editable text field).

Thanks,

Shivani.

This thread is closed