Skip to content

Instantly share code, notes, and snippets.

@kuratani
Created December 17, 2013 16:37
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save kuratani/8007952 to your computer and use it in GitHub Desktop.
Save kuratani/8007952 to your computer and use it in GitHub Desktop.
Salesforce1 Quick Action by Visualforce Page sample source code.
<apex:page docType="html-5.0" showHeader="false" sidebar="false" standardStylesheets="false">
<meta charset="UTF-8" />
<apex:includeScript value="/canvas/sdk/js/publisher.js" />
<script>
function changeOn() {
Sfdc.canvas.publisher.publish({ name : "publisher.setValidForSubmit", payload:"true"});
}
function changeOff() {
Sfdc.canvas.publisher.publish({ name : "publisher.setValidForSubmit", payload:"false"});
}
function closeAction() {
Sfdc.canvas.publisher.publish({ name : "publisher.close", payload : { refresh:"true" }});
}
function refreshFeed() {
Sfdc.canvas.publisher.publish({ name : "publisher.refresh", payload : { feed:true }});
}
Sfdc.canvas.publisher.subscribe(
{ name : "publisher.post", onData:function(e) { alert('Fire Post'); } }
);
Sfdc.canvas.publisher.subscribe(
{ name : "publisher.setupPanel", onData:function(e) { alert('Fire SetupPanel'); }}
);
Sfdc.canvas.publisher.subscribe(
{ name : "publisher.showPanel", onData:function(e) { alert('Fire ShowPanel'); }}
);
Sfdc.canvas.publisher.subscribe(
{ name : "publisher.clearPanelState", onData:function(e) { alert('Fire ClearPanelState'); }}
);
</script>
<h1>Sample Page</h1>
<button onclick="changeOn()">On</button>
<button onclick="changeOff()">Off</button>
<button onclick="closeAction()">Close Action</button>
<button onclick="refreshFeed()">Refresh Feed</button>
</apex:page>
@haripopuri
Copy link

Hi,

Except the refreshFeed, I don't see other buttons working. Especially I need close action and that is not working.

I have a VF page with close action, after I click save, the record saving fine and refresh feed is doing refresh. But the VF page is not auto collapsing. Also I need to refresh the left panel on saving this, is it possible?

Thanks in advance.
Hari

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment