1

I have a class where i have created portal user. when i am testing the functionality it works fine. Problem occurs when writing a test class -

enter image description here

When writring the test class for business class method of portal user creation. its giving me the error.

Error -

enter image description here

Thanks

Your Reply will Highly appreciated

5
  • @Ratan What should be the query for userrole and code snippet ? May 9 '16 at 10:17
  • The Above mentioned query is not working. May 9 '16 at 10:38
  • ahh I didn't noticed you are not assigning AccountId to contact
    – Ratan Paul
    May 9 '16 at 10:50
  • Same here. i updated and then it works fine. May 9 '16 at 10:52
  • ahh I didn't noticed you are not assigning AccountId to contact .... Maha is correcty
    – Ratan Paul
    May 9 '16 at 10:57
2

Have you linked the contact to the specific account in your code before calling method to create portal user?

I couldn't see contact linked with Account in your test method.

Add one more line in the code which inserts contact.

con.Accountid = acc.Id;

Please try.Hope that solves 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.