You need to sign in to do that
Don't have an account?
sailer
Need to send response to Third Party from Salesforce.com
Hi Everyone,
I have the requirement,There will be button on the account page ,whenever the button is clicked I need to query all the account with the type ='other and push to the third party site .once the response was sucessfull i need to update the type field with the Third party' values.
Please let me know who can i proecess.
http://www.salesforce.com/us/developer/docs/ajax/Content/sforce_api_ajax_introducing.htm
HTH
Prabhan
Hi This is the code that works with the trigger.And the response will be sent by the body but i need the button to work
The trigger code is
trigger AccountCallout on Account (after Update) {
List<Account> AccountTest =[Select Name,Id,BillingCity from Account where type ='other'];
for (Account Test : AccountTest ) { // make the asynchronous web service callout WebServiceCallout.sendNotification(Test.Name, Test.BillingCity ,Test.Id); } }
And the apex code is below.
public class WebServiceCallout {
@future (callout=true)
public static void sendNotification(String name, String city,String Id) {
HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
Http http = new Http();
req.setEndpoint('http://www.apexdevnet.com');
req.setMethod('GET');
//req.setBody('name='+EncodingUtil.urlEncode(name, 'UTF-8')+'&city='+EncodingUtil.urlEncode(city, 'UTF-8')+'&id='+EncodingUtil.urlEncode(Id, 'UTF-8'));
req.setBody('name='+EncodingUtil.urlEncode(Id, 'UTF-8'));
/* System.debug('@@@@@@@@@@@@'+name);
System.debug('@@@@@@@@@@NAME'+name);
System.debug('@@@@@@@@@@City'+city);
*/
System.debug('@@@@@@@@@@IdSS'+Id);
req.setCompressed(true); // otherwise we hit a limit of 32000
try {
res = http.send(req);
} catch(System.CalloutException e) {
System.debug('Callout error: '+ e);
System.debug(res.toString());
}
}
}
On click of button i need this Apex code to be triggered .
Pl help me out .
I suggest this :
1. Make a new APEX global class with a webservice static declared method making the callout (not declared this as future).
2. Make a new Button with Javascript action using the "usual hack to call apex with a button"
You have this example :
http://boards.developerforce.com/t5/General-Development/Call-Apex-Class-From-A-Custom-Button/td-p/266235