Hello good afternoon. We have a SuiteCRM 7.11.8 where we have contacts related to products. Relationships can be viewed from each of both modules. What we need to do is show the related products of a contact as fields of the contact’s file, not being necessary to go to where the related module is and have to open it. Is this possible?. Thank you.
Hi, what kind of relationship did you create between contacts and products? one-to many? many-to-one? many-to-many?
In case one-to many and many-to-many, you should see a subpanel with products in the contacts module. Many-to-one doesn’t make sense to me, because a contact then could only refer to a single product.
@digitecmedia
You can’t do it because in SuiteCRM broken field type “collection”. But you can take commits files for upgrade from: https://github.com/salesagility/SuiteCRM/pull/8341 . There is repair this field type. After that you can add dynamic fields table from one module to any another module.
Hello Janisero, thanks for your reply. I created you 3 screen captures.
At screencapture1 you can see the Contact details with many custom fields I created.
At screencapture2 you can see the products related module to Contacts.
My goal is to show fields from related product at Contact details. It’s to say, I need to show a field like “CÓDIGO FARMACIA” that belongs to product module, at a field inside Contact details (screencapture1).
The other goal is: when I need to add a new related product to contact, I click on select and appears a screen like screencapture3. I need to show fields from contact in the search result grid. Now at result grid only appears fields from products, but I need to show data from related contacts of each product.
if a contact has multiple products:
then you would need to add multiple fields for Codigo Farmacia in your view, depending on the nr. of related products. This is a use case that is not support by SuiteCRM by default, because for this you have your subpanel below, containing all info concerning the related products. Why exactly do you need this information at the top of your screen?
If a contact always only has one product:
then your relationship setup should have been many-to-one (many contacts to one product)
Thanks for your reply. Right now relationship is many-to-many, but no one contact has more tan one product. So, is like relationship was many-to-one.
The most important for me is at point to search a product (farmacia) to relate it to contact, show fields from contact related to product:
User searches a pharmacy (product) to relate it to a contact. User can search the pharmacies by many fields, but we need to search a pharmacy thru the name of contact related with it. Or show the name field at pharmacies (products) search results.
Hello again. Can I do thru Worflows?. I created a custom field at Contact called “product name” that belongs to custom module “Propietario de”. How I can make a Worflow to copy all products name to custom field “product name” of all contacts?. Thanks.
I think you should first create your relationship as many contacts to one product.
To display fields of the product to contacts, you can either use the excellent work of @p.konetskiy (collection fields) or add so called “vardef” files to your installation. These vardef files can also enable you to search for products with the contact as search criteria.
I’d advise you to first change the relationship to many-to-one, I can then give you advise on the vardef files, preferably on a test installation.
After creating the relationship as many contacts to one product, you can go into studio and add the products field to year Contacts Editview, Detailview etc.
When you also want to show the field Código Farmacia of the products in your contacts detailview, you will need to create this field by vardefs as describe in:
Specifically for your case (please first do this on a test environment):
Do a Admin - Repair - Quick Repair and Rebuild, scroll down and make sure to click on execute to execute the query.
Afterwards the new field Código farmacia is available in the edit, detail and listviews of the products module, as well as in the detail, and listviews of the contacts module.
To migrate the field values of the previously created código farmacia field in studio, execute a query like this:
update aos_products as p, aos_products_cstm as pc set p.pharmacy_code = pc.codigo_farmacia_c where p.id = pc.id_c;
After successful migration you can then remove the código farmacia field previously created in studio.