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
Poorna DeveloperPoorna Developer 

Pass custom field value in to apex class

I have an object called 'Application__c' and field in that called 'Customer_Id__c'.
I need to pass the Customer_Id__c to apex class whenever user enter the data in the object.

User-added image
Apex class
public static void passvalue() { String getcusid; Loan_Application__c lapp = new Loan_Application__c(); getcusid=lapp.Saltedge_Customer_Id__c; System.debug('customerid from sf' +getcusid); }

Trigger to get Customer_Id__c data whenever user given in the object.

User-added image

Is there any idea ?

Hii Poorna Developer 
Try The Below Code
trigger testtrigger on Application__c(After Update) {
        for(Application__c App :{ 
Please Mark It As Best Answer If It Helps
Thank You!

Hii  Poorna Developer 
Please Mark It As Best Answer If it Helps So It Can Help Others In Future.And It Motivates us To Give More In Community
Thank You!
Suraj Tripathi 47Suraj Tripathi 47

Hi Poorna,

you are creating object instance named "lapp" and without inserting it you want to print ID that's why it was showing null there.

Loan_Application__c lapp = new Loan_Application__c();

so the solution is to insert that object first.

or Maybe your trigger is on before insert so make it as "after insert and before update".

If it will help you please mark it as best answer.

Thank You

Suraj Tripathi 47Suraj Tripathi 47
it it would not solve your queries then please share your complete code with proper explanation i.e which object is parent which object is child,trigger should be on which object