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
chikkuchikku 

Method does not exist or incorrect signature: void getById() from the type IController

IController Transloan=new LoanController();
       Loan__c tloan=new Loan__c();
       sObj=(Loan_Transaction__c)obj;
       tobj.Related_Object_Name__c='Loan_Transaction__c';
      tloan=(Loan__c)Transloan.getById();
        if(tloan.Account__c!=null){
            tobj.Object_Id__c=tloan.Account__c;
            }
            else{
                 tobj.Object_Id__c=tloan.Contact__c;
            }
        
David Zhu 🔥David Zhu 🔥
You may need to check if you defined getById() method in interface IController and check if there is implementation of getbyId() in LoanController().

I noticed there are other issues in the code.

You define local variable tloan at line 2:
Loan__c tloan=new Loan__c();

But at line 5, you are trying to cast an ID (transload.getbyId()) to Loan__c.
tloan=(Loan__c)Transloan.getById();

 
chikkuchikku
 my requirement at 5 line i need to assign return values of Loan__c ,there is any solution @DavidZhu
David Zhu 🔥David Zhu 🔥
I am not sure what is in loadcontroller. you might do this:

tloan.Account__c = tloan.accountId; //assume there is property accountId in LoadController class.
tloan.otherfield__c = tloan.otherfield;