Forum Discussion

AustinThomas's avatar
AustinThomas
Qrew Member
7 years ago

Button on form for an API request

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.

1 Reply

  • MCFNeil's avatar
    MCFNeil
    Qrew Captain
    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.