2

I am working with a custom rest api that connects to our billing service, We are wanting to, when we load a salesforce record, for it to execute an apex script. We want to use that script to query the api and check for updated agreements records. We don't control the billing service so we have no way of doing the reverse.

The only other option I can think of is to create a custom button and use it to execute the apex, but that just creates an extra step and that is just to much work for my colleagues.

5

Triggers don't work like that, unfortunately.

Triggers are a database construct that allow you to perform work when there is a change to the database (insert, update, delete, undelete), and reading a record from a database generally doesn't cause any change.

Instead, what you'll probably want to look into is including an inline visualforce page in your page layout, or creating a custom lightning component to add to the page layout (depending on whether you're using classic or LEX). Both will cause code to be executed (at some point in time during the page rendering process, every time the record is viewed), which you should be able to piggyback off of to do your callout.

  • Thanks, I will look into that. If that is the only real way to do what I want then I will just create a custom visualforce page. It's extra work, but if it needs to happen that is what I will do. Thanks Derek! – jeremiah Mar 13 at 14:22

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.