You need to sign in to do that
Don't have an account?
guppster01
Invalid Role Assignment in Test Class
I have a test class that works in my Developement Sandbox but doesn't work when Validating the Change Set in Production.
We have a Partner Community, and the test class creates a user with a Partner Community Role and Partner Profile. Here is the User Creation Test code that is failing on Insert:
The error when Validating in Production is this:
I have confirmed the Roles and Profiles exist in Production. Also confirmed I do have available licenses for the Community. I'm guessing there is a nuance with Partner Community Roles that I don't know about.
Ideas? Answers? :) Thanks Community!
We have a Partner Community, and the test class creates a user with a Partner Community Role and Partner Profile. Here is the User Creation Test code that is failing on Insert:
public static User getCommunityUser(Profile p, String contactId) { User testUser = new User(); String rId = [SELECT ID FROM USERROLE WHERE NAME Like 'Partner Test - Big Dealer Partner User%' LIMIT 1].Id; testUser.Email = 'test@test.com'; testUser.Username = '2345666@testuser.com'; testUser.LastName = 'test'; testUser.Alias = 'test'; if (p != null) { testUSer.ProfileId = p.Id; } else { testUser.ProfileId = UserInfo.getProfileId(); } testUser.LanguageLocaleKey = 'en_US'; testUser.LocaleSidKey = 'en_US'; testUser.TimeZoneSidKey = 'America/Chicago'; testUser.EmailEncodingKey = 'UTF-8'; testUser.ContactId = contactId; testUser.UserRoleId = rId; testUser.IsActive = true; insert testUser; return testUser; }This works in the Dev environments.
The error when Validating in Production is this:
I have confirmed the Roles and Profiles exist in Production. Also confirmed I do have available licenses for the Community. I'm guessing there is a nuance with Partner Community Roles that I don't know about.
Ideas? Answers? :) Thanks Community!
I commented out that line (line 24) and it worked
All Answers
I commented out that line (line 24) and it worked