function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
HayaHaya 

How do we promote a guest user to become a portal user

We would like our customer portal users to be able to update their own profile.

Our MyProfilePageController says : Guest users are never able to access this page.

How do I give the portal users permission to update their profile? (We don’t want the self-registration option available to them.)

Thank you,
Haya
Best Answer chosen by Haya
HayaHaya
At the end the issue was not with MyProfilePageController, it was with the setup.
Go to: sites -> click on site name -> Login Settings -> edit -> enter “MyProfilePage” for My Profile Page

All Answers

Vinita_SFDCVinita_SFDC
Hello,

It is not possible. As per design we can not grant access to Guest users to update their own profile.
HayaHaya
So i guess my question is do customer portal users have to be "Guest Users" ?
Can they be promoted?
HayaHaya
If  a user has a login account, that we set up, to the portal is that user still a "Guest Users" ?
Vinita_SFDCVinita_SFDC
Hello,

Portal users are not Guest users. Portal users have different type of licenses (customer community, portal community, high volume customer portal user license) . Please refer following help doc for better undertanding on Guest users:

http://help.salesforce.com/apex/HTViewSolution?id=000006778&language=en_US
HayaHaya

Thank you, that was very helpful.
The users on our portal are high volume customer portal users, so my problem is not that our MyProfilePageController says : Guest users are never able to access this page.
I need to go back to and study the code.

 

HayaHaya
The problem i am facing is that when our portal user presses the My Profile button he/she are sent back to the login screen

I went to a few places to make sure the high volume customer portal users have access to MyProfilePage:
In Pages -> Security -> Enabled Profiles
in Apex  -> Security (MyProfilePageController) -> Enabled Profiles

I searched in user's profiles for a UserType but can't find it, the following code tests for it.

Please help me figure it out.

Can i create a group for all the portal users and test for that value?



this following code is in  MyProfilePageController. Where do i find the UserType? I searched in user's proifiles


@IsTest(SeeAllData=true) static void testSave() {        
        // Modify the test to query for a portal user that exists in your org
        List<User> existingPortalUsers = [SELECT id, profileId, userRoleId FROM User WHERE UserRoleId <> null AND UserType='CustomerSuccess'];

        if (existingPortalUsers.isEmpty()) {
            User currentUser = [select id, title, firstname, lastname, email, phone, mobilephone, fax, street, city, state, postalcode, country
                                FROM User WHERE id =: UserInfo.getUserId()];
            MyProfilePageController controller = new MyProfilePageController();
            System.assertEquals(currentUser.Id, controller.getUser().Id, 'Did not successfully load the current user');
            System.assert(controller.isEdit == false, 'isEdit should default to false');
            controller.edit();
            System.assert(controller.isEdit == true);
            controller.cancel();
            System.assert(controller.isEdit == false);
           
            Contact c = new Contact();
            c.LastName = 'TestContact';
            insert c;
           
            setContactFields(c, currentUser);
            controller.save();
            System.assert(Page.ChangePassword.getUrl().equals(controller.changePassword().getUrl()));
        } else {
            User existingPortalUser = existingPortalUsers[0];
            String randFax = Math.rint(Math.random() * 1000) + '5551234';
           
            System.runAs(existingPortalUser) {
                MyProfilePageController controller = new MyProfilePageController();
                System.assertEquals(existingPortalUser.Id, controller.getUser().Id, 'Did not successfully load the current user');
                System.assert(controller.isEdit == false, 'isEdit should default to false');
                controller.edit();
                System.assert(controller.isEdit == true);
               
                controller.cancel();
                System.assert(controller.isEdit == false);
               
                controller.getUser().Fax = randFax;
                controller.save();
                System.assert(controller.isEdit == false);
            }
HayaHaya
I can realy use some help with this issue. We need to have "MyProfile" available to customer portal users.

When I try to edit or just save MyProfilePageController I get:
Error: MyProfilePageController Compile Error: Test methods must be in test classes at line 76 column 42

That line is: @IsTest(SeeAllData=true) static void testSave() {

From what i gather both MyProfilePage and MyProfilePageController were generated by SF.
It says: // Modify the test to query for a portal user that exists in your org,
so  I need to test for  the cusotmer portal but I don't know how.

I need help making it work.

Thanks in advance,
Haya
HayaHaya
At the end the issue was not with MyProfilePageController, it was with the setup.
Go to: sites -> click on site name -> Login Settings -> edit -> enter “MyProfilePage” for My Profile Page
This was selected as the best answer