I have Junction object called Agreement Scope which has two Master Detail relationships with Account and Agreement.

We are assigning Account and Agreement in the lightning components Apex Controller and doing an insert DML.


Unfortunately I am not able view the stack trace.

I tried giving all the FLS to running user profile and even view all and modify all to the records, still it is throwing the error.

What can be the reason for this?

On the junction object there are some formula fields from Account and Agreement, especially from Account, Account Name.

I can view values for these in before insert calls.

  • Could this be a sharing issue? Is the running user able to see both records? What sharing behaviour have you declared on the apex class being used as the controller? – marktuk Apr 4 at 11:15
  • Yupp, when I copied the record ids of both agreement and Account, and viewed them with user. both were visible. – mvk1991 Apr 4 at 11:33
  • Please read through the answer here for more on this particular error. There's a number of different items that could be causing the error. Also, the Account and Agreement records both have to exist first, so you may need to run your insert in an after trigger context – Brian Miller Apr 4 at 12:33

Your Answer

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

Browse other questions tagged or ask your own question.