You need to sign in to do that
Don't have an account?
sk3501.3915272120779841E12
System.QueryException: List has no rows for assignment to SObject
The error is coming when i want to fetch customerUserTypes in Profile.
Set<String> customerUserTypes = new Set<String> {'CSPLiteUser', 'PowerPartner', 'PowerCustomerSuccess', 'CustomerSuccess'};
Account acc = new Account (
Name = 'newAcc1'
);
insert acc;
Contact con = new Contact (
AccountId = acc.id,
LastName = 'portalTestUser'
);
insert con;
Profile p = [select Id,name from Profile where UserType in :customerUserTypes limit 1];
User newUser = new User(
profileId = p.id,
username = 'newUser@yahoo.com',
email = 'pb@ff.com',
emailencodingkey = 'UTF-8',
localesidkey = 'en_US',
languagelocalekey = 'en_US',
timezonesidkey = 'America/Los_Angeles',
alias='nuser',
lastname='lastname',
contactId = con.id
);
insert newUser;
Set<String> customerUserTypes = new Set<String> {'CSPLiteUser', 'PowerPartner', 'PowerCustomerSuccess', 'CustomerSuccess'};
Account acc = new Account (
Name = 'newAcc1'
);
insert acc;
Contact con = new Contact (
AccountId = acc.id,
LastName = 'portalTestUser'
);
insert con;
Profile p = [select Id,name from Profile where UserType in :customerUserTypes limit 1];
User newUser = new User(
profileId = p.id,
username = 'newUser@yahoo.com',
email = 'pb@ff.com',
emailencodingkey = 'UTF-8',
localesidkey = 'en_US',
languagelocalekey = 'en_US',
timezonesidkey = 'America/Los_Angeles',
alias='nuser',
lastname='lastname',
contactId = con.id
);
insert newUser;
Aariff