You need to sign in to do that
Don't have an account?
Squire Kershner
Add "Add to Campaign" button to visualforce related list
I was asked to add a filtered related list to Contact, and accomplished this with visualforce. I created a visualforce element that limits the campaign history, added it to the layout, and then removed the orignal Campaign History related list. However, the request also asks that the new element now have the orignal "add to campaign" button on it. However, I've tried multiple ways of getting the button transferred to the new element with poor results.
The best effort was using the following:
<apex:commandButton value="Campaign Member Assignment" action="{!URLFOR($Action.Contact.AddToCampaign,Contact.Id)}"/>
It opens the Campaign Member page inside the Visualforce element (bad) and doesn't actually save the member (also bad).
Help?
The best effort was using the following:
<apex:commandButton value="Campaign Member Assignment" action="{!URLFOR($Action.Contact.AddToCampaign,Contact.Id)}"/>
It opens the Campaign Member page inside the Visualforce element (bad) and doesn't actually save the member (also bad).
Help?
<apex:page standardController="contact">
<apex:form >
<apex:commandButton value="Campaign Member Assignment" action="{!URLFOR($Action.Contact.AddToCampaign,Contact.Id)}"/>
</apex:form>
</apex:page>
It went to the campaign member page aand it did add the contact to the campaign.
Would you be able to elaborate a little more on the exact behavior you are seeing and detailed replication steps?
1) The button opens the Campaign Add Members page inside the visualforce element.
2) It doesn't first open the Lookup (like the standard button does)
3) If you click the magnifiying glass to find a Campaign, and then select the [Add to Campaign] button, the resulting page states
"0 new members have been added to the campaign "Demo Campaign" with a Status of "Sent"."
And the contact is not actually added to the campaign.
Are you saying you are able to successfully add the contact per standard functionalty?
And here's the extension
Basically you're creating a custom HTML form that uses the dynamic URL generated by $Action.Contact.AddToCampaign as the action. Furthermore, the form must use HTTP POST (i.e., method="post").