New at Mendix, trying to create a mail form-like function.

Hi, I've been following the free courses and created some pages with data and now know how to set up the basics and filter stuff. I set a goal for myself to get an application working where you have a database of companies (with zip code for location) and another database with leads that can be distributed based on location. I just enter a few leads (with only name and zip code attributes) and in the data view I wanted to add a button labeled "Distribute". The action that follows would be a popup page that would show all companies that are in the same zip code area and using checkboxes I would be able to send that lead to the selected companies. This action is where I'm stuck. I know how to query the companies by location (using XPath constraints), but I'm not sure how to use the zip code from the leads object to filter the correct companies by location. Also, once that works, how would I make the resulting list selectable to follow up with another action (like sending them a mail) to those selected companies? Anyone have any tips (or perhaps working applications that I can check out) that work like this? You could compare it to a simple mail form in PHP when someone enters "New York" as their city and the "lead" would be mailed to only companies that are based in New York. Thanks in advance! Dennis.
1 answers

Hi Dennis. Assuming you later want to know exactly what selection you passed to the company you have to create a relationship (something like 'CompanyLeadAllocation) entity containing Associaton-to-Company, Association-to-Lead, MomentSelected and a boolean 'Selected'. Now if you need this relationship anyway, you can use it to solve your challenge. 1) Have all companies on a form with a number of filters and an action button 'zip-code' connected to a microflow 'filteron_ zipcode'. 2) Now on this form you can select on a number of criteria you like. Select a specific company. 3) When clicking the zip-code button pass this company to the microflow. You know you want to select on zipcode. 4) In the microflow create a list of ALL leads. 5) Filter this list on the zipcode required. 6) Create a CompanyLeadAllocation for every lead selected. 7) Show a form on CompanyLeadAllocation allowing the user to switch the boolean 'Selected'. 8) Send every CompanyLeadAllocation with Selected flagged to the company. You now know exactly what you mailed to the company later.