tags:

views:

28

answers:

1

Hello,

I am trying to relate phone calls to multiple records in Salesforce. The records are in two different custom objects, but you can think of the records like a Lead or an Opportunity. Our salespeople call multiple people (Leads) for given Opportunities, and I'd like to capture both pieces of information.

Is this possible in Salesforce? My current layout has a "Related To" tab that populates when you navigate to a given record, but it forces you to choose one record before auto-saving. Is it possible to have a format that maps the Activity generated by the call to multiple records?

This could be a format with multiple drop-down "Relate To" menus. Better yet, I could use a field that allows you type a record number in to to a free-response field to relate it to an Opportunity.

Thanks!

Austin

P.S. We are running Salesforce Professional with API. We are using a CTI adapter from BroadSoft.

A: 

I don't know the BroadSoft adapter and I couldn't find it on Salesforce AppExchange to give it a test run. But assuming it's a typical plugin for Salesforce, you'll have little control over it (i.e. cannot add a helper junction object that would act like many-to-many relationship bridge).

You should have no problems writing a piece of Visualforce to suit your needs though (especially the later requirement - use some text filter to display list that matches this filter).

I'll write a quick example. My business requirement for the sake of this example is "I want to show all Activities whose Subject field matches text I've put on new field in Opportunity, regardless whether they are linked or not. This should appear as similar to normal related list on Opportunity".

  1. Add text field called "record" to your Opportunity object.
  2. Create an Apex class:

    public class AustinTest { private Opportunity o;

    public AustinTest(ApexPages.StandardController controller) {}
    
    
    public List<Event> getActivities() {
        Opportunity o = [SELECT Id, Record__c 
            FROM Opportunity 
            WHERE Id = :ApexPages.currentPage().getParameters().get('id')];
    
    
    
    String searchTerm = '%' + o.Record__c + '%';
    return [SELECT Id, Subject, Type FROM Event WHERE Subject LIKE :searchTerm];
    
    }

    }

  3. Create a Visualforce Page:

    <apex:page standardController="Opportunity" extensions="AustinTest"> <apex:pageBlock> <apex:pageBlockTable value="{!activities}" var="a"> <apex:column value="{!a.Id}" /> <apex:column value="{!a.Subject}" /> <apex:column value="{!a.Type}" /> </apex:pageBlockTable> </apex:pageBlock> </apex:page>

  4. Go to the Page Layout editor for Opportunities and drop the Visualforce somewhere on the page. We have to drop it in the "detail" area (like normal fields, not like Related Lists), that's fine for now.

  5. Experiment with it, decide if it's worth spending time on. With extra bit of tweaking we can make it display similar to normal Related List. I'll write more if needed. How would you like to have this list of matching records accessible anyway? As a separate tab? Related List? Something else?

eyescream

related questions