36
Views
26
Comments
Contacts list in a dropdown

I have an application, where under the company i have option to add contacts, as you can see in the screenshot.  Now For Amce inc two contacts are created.

 Requirement is that when i create an opportunity, in the opportunity screen as i shown when i select the company as Amce Inc , i want to have a option to select all the contacts listed under company in this example two contacts there might be many contacts as well.  When i click on add more contacts button i should get a respective comany related contacts to select from the dropdown. In the oppurtunity details screen below Add members


UserImage.jpg
Supriya Malla

Hi @Gaganashree Lohit,

You can achieve this by adding a condition in your aggregate that filters contacts based on the selected company. Specifically, use:

Contact.CompanyId = SelectedCompanyId

This way, when you select a company on the Opportunity screen, the aggregate will fetch only the contacts associated with that company, which you can then show in your "Add More Contacts" dropdown or popup.

Let me know if you need help setting up the dropdown or adding selected contacts to the Opportunity!

Thanks,

Supriya

2026-01-28 16-57-48
Mihai Melencu
Champion

Hi,

As Supriya mentioned, you will need the add the filter. Besides that you need to set the Fetch property of the aggregate to Only on demand. And refresh the contacts aggregate when you select a new company.

UserImage.jpg
Gaganashree Lohit

Hello Mihai,

Where exactly i have to do this set up. I should have a dropdown, for that i need select Variable , list, text and Value right. Consider Contact Entity, You and supriya saying that add filter to the contact entity and select that uder list for drop down, is my understanding correct?. One more thing is that what should i used for the variable?

2026-01-28 16-57-48
Mihai Melencu
Champion

You should use the variable where the value needs to be stored, depending on the specific logic you're implementing. 

UserImage.jpg
Gaganashree Lohit

I am totally confused Mihai, I do not want to store the Value anywhere, i ust want to retrieve the data , If the Oppurtunity selected Amce company under the dropdown i should have the only the cintacts associated with that Comany,

UserImage.jpg
Supriya Malla

Here’s how you can implement 

Let's say you have two dropdowns: Company dropdown and Contacts

You'll have two aggregates: Company which has to fetch at start and contacts which should fetch only on demand

In the Contacts aggregate Filter the value i.e contacts.CompanyId = SelectedCompanyId (the variable you used for the company dropdown)

In the Company dropdown on change event refresh the contacts aggregate

This will load only the contacts related to the selected company when needed. 

Check the sample demo attached. 

Thanks,

Supriya

Company.oml
UserImage.jpg
Gaganashree Lohit

Hello Supriya Thanks for the OML,

In my Requirement i will be not having drop down option to select the company. Instead i will explain step by step,

1. As soon as i publish it Quick CRM Application Apperas. When i click on Comanies in the Home Page List companies dashboard appaeras.

When i click on the Comany Acme inc, the following screen appears. As you can observe Acme company has two contacts and has option to add more Contacts.

My Requirement is to craete new oppurtunity,in the Opportunity page cick on New+,

The following screen apperas, when i select Acme,inc as comapany in the New oppurtunity, and fill all the mandatory fields and save , new oppurtunity will be created.

Open the created oppurtunity with Acme,inc as comapny, it looks like below,

What i want is Under Add menbers , i need add contacts option, so that in that dropdown only contacts present in the comapny should appers. Example as i shown

Since i have created oppurtunity with the comapny Acme,inc under the add contact dropdown i should see only those 2 contacts in the drop down.

Please help me on this.

I have done this on my screen 1.


UserImage.jpg
Supriya Malla

Hi @Gaganashree Lohit,

Thank you for the brief explanation!

From what I see, you're currently filtering the aggregate using selectedCompanyId. Instead, you can directly use the CompanyId attribute from the GetLeadById .

Set the GetContacts aggregate to "Only on Demand."

In the On After Fetch event of the GetLeadById, refresh the GetContacts aggregate

Now you can see the contacts related to that particular company

Let me know it you need anything.

Thanks,

Supriya

UserImage.jpg
Gaganashree Lohit

Hello Supriya, i just want to clear one thing is that to show the comapany contacts i have added button, as soon as i click on that button a dropdown shows. My question is what to be set in that dropdown?

UserImage.jpg
Supriya Malla

Assign the contacts aggregate that you are filtering using the selected company ID also take a local variable of contacts Id for the variable

UserImage.jpg
Gaganashree Lohit

You told to remove the filter from Contact aggrt righ "Contact.CompanyId = SelectedCompanyId ",

So i removed. Please exactly tell me what needs to be in the below data,

1. GetContact Aggregate

2. GetLeadById Aggregate

3. In the Company Aggregate

4. In the dropdown

5. If any client action to be created.

This would be very helpfull

UserImage.jpg
Gaganashree Lohit

Hello Team, Can anyone help me on this issue?

UserImage.jpg
Supriya Malla

I think there might be a bit of confusion regarding my previous reply. I mentioned to use CompanyId instead of SelectedCompanyId, what I actually meant was:

Contacts.CompanyId = GetLeadById.Current.Lead.CompanyId

To clarify further, here are the steps to make sure everything is set up correctly:

here are the steps:

  1. GetLeadById Aggregate

    • This should be set to Fetch on Start.

  2. GetContactsByCompany Aggregate

    • Set this to Fetch Only On Demand.

  3. On After Fetch (of GetLeadById)

    • Use this event to refresh the GetContactsByCompany aggregate.

  4. Add a Filter to GetContactsByCompany

    • Use the following condition:

      Contacts.CompanyId = GetLeadById.Current.Lead.CompanyId

  5. On Button Click

    • This should trigger the logic to show the dropdown.

  6. Dropdown Setup

    • Add a local variable of type Contacts Identifier to store the selected value.

    • Set the List property of the dropdown to: GetContactsByCompany.List

    • Set:

      • Text Property → Contacts.ContactName

      • Value Property → Contacts.Id

UserImage.jpg
Gaganashree Lohit

Hello Supriya, Thank you so much for your patience. The functinality is not working , here you can see i have comany called FOO BARS in the screen shot and it has one contact.

When i select this comany in the oppurtunity, under the dropdown of contact i should get only this contact right, but instead i am gettng only this for all the comany i select in the oppurtunity.


UserImage.jpg
Supriya Malla

Can you try giving the company id 100 in the test value of the getcontactsbycompany aggregate and see if you are getting the Zachary woodfork contact there

UserImage.jpg
Gaganashree Lohit
UserImage.jpg
Supriya Malla

Now can you check the company id in the getleadbyidfortesting aggregate by giving the test value of the lead id as 3?

You have to get the Company Id record as 100

UserImage.jpg
Gaganashree Lohit

No filter in the getleadbyidfortesting Aggregate, should add Lead.id = Leadid?

UserImage.jpg
Supriya Malla

You need to add a filter to that aggregate then you'll get the details of that particular lead

UserImage.jpg
Gaganashree Lohit

Ok, I will try.

UserImage.jpg
Gaganashree Lohit

Hello Supriya,

It worked and in the dropdown i can see the related contacts only.

I also want to include a feature that, if i select a contact from the dropdown upon saving it should show on the table below the add Contacts button.

I have done the below information but failing to save. Could you please help me?. You can see the right side widget tree for more info.

This is the logic,


UserImage.jpg
Supriya Malla

Hi @Gaganashree Lohit,

What are the parameters that you are passing to the Create lead contact?


UserImage.jpg
Gaganashree Lohit

Hello Supriya, as you can see in the screenshot, I am able to save the select contact from thr dropdown into the LeadContact table. Now i want to show that in the UI only the contact selected not the entiree table


UserImage.jpg
Supriya Malla

In your previous post, you mentioned that you are encountering an issue where you're unable to save the lead contact. If you're able to save the contact in the LeadContact entity successfully, the next step is to verify whether the record is present in the entity.

  1. Ensure that the record is indeed being saved to the LeadContact entity. 

  2. If the record exists,  On the screen, create an aggregate to retrieve the LeadContact data. Join the LeadContact entity with the Contacts entity.

  3. Add a filter in the aggregate to ensure that only the relevant contacts are fetched: LeadContacts.LeadId = LeadId

  4. Create a table on the UI to display the data from the LeadContact entity. Bind the aggregate results to this table.

  5.  In the "Save" action, make sure to refresh the aggregate after the save operation.

Thanks,

Supriya


UserImage.jpg
Gaganashree Lohit

I have This entity "Lead Contact" with the attributes as shown,

Whatever i am saving in the UI directly saved in the ContactId attribute.

In that Case filter should be "LeadContacts.ContactId = ContactId"

I want to clear onething, I do not want to show all the contacts prosent in the Entity on the screen, only the one i selected from the dropdown.

UserImage.jpg
Gaganashree Lohit

Hello Can anyone help me on the above issue


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.