+ Start a Discussion
James George 00700James George 00700 

Is it possible for Apex to refer Formula Fields

Hi Friends,
Is it possible for APEX to refer formula fields for example refering to a roll-up summary field.

Please let me know your answers.

Thanks,
JG
Best Answer chosen by James George 00700
Ram Chand HeerekarRam Chand Heerekar
if you are asking regarding the access then yes we can access Roll-up summary fields in apex code in below mentioned code rc1__Count_of_opp__c is a rollup summary field.

if this answers your question Mark the solution as best
List<account> acc=[select id,rc1__Count_of_opp__c from account where id='0012v000030hjY3AAI'];
system.debug('acc'+acc);

Output:
USER_DEBUG [2]|DEBUG|acc(Account:{Id=0012v000030hjY3AAI, rc1__Count_of_contacts__c=1})

All Answers

Ram Chand HeerekarRam Chand Heerekar
if you are asking regarding the access then yes we can access Roll-up summary fields in apex code in below mentioned code rc1__Count_of_opp__c is a rollup summary field.

if this answers your question Mark the solution as best
List<account> acc=[select id,rc1__Count_of_opp__c from account where id='0012v000030hjY3AAI'];
system.debug('acc'+acc);

Output:
USER_DEBUG [2]|DEBUG|acc(Account:{Id=0012v000030hjY3AAI, rc1__Count_of_contacts__c=1})
This was selected as the best answer
AbhishekAbhishek (Salesforce Developers) 
Hi James,

Your query is answered in the blogs,

https://salesforce.stackexchange.com/questions/110873/using-formula-field-syntax-in-apex

https://salesforce.stackexchange.com/questions/85065/how-to-refer-a-formula-field-in-vf-page

https://developer.salesforce.com/forums/?id=906F0000000DAgqIAG

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks.
Suraj mehta 1Suraj mehta 1
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too. shayari pro  (http://shayaripro.in/)
Molly ArcherMolly Archer
Thank for the solutions provided! I believe that online casino no deposit bonus codes (https://ipayzz.com/no-deposit-bonus-codes/) will help people too.