Joining array to list and display as field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • geraldine
    Junior Member
    • Feb 2020
    • 1

    Joining array to list and display as field



    Trying to figure out the following situation :
    I have contacts with a field called related to (for relatives) - since this is a many-to-many connection it automatically creates a ContactLeft and ContactRight (as then someone marks you as his relative (ContactRight) it automatically adds the relation to you as well (ContactLeft)) --> This works but i would like to display on the contact information one list of all relatives, and not 2 lists side by side (i would also like to make sure that there are only unique values)

    Im using this formula to get back the array : relativesArray = list(relatedToNames,relatedToIds) - which in turn display in the field [object Object], [object Object] (which make seanse because im getting an array of objects and not
    My question is how to go about this to actually create this combined list of these contact list ?
    Thank you in advance for the help
  • telecastg
    Active Community Member
    • Jun 2018
    • 907

    #2
    I would suggest using Ajax to run an SQL query to generate a list of results, letting MySql do the heavy data filtering, and then use that data to load an "enum" (select) field.

    You can try that using this free plugin https://forum.espocrm.com/forum/deve...ed-in-metadata

    This plug was developed in to be able to to populate an "enum" field dynamically based on the selection made on another "enum" field but you can use it to write your query and populate your "enum" field with the query results statically, and then when you change to another contact the query will be executed again and the field will be populated accordingly.

    Comment

    Working...