Hello im really confused about how to call requestBody(Id quoteId) inside this code I created using inner classes:

public class PT_Interface{
public class Request_Model {
    public String ptquoteid {get;set;} 
    public String ptaccount {get;set;}
    public String sfobjreceive {get;set;} 
    public Request_Model(SBQQ__Quote__c myData) { 
        this.ptquoteid = '123';
        // this.ptquoteid = myData.SOMETHING 
        // this.ptaccount = myData.SOMETHING 

    public String requestBody(Id quoteId) {
            SBQQ__Quote__c myQuote_Data = [
            Select ID, Name 
            FROM SBQQ__Quote__c
            WHERE Id = :quoteId Limit 1
        if (myQuote_Data == null) {
            System.debug(logginglevel.ERROR, 'The world is falling');
            return null;
        Request_Model returnData = new Request_Model(myQuote_Data);
        return JSON.serialize(returnData);

public class Response_Model {

    public String l2igroup {get;set;} 
    public String l2ipart {get;set;} 
    public String l2idescription {get;set;} 
    public Integer l2iquantity {get;set;} 
    public String l2igroupid {get;set;} 
    public String l2iproductid {get;set;} 
    public void Response_Model(){
    system.debug('l2igroup in interface '+l2igroup);
    l2iproductid = 'CHANGED';

I've tried using this:

 PT_Interface.Request_Model ic = new PT_Interface.PT_Request_Model();

But I get errors about it thinking Request_Model() doesn't exist. Any help would be appreciated.


1 Answer 1


Your outer class is PT_Interface, so you need to call your inner class in this format PT_Interface.PT_Request_Model. And you can't call your constructor without a parameter since you have defined your constructor to expect a parameter.

Sample code:

PT_Interface.PT_Request_Model ic = new PT_Interface.PT_Request_Model(anObject);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.