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
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. 
rahul Gupta 327rahul Gupta 327
Can we access Roll-up summary fields in apex code? If Is it possible, Please mark as Best Answer to help others too.
funkylife.in (https://funkylife.in/)
Bernard ProsBernard Pros
Thanks for the provided solution to the problem. I think this will help a lot. And if not, then here https://qyto.com/slots/reel-king-mega-slot/ you can play and have fun
factquotes wishesbirthdaysfactquotes wishesbirthdays
pls see I hate myself quotes (https://factquotes.com/i-hate-myself-quotes/) and
factquotes wishesbirthdaysfactquotes wishesbirthdays

Please visit Happy 27th Birthday wishes (https://wishesbirthdays.com/happy-27th-birthday/)

and see love calculator (https://linepoetry.com/love-calculator/) to calculate love
incorrect quotes generator (https://linepoetry.com/incorrect-quotes-generator/)

Raju Sharma 32Raju Sharma 32
Remember to always gamble responsibly and make informed betting decisions. With the right online cricket ID (https://getonlineid.com/) provider, you can turn your passion for cricket into a thrilling and potentially profitable venture. Sign up with the best platform that suits your preferences and start placing your bets today!
Anky KolaAnky Kola
Wisdom Information. Thanks. best love quotes text (https://lovequotes.co.in) pic.