I have very simple LWC inside Community page. Inside the page I have the following query, which seems to raise Internal Salesforce Error, but I don't understand why

This is the query

SELECT Survey.Name, CommunityId, CustomField1__c, CustomField2__c, InvitationLink, LastModifiedDat
FROM SurveyInvitation
WHERE CommunityId = :Network.getCommunityId()

This is the error message

An internal server error has occurred Error ID: 622456132-619398 (-1311433241)

enter image description here

This only happens with SurveyInvitation object, when any other objects are queried, everything is OK.

Does anyone has a clue why this might happen?

How can we avoid it?

Is there any fix or workaround for this one?

  • Most of us here do not have access to the system that tracks gacks. However, I will mention @ca_peterson, as he typically does respond to questions of this type when possible.
    – sfdcfox
    Oct 8, 2020 at 12:19
  • Can you share the OrgId, instance, and time of occurrence of error so I can check the logs to suggest? - Salesforce support
    – Swetha
    Oct 8, 2020 at 12:26
  • Does this error happen if you run a query in the query editor in the Developer Console or Workbench? SELECT Survey.Name, CommunityId, CustomField1__c, CustomField2__c, InvitationLink, LastModifiedDat FROM SurveyInvitation? That could be an indication of the problem if that query succeeds there. Do you have everything enabled that needs to be in order to use that object too? Not familiar with surveys, just want to cover bases.
    – nbrown
    Oct 8, 2020 at 12:34
  • I will try the solution presented in @Patlatus answer and then check your comments
    – p-p
    Oct 8, 2020 at 12:37
  • The solution provided worked for me, so I think there is no need to share org or instance Id. Thanks for help @Swetha.
    – p-p
    Oct 8, 2020 at 14:48

1 Answer 1


I had the exactly same error, it happens when a SurveyInvitation record is shared to an user, but Survey itself is not.

It is easily to verify if this is the same error by removing the InvitationLink field from the query, in such case there is no error in that case.

This configuration issue can be solved in three different way:

  1. Share related Survey record to the corresponding User, Group, Role or Territory.
  2. Remove all sharing from this SurveyInvitation record from the user
  3. Change the query to include AND SurveyId IN ( SELECT Id FROM Survey), in this way it will filter out those SurveyInvitation records which parent Survey records are not shared to the current user

Try out this query, I believe it should work for you as well

SELECT CommunityId, InvitationLink, LastModifiedDate, Survey.Name
FROM SurveyInvitation
WHERE ((InviteExpiryDateTime = null OR InviteExpiryDateTime >= TODAY)
AND (CommunityId =: Network.getNetworkId())
AND SurveyId IN ( SELECT Id FROM Survey)
  • Thanks, this worked for me!
    – p-p
    Oct 8, 2020 at 14:47

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.