• Frank U 2
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
Users of our Community site want to bookmark internal pages, but mandatory CSRF protection now produces error code 500 for these deep links. 
How do we fix this?
I'm having trouble composing the right code for the following data model. Arrows represent lookup fields (A has lookups for B & C, D has lookup for C).diagram of objects A, B, C, D. A looks up B & C, and D also looks up C.
For each myA record in an A_object list, I need to read the stringB field from its corresponding B_object, create the list of D_objects related to the same C_object, and read their stringD fields.

Statements I tried that don't work:

string myB = myA.B__r.stringB; // returns null

for (D_object myD : [select Id,stringD from D_object where C = :myA.C__r.Id]) // SOQL returns 0 records

C_object myC = myA.C // syntax error: illegal assignment from Id
C_object myC = myA.C.Id // syntax error: non foreign key can't be refererence
C_object myC = myA.C__r.Id // syntax error: illegal assignment from Id
C_object myC = myA.C__r // returns null

What is the correct syntax?
Users of our Community site want to bookmark internal pages, but mandatory CSRF protection now produces error code 500 for these deep links. 
How do we fix this?