Why is my page not loading in the portal?

  • 1
  • Problem
  • Updated 5 years ago
  • Solved
I have a calendar page that has a custom popup (when you click on the title of an event) that has an included page. Everything works fine when logged in as a SF standard user. When I login as a portal user and load the include page by itself it works fine. However when I try to use the calendar page and load the popup, I just get "Loading..." forever. The popup page does have some javascript that executes upon loading as a popup, so my guess is that has something to do with it, but I don't know why it wouldn't work in the portal. Here's the javascript code:

// this code gets all enrollment records for the class
// then creates new workshop attendance records in the model for this workshop if there aren't already such records for each enrollment
// it should execute upon loading of the page/popup
(function(skuid){
var $ = skuid.$;
$(function(){
   $(document.body).one('pageload',function(){
        var models = skuid.model;

        var workshopRow = models.getModel('WorkshopDetail').getFirstRow();
        if(workshopRow.Today__c >= workshopRow.Date__c) // only fill attendance if the workshop date is today or previous
        {
            var enrollments = models.getModel('StudentEnrollment');
            var attendances = models.getModel('WorkshopAttendance');
            var workshopID = workshopRow.Id;
            var existingAttendanceIds = {};
            $(attendances.data).each
            (
                function(i, at)
                {
                    existingAttendanceIds[at.Student_Enrollment__r.Id] = 1;
                }
            );
            $(enrollments.data).each
            (
                function(i, el)
                {
                    if(existingAttendanceIds[el.Id] === undefined)
                    {
                        //add new row to table
                        var newRow = attendances.createRow
                        ({
                            additionalConditions: [
                                { field: 'Student_Enrollment__r', value: el},
                                { field: 'Makeup_Session__c', value: 'No'},
                                { field: 'Student_Enrollment__c', value: el.Id},
                                { field: 'Workshop__c', value: workshopID}
                            ], doAppend: true
                        });

                        skuid.component.getById('workshopAttendanceTable').render();
                    }
                }
            );
        }
   });
});
})(skuid);
 


Photo of Peter Bender

Peter Bender, Champion

  • 6,246 Points 5k badge 2x thumb

Posted 5 years ago

  • 1
Photo of Moshe Karmel

Moshe Karmel, Champion

  • 8,646 Points 5k badge 2x thumb
You probably want to check the console for JavaScript errors ( Ctrl+Shift+J in chrome). It's possible there might be a field you are referencing that a portal user doesn't have permission to see, and therefore the code is getting stuck. 
Photo of Peter Bender

Peter Bender, Champion

  • 6,246 Points 5k badge 2x thumb
Good call. I see this error when I click to load the popup:

GET https://mydomain.secure.force.com/apex/include?id=a0Od000000TpIe5EAF&isinclude=true&page=WorkshopDetailInclude 404 (Not Found)

Why would this page not be found? Seems to mean that the URL built for "/apex/include" doesn't work in the partner portal. I looked at the security on the VF page "include", and indeed the portal profiles did not have access to this page. However, even after I changed the permissions for the VF page "include" so that portal users can access it, I still get the same result and same error in the JS console. Navigating to https://mydomain.secure.force.com/apex/include in the portal also results in this kind of error (though when NOT in the portal I get a different error indicating I'm just missing some URL parameters). This seems like a problem/bug with how Skuid includes work, but I don't know how to troubleshoot it any further.
Photo of John Nelson

John Nelson, Product Manager

  • 3,234 Points 3k badge 2x thumb
Hey guys, another customer ran into this issue last week. It looks like the way to get around it is to clone the Include VF page and make a local copy. This may still be a Skuid bug, but for now that should get you going. 
Photo of Peter Bender

Peter Bender, Champion

  • 6,246 Points 5k badge 2x thumb
Making a copy of the VF page and saving it with the same name ("Include"), then ensuring all relevant profiles have permissions for that page, seems to have fixed the issue, thanks.