You need to sign in to do that
Don't have an account?
Div Snk
need help with apex callout
Hi, I am making a callout to an external site to populate certain fields on the Account object based on the response of the the external site. There is a custom button on the Account object which is working on javascript and calls an apex controller which makes the callout.
The format of the apex class is :
global class ApexCallout {
webservice static String xyz(Id accountId){
Account accountDetails = [SELECT Id, Number1__c, Country1__c FROM Account WHERE Id = :accountId];
// Request logic here
// Response logic here; the response comes without any issue
accountDetails.Registered_Name__c = response.name;
accountDetails.Registered_Address__c = response.address;
accountDetails.Request_Date__c = response.requestDate;
System.debug(response);
return String.valueOf(response.valid);
}
}
Valid is a boolean here.
The response of this callout is coming without any issue. Registered name, Registered Address and Request Date are the fields on the Account object which should be populated based on the response as soon as I click on that custom button on the Account detail page.
However, in my case the button is working, the response is coming but these fields are not getting populated on the detail page. Can someone please let me know what I am missing here.
The format of the apex class is :
global class ApexCallout {
webservice static String xyz(Id accountId){
Account accountDetails = [SELECT Id, Number1__c, Country1__c FROM Account WHERE Id = :accountId];
// Request logic here
// Response logic here; the response comes without any issue
accountDetails.Registered_Name__c = response.name;
accountDetails.Registered_Address__c = response.address;
accountDetails.Request_Date__c = response.requestDate;
System.debug(response);
return String.valueOf(response.valid);
}
}
Valid is a boolean here.
The response of this callout is coming without any issue. Registered name, Registered Address and Request Date are the fields on the Account object which should be populated based on the response as soon as I click on that custom button on the Account detail page.
However, in my case the button is working, the response is coming but these fields are not getting populated on the detail page. Can someone please let me know what I am missing here.
I think you are not updating the account.
Let us know if you have any issues.
Mark it as best answer if it works.
Thanks.
All Answers
I think you are not updating the account.
Let us know if you have any issues.
Mark it as best answer if it works.
Thanks.