You need to sign in to do that
Don't have an account?
MattMet86
Visualforce as Global Action - Publisher - How to close after submit?
Need some help, I can't figure out how to close the publisher window once my record has been saved.
Can someone tell me how to do this?
Controller:
Page:
Can someone tell me how to do this?
Controller:
public class ContestEntryController { public Contest_Tracking__c contest { get; private set; } public BCS__c hub { get; private set; } public ContestEntryController() { //Capture choices contest = new Contest_Tracking__c(); //Find Hub for user hub = [Select Id FROM BCS__c WHERE User__c = :UserInfo.getUserId()]; } public PageReference save() { try { contest.Contest_Name__c = contest.Picklist_Contest_Name__c; contest.Related_to__c = hub.Id; contest.User__c = UserInfo.getUserId(); contest.Keyword__c = contest.Picklist_Contest_Name__c; insert(contest); return null; } catch(System.DMLException e) { ApexPages.addMessages(e); return null; } } }
Page:
<apex:page controller="ContestEntryController" showHeader="false" sidebar="false" tabStyle="Contest_Tracking__c"> <script> function refreshFeed() { Sfdc.canvas.publisher.publish({name : 'publisher.close', payload : {feed: true}}); } </script> <apex:form style="width:90%;margin:auto;" > <apex:pageBlock mode="edit" > <!-- Enter Contest --> <apex:pageBlockSection columns="2" showHeader="true" title="Create Contest Entry"> <apex:outputLabel value="Contest Name"/> <apex:actionRegion > <apex:inputField value="{!contest.Picklist_Contest_Name__c}" required="true"> <apex:actionSupport event="onchange" reRender="MarchMadness"/> </apex:inputField> </apex:actionRegion> <apex:outputLabel value="Contest Vote"/> <apex:actionRegion > <apex:inputField value="{!contest.Picklist_Contest_Vote__c}" required="true"> <apex:actionSupport event="onchange" reRender="MarchMadness" /> </apex:inputField> </apex:actionRegion> </apex:pageBlockSection> <!-- Button Section --> <apex:pageBlockButtons location="bottom"> <apex:commandButton value="Submit Entry" action="{!save}" oncomplete="refreshFeed();" /> </apex:pageBlockButtons> <!-- Rules --> <apex:pageBlockSection columns="1" showHeader="true" title="Contest Rules"> <apex:pageblocksection id="MarchMadness" columns="1"> <apex:outputPanel styleClass="rules" style="width:80%" rendered="{!contest.Picklist_Contest_Name__c == 'March Madness'}"> 1. Be sure to complete you bracket at CBS Sport to be eligible for prizes.<br /> 2. Guess your champion here to earn 10 points for Culture Club.<br /> <br /> If you did not get a CBS Sports bracket invitation, please email Jim.<br /><br /> </apex:outputPanel> </apex:pageblocksection> </apex:pageBlockSection> </apex:pageBlock> </apex:form> <!-- CSS --> <style> .logo { float: right; width: 200px; margin: -65px 20px 0 0; padding: 20px; } .rules { color: black; font-size: 18px; float: left; width: 100%; } </style> </apex:page>