Show both "name" and "customer_number_c" in the SQS for Accounts

I have changed our Accounts default filters to allow the users to enter a Name or Customer Number when linking an Account to other records in our SugarCRM via Relate Field (be it an actual relate field or one defined by a 1:M relationship).

When they search using the SQS they would like the SQS dropdown to display both Name AND Customer Number.

For example, when entering customer number 123 in the relate field's SQS it will pull up accounts with customer number 123 but also 1234 and the dropdown will display only the account names, and not the customer number.

Ideally they want to see both "Name CustomerNumber" or "Name (CustomerNumber)"... you get the idea.

Thanks,
Francesca

  • SQS like in BWC mode? Do you mean in Sidecar? Can you provide some screenshots?

  • I mean the dropdown in a Relate field (I always called the results from typing in the relate field the SugarQuickSearch SQS, please let me know if I'm using the wrong terminology.

    I set it up so I can search by Name OR Customer Number, but I can't get it to display both in the resulting dropdown.

    Thank you,
    Francesca

  • I understand this functionality must work same quick search, i remember that section are a layout that content some views between theses "quicksearch-results" may be are help to you.

    In other case i see the code of clients/base/fields/relate/relate.js
    and exists one function called search() into retrieve data from module and i want show yourself this code, the coments with this characters "<--" maybe give you a idea.

    This is result

    Cheers

  • Thank you , this looks like what I need! 

  • It puts me a step further, but I've not solved it yet Slight smile
    I was hoping not to have to override the method, rather extend it... so I need to do a bit more digging. But thank you for pointing out where the text is set. I appreciate it!

  • Are you show me the fragment of your code? May be I give to you other idea.

  • I don't have any code yet, I'm thinking through the better solution, but thank you for the offer!

    I'm thinking that to stay inside the framework, I am going to define a non-editable calculated field that will concatenate name and number and use that as the rname.

    Or reverse engineer the full_name on Contacts/Leads and do something similar.

    I looked at db_concat_fields, but the way the query is composed does not allow for custom fields to be used... so I need to dig deeper into the code to see what else I could do.

    Thanks!

  • ,

    I tried to imitate the "full_name" field that we have in Contacts and Leads to build a non-db field that would allow me to use a concatenation of Account Name and Customer Number (custom field) in the rname for the Account relate fields.

    I looked at using db_concat_fields in the vardefs to combine the two fields, but the way the query is composed it looks like it does not allow for custom fields to be used in that variable, the resulting query is trying to add it as a field in the accounts table instead of the accounts_cstm table.

    Vardefs tend to be very flexible in sugar, so I find this rather unusual, do you know if this limitation is by design?

    Is there a better way to achieve what I need?

    Thanks,
    Francesca

  • Perhaps a different way of thinking about this, but could you:

    1. Create a new text field called customer_name - copy the data from the current name field into it
    2. Add the custom name field onto the record view layout so its editable by users
    3. Make the core name field a calculated value and concatenate the customer number and name fields as Name (CustomerNumber)
    4. Recalculate calculated values for all records via listview

    Based on my understanding of your original post, this will match people based upon the customer number in its existing field, and the name which is still the start of the core name field - but as the full name field is now calculated, it will display that in all the expected places, including the type ahead dropdowns when setting relationships.

1 2