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
EricLehnenEricLehnen 

Relating custom object to two standard objects

Here is my situation:

 

I am trying to develop a report which identifies the all the contacts related to accounts using a specific product so I can add them to a campaign.

 

We have a custom object called "Products" which is a tab that lists all of the competitor Products in our industry. Our other custom object is called "District Product" and it is a related list in Accounts that shows all the Products that an account is using.

 

I contacted support and said that I am unable to create a report to add Contacts to a campaign using Report Type because "Products" are related to an Accounts, not Contacts (I tried relating them to Contacts, but they didn't populate for some reason). However, they reccomended that I am able to create custom forumla fields that will look up the the products that an account is uing and populate those fields under the related contacts.

 

So, if Account A is using Product B, I would like all the Contacts related to Account A to display Product B in a field (as support reccomended) or another way such as displaying the "District Product" custom field in Contacts and have them populated. To play it safe, I think I should go with the formula field approach.

 

What would they formula fields look like? Any help is much appreciated!

EricLehnenEricLehnen

Here is the response I recieved from Support:

 

The custom report that you would like to build at the moment will not be possible unless a joined report is created and the only issue is that we will not be able to add the contacts to the campaign from the joined report or be able to export it. In regards to setting up a custom report type, this will not be possible due to the relationships that the three objects you are looking to include share. The way that custom report types work is that the B object is related to the A object and if you add a C object, it will be related to the B object. We unfortunately cannot have a B and C object both related to the A object in the custom report type.

The issue here, as we saw, is with the object relationships of accounts, contacts and this custom objects district products. The way to pull this report would be if the district product is related to both the account and contact. The way that I was able to find that you would be able to do this would be through custom formula look up fields. My recommendation would be to create in the Product District custom object a formula look up for the account relationship field and the product relationship field. I believe it would be possible to have the district product automatically associate to both the account, contact and product through a cross object look up formula field. With the same information appearing within the account and the contact, you can then run the Contacts with District products report to obtain the date you are looking for.

MrTheTylerMrTheTyler

Howdy Eric,

 

  Since your end-goal is to move these contacts into a campaign anyhow, I would suggest not even bothering with the reports and do this through code.  It'll save alot of time.

 

 

Kind Regards,

 

Tyler Hudson
Contact Us - We Can Help!

Salesforce Superheroes
------------------------------
help@salesforcesuperheroes.com
www.salesforcesuperheroes.com
1-888-407-9578 x123

EricLehnenEricLehnen
Hello Tyler, I understand, but I need to identify the contacts using a specific product and add them to campaigns. It is absolutely essential. Eric Lehnen
MrTheTylerMrTheTyler

The identification of these contacts can be done in code and then spit out to the simplest of visualforce pages or in a debug statement...perhaps I'm not understanding your objectives completely?

 

 

Kind Regards,

 

Tyler Hudson
Contact Us - We Can Help!

Salesforce Superheroes
------------------------------
help@salesforcesuperheroes.com
www.salesforcesuperheroes.com
1-888-407-9578 x123

EricLehnenEricLehnen
I do not know any code and the use of code would be redundant. This is because my company purchased salesforce to eliminate complicated procedures such as code. Is there a way to identify these contacts without the use of code or by building a procedure that can be used more than once? Cheers, Eric Lehnen
EricLehnenEricLehnen

Would it be possible to query these people and then add them to a campaign via code?

MrTheTylerMrTheTyler

Certainly.

 

 

Kind Regards,

 

Tyler Hudson
Contact Us - We Can Help!

Salesforce Superheroes
------------------------------
help@salesforcesuperheroes.com
www.salesforcesuperheroes.com
1-888-407-9578 x123

EricLehnenEricLehnen

Thank you for the quick reply, Tyler.

 

Would this functionality only come from code, or can it be done by building out what the Support Rep reccomended?

 

Please excuse my iggnorance, I wish I knew more about SFDC.

MrTheTylerMrTheTyler

Hi Eric,

 

  Typically you would run a report to gather contacts for a campaign but because "we will not be able to add the contacts to the campaign from the joined report or be able to export it" I'm thinking you can do one of two things:

 

  1. Do your reporting and migration to campaigns using custom code
  2. Create a boolean field on your contacts and use custom code to set the flag if the record meets your campaign condition.  In this way you can run a more simplified report which will then allow you add the contacts to the campaign directly from the report.

 

Kind Regards,

 

Tyler Hudson
Contact Us - We Can Help!

Salesforce Superheroes
------------------------------
help@salesforcesuperheroes.com
www.salesforcesuperheroes.com
1-888-407-9578 x123

EricLehnenEricLehnen
Thanks for the help, Tyler! We would really like to use ad-hoc reports for market research, but if what you're saying is true, it looks like custom code is the most feasible. Now, with this custom code, would we have to run multiple custom code queries each time we need it? Or could we build custom code code which functions like a button and could be added to a report? Cheers, Eric
MrTheTylerMrTheTyler

No worries, Eric.  So, I'm not saying abandon ad-hoc reporting across the board.  I'm simply saying, based upon the technician's assesment of the situation, that reporting in this situation won't allow you to get your list of contacts added to a campaign.

 

In this one situation we are discussing - I think the most efficient approach is to build a custom visual force page that serves as a report for you to visually verify the contacts and, on that page, you would have a button that adds the listed contacts to a campaign of your choosing.

 

Kind Regards,

 

Tyler Hudson
Contact Us - We Can Help!

Salesforce Superheroes
------------------------------
help@salesforcesuperheroes.com
www.salesforcesuperheroes.com
1-888-407-9578 x123

EricLehnenEricLehnen

I understand. We just have a lot of business resources relying on this functionality.

 

Since I doubt I would be able to learn code in the short amount of time we need this functionality, I looked into purchasing the Premier Success+ support plan, but I don't think that includes VisualForce support. Does SFDC provide any support into this matter?

 

Cheers,

 

Eric

MrTheTylerMrTheTyler

Our clients typically find that the SFDC support is good for small functionality issues but once things get a bit more complex they work with us.

 

Kind Regards,

 

Tyler Hudson
Contact Us - We Can Help!

Salesforce Superheroes
------------------------------
help@salesforcesuperheroes.com
www.salesforcesuperheroes.com
1-888-407-9578 x123