You need to sign in to do that
Don't have an account?
Michael Hedrick 2
Pass parameter to Controller and append to Endpoint
Hello All,
I am unable to extract a field value from the Account page and append it to my Endpoint. Any suggestion would be greatly appreciated.
Thanks - M
public with sharing class JDECalloutcontroller {
Account currentRecord;
public JDECalloutcontroller (ApexPages.StandardController controller) {
currentRecord = [SELECT JDE__c FROM Account WHERE Id = :ApexPages.currentPage().getParameters().get('id')];
}
public Account getcurrentRecord(){
return currentRecord;
}
public List<JDEwrapper> JDEWrapperList{get;set;}
public List<JDEwrapper> getperformcallout(){
JDEWrapperList = new List<JDEwrapper>();
HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
Http http = new Http();
req.setEndpoint('https://blablabla/'+currentRecord );
req.setMethod('GET');
res = http.send(req);
if(res.getstatusCode() == 200 && res.getbody() != null){
JDEWrapperList=(List<JDEwrapper>)json.deserialize(res.getbody(),List<JDEwrapper>.class);
}
return JDEWrapperList;
}
}
I am unable to extract a field value from the Account page and append it to my Endpoint. Any suggestion would be greatly appreciated.
Thanks - M
public with sharing class JDECalloutcontroller {
Account currentRecord;
public JDECalloutcontroller (ApexPages.StandardController controller) {
currentRecord = [SELECT JDE__c FROM Account WHERE Id = :ApexPages.currentPage().getParameters().get('id')];
}
public Account getcurrentRecord(){
return currentRecord;
}
public List<JDEwrapper> JDEWrapperList{get;set;}
public List<JDEwrapper> getperformcallout(){
JDEWrapperList = new List<JDEwrapper>();
HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
Http http = new Http();
req.setEndpoint('https://blablabla/'+currentRecord );
req.setMethod('GET');
res = http.send(req);
if(res.getstatusCode() == 200 && res.getbody() != null){
JDEWrapperList=(List<JDEwrapper>)json.deserialize(res.getbody(),List<JDEwrapper>.class);
}
return JDEWrapperList;
}
}
req.setEndpoint('https://blablabla/'+currentRecord.JDE__c );
All Answers
req.setEndpoint('https://blablabla/'+currentRecord.JDE__c );
Thank you. Thant fixed my issue. I was assuming the variable currentRecord was housing the JDE__c value.
Have a good weekend,
M