You need to sign in to do that
Don't have an account?

We previously using the detail page button to create a account in sap from salesforce account detail
How to provide an account id to external system like(3rd party) using javascript button on account detail page....any examples or code?....here i will use the Rest Api
When i click on that button of account detail page then then third partys object like customer record should create...Using REst Api
Help me ...thanks in advance
When i click on that button of account detail page then then third partys object like customer record should create...Using REst Api
Help me ...thanks in advance
{!Account.Id}
So if your REST API url was http://www.domain/API/updateAcc/<accountId>
then it would be:
http://www.domain/API/updateAcc/{!Account.Id}
You could either then have the external system call Salesforce via the API to collect the rest of the information it needs or you could pass everything in the REST call.
All Answers
{!Account.Id}
So if your REST API url was http://www.domain/API/updateAcc/<accountId>
then it would be:
http://www.domain/API/updateAcc/{!Account.Id}
You could either then have the external system call Salesforce via the API to collect the rest of the information it needs or you could pass everything in the REST call.
you mean that button will hold the accountID right?
And here is the Code is it right...
@RestResource(urlMapping='http://www.domain/API/updateAcc/{!Account.Id/*')
global with sharing class MyRestResource {
@HttpDelete
global static void doDelete() {
RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
String accountId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
Account account = [SELECT Id FROM Account WHERE Id = :accountId];
delete account;
}
@HttpGet
global static Account doGet() {
RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
String accountId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
Account result = [SELECT Id, Name, Phone, Website FROM Account WHERE Id = :accountId];
return result;
}
@HttpPost
global static String doPost(String name,
String phone, String website) {
Account account = new Account();
account.Name = name;
account.phone = phone;
account.website = website;
insert account;
return account.Id;
}
}
Please help me in this ...Am new to these services ...