I'm trying to create a formula field wich use an external API in one of my object.

I'm trying to GET the number of followers of an instagram account directly in the formula field.

To do that, I have a little webpage which return the number of followers for an Instagram account that I pass as a parameter:

https://mywebsite.com/getFollowersCount?username=ef and it return 41 819

How can I use that in formula (in the object manager) ?


I don't believe that what you're looking to do is possible.

A formula field is, well, a formula that is stored in a database (rather than storing the calculated data).

They can do a limited number of things, and the important part is that all of the data for the formula resides in the formula itself, or somewhere reachable in the database from whatever object it happens to be defined on.

What you'll need here instead is something like a Lightning Component (i.e. Javascript) or a Visualforce page (using Apex for a custom controller, or controller extension) to actually do the callout to the Instagram API.

If you put this into the page layout for an object (or maybe a dashboard/report), you'll be making calls to fetch the latest data whenever the layout is viewed.

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.