function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
DMRaeDMRae 

Visualforce Page: List showing matching records / Text field

Hey there,

I'm new at Visualforce and like to create my first page.

Imagine the following setup: 

You have a custom object called Event. An Event may be a congress or a trade fair. Within the object you have the text field "City__c". 

Now you're working on a Lead from Dallas. Means: The standard field "City" equals "Dallas". Wouldn't it be great now to see all events taking in place in Dallas? I'd like to built a Visualforce Page list, that shows all Event records where the Lead field "City" is matching the Event field "City__c". I'm happy with 3 - 4 columns in the list.

Any idea how to build this? Feel free to provide me with sample code that is applicable for my project.

Kind regards,
David
BillPowell__cBillPowell__c
DMRae, wouldn't you do this with a custom report or list view from a campaign custom field? 
DMRaeDMRae
Hi Bill,

thanks for your quick reply. You're right! With a custom report I'd be able to match those two object types. But how can I bring the magic of custom reports to the Lead layout? It's easy to add the report to the layout. But the real magic is, that only records will show up that meet the matching criteria "City". Imagine the records have no relationship yet. Tell me, if I'm on the wrong track. If I'd be using Campaigns, I guess it would mean that there must be an existing relationship established by a lookup field. 

Looking forward to your ideas!
BillPowell__cBillPowell__c
Well what I mean is why not use campaigns and replace the "Events" object, because you're somewhat duplicating effort, unless you're already using campaigns for something else? A company I worked for previously used campaigns to track events Sales reps attended, with some custom fields and automation
DMRaeDMRae
Thanks, Bill.

"Events" are examplary for a variety of objects that I'd like to display in that way. The slogan is "Showing records that have something in common with the record I'm working with right now". It also goes for "Use Cases". Example: The rep works on a Lead with the industry "Fashion". In a list he sees all Fashion use cases at a glance within the Lead record he's working with. Of course you can realize it with a Related List. But it would mean that you have to establish a relationship for each record. So for me, a Visualforce Page sounded like the last choice. What do you think?
BillPowell__cBillPowell__c
So kind of like "Similar Opportunities" ?
DMRaeDMRae
Yes, it goes for each and every object.