6

Problem:

Hitting the REST API from JS (inside a VF page) seems to be returning and old (or cached) version of the page layout.

Examples:

https://eu6.force.com/services/data/v40.0/sobjects/Contact/describe/layouts/012000000000000AAA

returns the updated page layout. Adding a field or two, or even changing sections on the layout are appropriately represented in the response from the aforementioned URL. However, if I hit the following URL (note the vf subdomain):

https://c.eu6.visual.force.com/services/data/v40.0/sobjects/Contact/describe/layouts/012000000000000AAA

it returns the original page layout before my changes. Same SessionID is used for both calls.

Question:

Is this some sort of caching problem on the Salesforce side or is there something else that I'm missing here?

  • Does the subdomain URL layout response eventually change to the expected value? – Daniel Ballinger Sep 11 '17 at 0:19
  • A bit of a reach, but are there any ETag's or conditional headers? – Daniel Ballinger Sep 11 '17 at 0:23
  • 1
    I just hit the API today again with a new session Id - both responses matched. Then I changed the layout again, got the old response from both endpoints... It smells like cookies and invalidating cache issue to me – Boris Bachovski Sep 11 '17 at 0:35
  • I wonder if it is just the layouts that appeared to be cached or if other metadata would have the same problem. E,g, a straight /Contact/describe/. – Daniel Ballinger Sep 11 '17 at 0:49
  • I will need to do some more investigation on this tonight... – Boris Bachovski Sep 11 '17 at 0:51
2

Salesforce does seem to cache the layouts, and the behaviour varies for some reason between end points (could just be load balancing?).

Either way, adding a Cache-Control header to the request, with the value no-cache fixes the issue.

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.