You need to sign in to do that
Don't have an account?
How to call REST method from within Custom Button using onClick JavaScript
I am a newbie to SalesForce and trying to call a REST service in a custom button's onclick JavaScript.
I get error, Error 400 Endpoint protocol(http/https) mismatch:
My endpoint is http://blah.blah.. and I can hit it separately in browser, so the RESt service getPrimaryQuoteDetails is working fine.
My onclick JavaScript code is as below. Can anybody throw light onto why this is not working? The site is listed as 'Remote Site' and I can also make a call to this service from a VF page. But the problem is the requirement is not to use VF page. This button is part of a custom object which is added to a standard opportunity layout.
Any answers or suggestions from gurus?
==========================================
{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")}
sforce.connection.remoteFunction({
url : 'http://c-----.com/----------/getPrimaryQuoteDetails.htm?quoteId=364926',
async : true,
cache : false,
method: "GET",
onSuccess : function(response) { alert('OK: '+response); },
onFailure : function(response) { alert('ERROR: '+response); }
});
Thanks,
mk2013
I'd like to do the exact same thing . Any directions on how to do this will be appretiated.
I've tried your code, and it is working. From your error code, you can try to change your URL from http to https