function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Michael Hedrick 2Michael 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;
    }
}
Best Answer chosen by Michael Hedrick 2
Amit Chaudhary 8Amit Chaudhary 8
You want to pass JDE__c  value only. If yes then try below code

    req.setEndpoint('https://blablabla/'+currentRecord.JDE__c  );

All Answers

Amit Chaudhary 8Amit Chaudhary 8
You want to pass JDE__c  value only. If yes then try below code

    req.setEndpoint('https://blablabla/'+currentRecord.JDE__c  );
This was selected as the best answer
Michael Hedrick 2Michael Hedrick 2
Amit,
Thank you.  Thant fixed my issue.  I was assuming the variable  currentRecord was housing the JDE__c value.
Have a good weekend,
M