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
Prem ChauhanPrem Chauhan 

how to reference user lookup field ID on account from contact in batch apex


how to reference user lookup field ID on account from contact in the Batch Apex

Object: Account 
Field:  1:- field A 2:- field B  

Object: Contact
Field:   Contact: Field C

When entering in Field A then Field B  will get Automatically update as Field A
Then in Contact Object which is related to This Account 
Then Field C will also get Update as Field A  
When I run the batch. 

Example:
Account Name = Test1   
Field A  = Test 
Field B  = Test   (Same as Field A)
Inserted Contact Related to Test1 Account  
Contact Field: Field C  = Test 


Many Thanks :) 
 
Zhen Yueh LeanZhen Yueh Lean
Hi Prem,

You can create a formula field in Contact object that refers to field A/B value. Then you just need to include the formula field in your contact query. Alternatively, you can do that in SOQL: Select Id, Account.FieldA__c from Contact.