So here is an odd question. On our Opportunity object we have a formula field. Is there anyway to pull in the actual formula calculation through any API, APEX, REST, SOAP? I have an iOS app and a requirement is to have the UI update according to the formula. My only option at this point seems to be copying that formula to the client-side, but then if it ever changes then the app needs to be updated as well. However, if I could pull in the formula from Salesforce then I could dynamically generate it. So is it possible?


Sure it's possible. The DescribeSObjectResult response in the SOAP API includes an array of Field objects, and formula fields will have a formula key that contains the formula for that field.

Of course, parsing that formula into logic your client can evaluate is an entirely different massive undertaking, but the foundation is there...

  • Thanks this definitely helped. I was also able to find it using REST as well after your tip. /services/data/v31.0/sobjects/Opportunity/describe and the object contained a "calculated formula" field.
    – JamWils
    Feb 4 '15 at 21:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.