You need to sign in to do that
Don't have an account?

Need to close the popup window when i click on a link
Hi,
I have embedded a VF page on Contacts, which pulls the campaigns for the said contact an end-user selects. I have created a 'Add to Campaign' button on this VF page, when I click on this button, it opens a window with standard filters like 'My Active Campaigns', 'My Camapaigns', 'All Active Camaigns', 'All Campaigns'. When I select a campaign, the pop window does not close on it own.
Here is the code sample I am using for implementing this functionality;
<apex:page standardController="Contact" sidebar="false" recordSetVar="Contacts" extensions="CampaignRecords">
<script type="text/javascript">
function openNewPage(){
var win='/_ui/common/data/LookupPage?lkpr=0031a000003tqzP&lktp=701&enableScopes=1&addToCampaign=1&retURL=%2F0031a000003tqzP';
openIntegration(win, 'height=500,width=700,location=no,resizable=yes,toolbar=no,status=no,menubar=no,scrollbars=1', 1)
//alert(contentId);
return false;
}
var previousOnload = window.onload;
window.onload = function() { if (previousOnload) { win.close(); } }
</script>
<apex:form >
<apex:sectionHeader title="Campaign History" subtitle=""/>
<apex:pageBlock id="campaigns">
<apex:pageBlockButtons location="top">
<apex:commandButton value="Type All" reRender="TabRefresh" >
<apex:param name="blTypeAll" assignTo="{!bltypeEmail}" value="TypeAll"/>
</apex:commandButton>
<apex:commandButton value="Type Email" reRender="TabRefresh" >
<apex:param name="blEmail" assignTo="{!bltypeEmail}" value="Email"/>
</apex:commandButton>
<apex:commandButton value="Type Others" reRender="TabRefresh" >
<apex:param name="bltypeEmail" assignTo="{!bltypeEmail}" value="typeOthers"/>
</apex:commandButton>
<apex:commandButton value="Add to Campaign" onclick="return openNewPage()" >
</apex:commandButton>
</apex:pageBlockButtons>
<apex:outputPanel id="TabRefresh">
<apex:pageBlockTable value="{!campgn}" var="o" rendered="{!NOT(ISNULL(campgn))}">
<apex:column value="{!o.Name}"/ >
<apex:column value="{!o.Status}"/ >
<apex:column value="{!o.Type}"/ >
</apex:pageBlockTable>
</apex:outputPanel>
</apex:pageBlock>
</apex:form>
</apex:page>
I have embedded a VF page on Contacts, which pulls the campaigns for the said contact an end-user selects. I have created a 'Add to Campaign' button on this VF page, when I click on this button, it opens a window with standard filters like 'My Active Campaigns', 'My Camapaigns', 'All Active Camaigns', 'All Campaigns'. When I select a campaign, the pop window does not close on it own.
Here is the code sample I am using for implementing this functionality;
<apex:page standardController="Contact" sidebar="false" recordSetVar="Contacts" extensions="CampaignRecords">
<script type="text/javascript">
function openNewPage(){
var win='/_ui/common/data/LookupPage?lkpr=0031a000003tqzP&lktp=701&enableScopes=1&addToCampaign=1&retURL=%2F0031a000003tqzP';
openIntegration(win, 'height=500,width=700,location=no,resizable=yes,toolbar=no,status=no,menubar=no,scrollbars=1', 1)
//alert(contentId);
return false;
}
var previousOnload = window.onload;
window.onload = function() { if (previousOnload) { win.close(); } }
</script>
<apex:form >
<apex:sectionHeader title="Campaign History" subtitle=""/>
<apex:pageBlock id="campaigns">
<apex:pageBlockButtons location="top">
<apex:commandButton value="Type All" reRender="TabRefresh" >
<apex:param name="blTypeAll" assignTo="{!bltypeEmail}" value="TypeAll"/>
</apex:commandButton>
<apex:commandButton value="Type Email" reRender="TabRefresh" >
<apex:param name="blEmail" assignTo="{!bltypeEmail}" value="Email"/>
</apex:commandButton>
<apex:commandButton value="Type Others" reRender="TabRefresh" >
<apex:param name="bltypeEmail" assignTo="{!bltypeEmail}" value="typeOthers"/>
</apex:commandButton>
<apex:commandButton value="Add to Campaign" onclick="return openNewPage()" >
</apex:commandButton>
</apex:pageBlockButtons>
<apex:outputPanel id="TabRefresh">
<apex:pageBlockTable value="{!campgn}" var="o" rendered="{!NOT(ISNULL(campgn))}">
<apex:column value="{!o.Name}"/ >
<apex:column value="{!o.Status}"/ >
<apex:column value="{!o.Type}"/ >
</apex:pageBlockTable>
</apex:outputPanel>
</apex:pageBlock>
</apex:form>
</apex:page>
I am calling JS function on 'Add to Campaign' button in VF page. So, I don't think I can return pagereference from JS. Do you agree??