+ Start a Discussion
RVJRVJ 

Auto populate Primary Campaign Source on 'New' Opportunity Button

Hi - we have just gone live with SF Partner Portal and have partners creating opps - however, we would like a specific campaign to be populated on creation.

 

I have found that I am not able to do this using standard workflow, and I would like to avoid apex coding as we do not have a developer on board.  I have been looking at using a custom 'new' button to pre-populate the field but I can't get this to work, so far I have:

 

https://eu1.salesforce.com/006/e?opp17_lkid=701D0000000ttOD 

 

Of course this is assuming that I can hide the list view button, if not any advice on the code needed?

 

Any help much appreciated, many thanks.

lakslaks

Hi,

 

How are you creating the Opportunities ? Is it by directly going to Opportunities tab & clicking on 'New' ?

Or is it by going to the Campaigns tab and clicking on 'New' in the Opportunities related list ?

 

In the 2nd method, by default the Opportunities page will be opened with the Primary Campaign Source populated with the name of the Campaign from which you were redirected to the Opportunities page.

 

To get the Campaign populated on the new creation page of Opportunity you would require &campid=<15 digit id> eg:&campid=70190000000IUOh to be appended to the URL when the page is loaded.

 

One way of achieving the same would be as below: 

- Override the 'New' button of Opportunity object with a Visualforce page.

- Write a controller to be referenced by the Visualforce page.

In the controller write a method to frame the URL by appending  &campid=<15 digit id of the Campaign required>

 

Hope this helps.

 

Regards,

Lakshmi.

RVJRVJ

@laks - many thanks - the link now works internally and populates the campaign, although it is not working through the partner portal when a partner creates an opp.

 

The partner creates an opp through a custom home page link or through the standard 'new' button on the opportunities list (so I would need to override that one I think).

 

I have checked and the partner has access to read campaigns - the only thing is that the campaign field is not visible on the page layout so perhaps this needs to be a must.

OyeCodeOyeCode
This worked for me 

https://cs12.salesforce.com/006/e?
retURL=%2F006%2Fo

&RecordType=01270000000M9SN
&ent=Opportunity
&opp11=Above - Marketing Qualified Lead
&opp7=1
&campid=
&opp3={!Account.Name}
&accid={!Account.Id}
&opp17={!Contact.Primary_Campaign__c }