Discussions

Expand all | Collapse all

Button on form for an API request

  • 1.  Button on form for an API request

    Posted 08-11-2017 17:35
    I'm trying to add a button to form that when clicked will send certain form elements through a REST api to post to a Salesforce form.

    Currently, I am only able to transfer data using a webhook which transfers the date any time the record is added or modified. I'd like to be able to send the POST command when the button is clicked rather than when the record is saved.


  • 2.  RE: Button on form for an API request

    Posted 08-11-2017 17:54
    A post command can be done in a formula url with a javascript command like so;

    "javascript:$.post('DestinationURL').then(function(res,code) {console.log(res,code);window.location.reload()})"

    I use the console log to see if it goes through without errors.

    your 'DestinationURL' will be the payload for the salesforce form.  

    Keep in mind that this will want to refresh the page, so any unsaved data might get lost.  So you will want to plan for that, and come up with some other approach.