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

call the api class from the visualforce page button
Hi All,
I am new to salesforce, whenever we click the result button will have to call the api class and automatically it will execute inside the logics of API class could any one please help me out
Through the button will have to run the Api class i tried this below but its throwing an error urgent requirement, please help me out
vfpage
----------------------------
<apex:page standerdController =''Applicationobj__c'' extension="extensincntrl">
<apexcommondbutton action={!Runapi} value="result"/>
</apex>
==================
controller
-------------------------
public with sharng class extensincntrl{
public PageReference Runapi(){
PageReference P =new PageReference ('/apex/someclassnameFrom?id=' +currentRecordid);
p.setRediect(true);
return p;
Apiclass ap= new api class();
//return ap;
string returnvlue =ap.methodfromApiclass();
retutrn returnvlue ;
}
=======================
intigration (api)class
--------------------
public with sharng class Apiclass {
public static httprequest createhttp(httprequest req, string uri){
//some logic of update the fields in the object
}
}
Thanks in advance.
Regards,
Ramu
I am new to salesforce, whenever we click the result button will have to call the api class and automatically it will execute inside the logics of API class could any one please help me out
Through the button will have to run the Api class i tried this below but its throwing an error urgent requirement, please help me out
vfpage
----------------------------
<apex:page standerdController =''Applicationobj__c'' extension="extensincntrl">
<apexcommondbutton action={!Runapi} value="result"/>
</apex>
==================
controller
-------------------------
public with sharng class extensincntrl{
public PageReference Runapi(){
PageReference P =new PageReference ('/apex/someclassnameFrom?id=' +currentRecordid);
p.setRediect(true);
return p;
Apiclass ap= new api class();
//return ap;
string returnvlue =ap.methodfromApiclass();
retutrn returnvlue ;
}
=======================
intigration (api)class
--------------------
public with sharng class Apiclass {
public static httprequest createhttp(httprequest req, string uri){
//some logic of update the fields in the object
}
}
Thanks in advance.
Regards,
Ramu
I think the error should be in this line
in standerdController you have to mention only standard objects for custom objects use Controller only and still
if you getting errors so please mention your complete error so that I can help you.
If you find your Solution then mark this as the best answer.
Thank you!
Regards
Suraj Tripathi