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

trigger expression error

Any Idea what is going wrong here?

Dushyant SonwarDushyant Sonwar
Hey Buddy,
you cannot get related list in
See this

You have pasted the image and it is so tiny, had to zoom to see the code :P

 You are directly accessing the field of Employment_History__c object without getting the record. You need to either get the record of Employment_History__c through SOQL or create a new record for Employment_History__c and then assign the value con.Account.Name to it.

Himanshu ParasharHimanshu Parashar

You need to first create object of that Employment_History__c such as
Employment_History__c  EH = new Employment_History__c ();
EH.DRM_Contact_Employer__c =

and as Dushyant said already you can't get Account.Name here directly so for that you can create a formaula field on contact and use that for assignment.

Salesforce Certified Developer | Administrator | Service Cloud Consultant

P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.