function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
saiteja2329saiteja2329 

REST Service that will send Data from a Custom object on click of a Button

 
We have a requirement to create a REST Service that will send Data from a Custom object on click of a Button. how we can achive please help  me
KeshabKeshab
Build a button and add into Account layout

Step-1: Create a Button
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")} 
var accountId='{!Account.Id}'
var result = sforce.apex.execute("ServiceColloutClass", "calloutDetails",{accountId: accountId}); 




//*********************Apex class
global class ServiceColloutClass{
 webservice static calloutDetails(String accountId){
        String URL=<add your URL with Account ID>
        Http h = new Http();
        HttpRequest req = new HttpRequest();
        req.setEndpoint(url);
        req.setMethod('GET');
        HttpResponse res = h.send(req);

}

}


Step-2 : Add button into Account layout. 

Step-3 : do all required setup for callount


and you are done.