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

Advice from SalesForce developer desperately needed.

I’ve spent past few weeks studying the ins and outs of developingon SalesForce with our goal in mind.

As mentioned during our call, what we wish to achieve is to beable to create one to many relationship between Leads and custom object.

I’ll try to explain it as much as I can below and my hope isthat you can forward this email to any salesforce developer you can connect meto for advice.


We currently have web-to-lead set up where we collectvisitor information. Selected leads are converted intoAccounts/Contacts/Opportunities.

Some leads will never get converted. The data we collectfrom the website occurs on following fashion.

1.      Visitor clicks on one of many document todownload. If visitor cleared their browser cookie or never been to our site, wecollect their information before sending them to download site.

2.      When user fills out the form, this informationis sent to SalesForce via web-to-lead functionalities.

3.      Every other documents they download are not sentto SalesForce but rather emailed to our internal user.


Problem we need to solve from above process are:

1.      Duplicate leads can get generated in SalesForceand these needs to be manually merged.  

2.      Documents downloaded needs to be tracked notjust as picklist but as one to many relationship to a custom object. We need totrack downloaded title, download date and few other information.

a.       Whenconverted, these custom object relation needs to be reflected.

3.      As mentioned above in step 3, we need a way totrack other document downloads directly in SalesForce without having to openleads each time they download a document.


Based on my current research, I’ve tried to come up withsome strategies to solve these issues.

Issue #1: Duplicate leads

                Withthis issue, I experimented with trigger to solve the issue. Initially, I wantedto NOT create the lead if the incoming lead was deemed duplicated.                

Leads would be considered asduplicate if other leads existed in the Lead object with same email address.However, I’ve failed in this attempt since triggers are transaction based.

Alternative method which hadpossibility  was to allow the creation ofduplicate lead but mark the status as Closed – Duplicate.


Issue #2: Lead(one) to Downloads (Many)

I am very puzzled with this issuedue to my lack of knowledge of SalesForce. I know that leads can’t be mapped toother object as Master/Child relationship and it put a huge road block onresolving this issue.

Alternate solution I’ve thoughtabout was simply creating custom object without the relationship.  My thought process was to use on after inserttrigger on lead to create new record in the custom object with Lead ID, LeadEmail Address, Downloaded doc, download date.

Once this was accomplished, I wouldcreate custom button or link on lead detail page to query custom object to displaylist of downloads. Initial coding of this failed because I was not able to hookup VisualForce page to the lead detail screen. I believe this maybe my lack ofknowledge on coding visualforce with apex.


Issue #2a: Download tracked even when converted

I’m a bit lost on how to accomplishtackle this issue. My initial thought was to create relationship betweenContacts and Custom Object to track the downloads. If I could resolve issue #2,I could possibly add on after insert on contact to move the data over to mappedcustom object to track customer id to downloads. All the historical datacollected with it was a lead needs to be carried over.


Issue #3: Track Multi downloads

I feel like I could potentiallyaccomplish this if all three issues are some how resolved, by creating customweb service. Again, my lack of knowledge of creating web service very minimalso I may be barking up the wrong tree here. 

If I could find a way call SalesForceand automatically populate custom object every time they download a document,it’ll save our company from doing manual merging.


Hi i could definiely help you out on this. i have lots of experience in salesforce

development. you could drop an email on

available on chat on following messengers


gtalkl: sforce2009