我想运行一个测试脚本来测试问题和回复;但是当我插入对问题的回复时,它会显示以下错误。
INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY,空:[CommunityId]
这是代码片段
User u2 = new User(abcd );insert u2;
User u3 = new User( sfsadfas); insert u3;
Question question = new Question();
question.Title = 'Test';
question.Body = 'Test';
question.CommunityId = 'asfsadfsadfasdfsa';
insert question;
Id questId ;
questId = question.Id;
System.debug('questId --->'+questId );
Reply reply1 = new Reply();
//reply1.Name = 'replyquestion11';
reply1.Body = 'reply no 1 ques 1';
reply1.QuestionId = question.Id;
//reply1.CommunityId = 'fasdfsadfsadfsadf';
System.debug('reply1--->'+reply1);
insert reply1;
Test.startTest();
System.RunAs(u2)
{ Reply reply2 = new Reply();
//reply1.Name = 'replyquestion11';
reply2.Body = 'reply no 2 ques 1';
reply2.QuestionId = question.Id;
System.debug('reply2--->'+reply2);
insert reply2; //Insert Fails here
}
谁能帮我这个。我想用户 diff 用户发布对问题的回复..