You need to sign in to do that
Don't have an account?
Sanchivan Sivadasan
Customer Portal: Disabling User and Setting Account.IsCustomerPortal to false in testmethod
Hi there,
In the testmethod, I am trying to disable a Customer Portal User which I created within the testmethod by doing the following:
// Disable the peteSamprass portal use peteSamprassUser.IsPortalEnabled = False; peteSamprassUser.IsActive = False; update peteSamprassUser; peteSamprassUser = [SELECT Id, AccountId, ContactId, IsActive, IsPortalEnabled FROM User WHERE Id =:peteSamprassUser.Id];
System.assertEquals(peteSamprassUser.IsPortalEnabled, False) System.assertEquals(peteSamprassUser.IsActive, False);
For some reason the IsPortalEnabled reverts back to True even though I am clearly updating the field. As a result the Assert Statement for IsPortalEnabled fails. I also noticed that IsActive is propery set to False, so we don't have an issue with IsActive field.
Then I also tried disabling the Account record for Customer Portal as follows:
account101.IsCustomerPortal = False; update account101; account101 = [SELECT Id, Name, IsCustomerPortal FROM Account WHERE Id =:account101.Id]; System.assertEquals(account101.IsCustomerPortal, False);
This statement also fails. Please let me know what I am doing wrong. Thanks.
Sanch S.
Here is the full testMethod:
Does anyone have a solution for this? Thanks.
Sanch S.