Home > ribbon > How do I make a custom publish button for a page and make it do the same as the ribbon publish button?

How do I make a custom publish button for a page and make it do the same as the ribbon publish button?

January 13Hits:8
Advertisement

How do I make a custom publish button for a page and make it do the same as the ribbon publish button? We have a request from the customer to make a simple page that should have a custom publish button in addition to the publish button in the Ribbon (see picture). I have searched google and tried, but could not find any solution to this.

A possible solution could involve the SPContext.Current.File.Publish("myComment"); but this demands a lot of custom handling if there is a workflow?

How do I make a custom publish button for a page and make it do the same as the ribbon publish button?

Answers

ExecuteOrDelayUntilScriptLoaded(function () {
        var pageStateGroupPublishValue = SP.Ribbon.PageState.PageStateCommands.pageStateGroupSubmitForApproval;
        SP.Ribbon.PageManager.get_instance().executeRootCommand(pageStateGroupPublishValue, window.g_CUIcommandProperties, { CommandId: pageStateGroupPublishValue }, null);
    }, "sp.ribbon.js");

@Andrey Markeev, Looks like window.g_CUIcommandProperties is undefined on some pages. This code worked for me:

<script type="text/javascript">
    function Custom_Submit(command)
    {
        SP.Ribbon.PageState.Handlers.showStateChangeDialog(command, SP.Ribbon.PageState.ImportedNativeData.CommandHandlers[command]);
    }
</script>
<input type="button" onclick="javascript:Custom_Submit('PageStateGroupPublish'); return false;" value="Publish" id="btnPublish"></input>

Related Articles

  • How do I make a custom publish button for a page and make it do the same as the ribbon publish button?

    How do I make a custom publish button for a page and make it do the same as the ribbon publish button?January 13

    How do I make a custom publish button for a page and make it do the same as the ribbon publish button? We have a request from the customer to make a simple page that should have a custom publish button in addition to the publish button in the Ribbon

  • Can I modify the Icon in a Salesforce1 Custom Button accessed Visualforce Page

    Can I modify the Icon in a Salesforce1 Custom Button accessed Visualforce PageFebruary 3

    I have a requirement where a user needs to be able to access a Quote object in Salesforce1, and then navigate to a related Visualforce page for the Quote while still in Salesforce1 on their mobile device. I am aware for most objects, navigating to a

  • Is there a way to nest buttons on a custom ribbon split button or flyout?October 6

    Is there a way to nest controls/buttons under a ribbon split button or flyout? I have a problem where I need to give some hierarchical representation to the menu items. For example: [category 1] -- [item 1] -- [item 2] -- [item 3] -- [item 4] [catego

  • Disable custom button on detail page on some condition..?January 23

    I have custom button on standard detail page...I want to disable that button/gray out if my status picklist value is "Approved". Java script on button click var newRecords = []; var o = new sforce.SObject("Opportunity"); o.id ="{!

  • How to share JavaScript between Custom Buttons and Visualforce pages?

    How to share JavaScript between Custom Buttons and Visualforce pages?June 27

    Is there any way we can add Execute Javascript custom page button to Visualforce page and reuse it. I am just checking if any way we can save writing JS code is button again in VF page. MY Visualforce page in Question is StandardController Page. ----

  • custom button on standard page layoutDecember 6

    I have radio button on vf page and added this vf page to the page layout , in which i have a onclick javascript custom button. when i select radio button , and click on custom button then it should give an alert of radio button name and redirect it t

  • After apply custom Master page to SP2013 site, hover sub-menu items list as main buttonsJune 19

    I am migrating a site collection from SP2010 to SP2013. The top menu is built with OOB navigation function. In site settings -> Navigation, we can see something like: Global Navigation -- LV1 A -- LV1 B ----- LV2 C ----- LV2 D When mouse hover on but

  • Can I hide a custom button on standard page based on some field value?April 14

    I want to hide a standard or custom salesforce button on standard page. I don't want to use record type based layout to do that. --------------Solutions------------- A workaround could be to create a hyperlink formula with an image of a button, altho

  • Accessing custom button on vf pageJanuary 12

    I want to access a custom button on my vf page. The custom button can have any action in the backend. I want to display the same button on vf page so that if I change the action in backend it should get reflected in my vf page as well. Thanks Ray

  • How to add a custom button on a page layout automatically on installation of a package

    How to add a custom button on a page layout automatically on installation of a packageFebruary 15

    Is there a way to add a custom button on a page layout automatically on installation of the package? I already created the custom button in the Account's object and added to the installation package. If I install my package now, I have to manually ad

  • Custom posts type for individual pages?October 15

    I am trying to make a wordpress site with an idiot-proof backend CMS. I have built several relatively small wordpress sites, but now have moved on to a larger project and want to do it right. There will be several (maybe as much as 10+) pages each wi

  • Override Ribbon Save Button functionality for a specific page layout?April 15

    Is there a way to override Ribbon Save Button functionality in publishing page of specific page layout? My intention is not to override it for all publishing pages but to limit it to specific page layout? --------------Solutions------------- please c

  • How do I edit the format of things published to the front page?March 8

    How do I change the way info is published to the front page? For example, it gives me a title, 1 paragraph of body, date, tags and a read more button. I need to set it so that it also gives me a particular image field from a custom content type on to

  • Add "New document" button to home pageDecember 18

    I have a fairly simple SharePoint subsite that has two elements: the home page a document library The document library has two content types associated with it. What I would like to do is add a link (or button, whatever) to the home page that creates

  • Provide standard clone button functionality to a button on vf pageMarch 21

    I have an object whose standard new, edit and view button are overridden with a vf page.I want a Clone button on this vf page which should work exactly like standard clone button. If suppose i open an existing record and click on this clone button on

  • Cancel button on VF pageJune 17

    I am developing a VF page to allow changes into a custom setting. And this page is set as a visualforce tab. I need a way to set up the cancel button such that it would take the user back to previous visited page. Is there a way we can do that. -----

  • Insert and Update on Same Button on VF pageJuly 12

    I have one Custom Object Patient__c.On VF page onclick of commandlink button I am filling all the correspondant fields of Patient like firstname, middle name like that. I am getting the particular id also. Now my requirment is this to insert the new

  • How to hide the button when clicking other button using VF page?

    How to hide the button when clicking other button using VF page?January 9

    We have a requirement where the customer can sign and fill the form and submit.After submitting the form the form will be saved as a attachment and the form will be emailed to the Owner of the Account as a PDF. I have achieved all the above process.

  • Adding Delete button to VF pageFebruary 23

    I have an Add button to insert the values from Input fields to Custom objects. I also want to keep delete button to delete the last added record. How can I add this delete button? Following is the code for adding the records: public PageReference sav

  • Using JQuery to conditionally hide buttons on Quote PageJune 4

    I was following Tehnrd's tutorial (http://www.tehnrd.com/show-and-hide-buttons-on-page-layouts/) on how to conditionally hide/show custom buttons on a page layout. I think Tehnrd's code deals with just fields that are text base, however, I want to us

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.938 s.