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
Debbie61Debbie61 

Customer Portal getUserId() not finding match on User lookup field

I built a custom object using User as a lookup. I tested my code as a normal

user in sfc.com and my code was able to find the match for my userid.

 

But when I setup the customer portal and test the code, I don't get an error

but I don't get any results back from getUserId() either.

 

myUserId = UserInfo.getUserId(); Ticket__c ticket = [select User__c, m4_ticket__c, M4_site__c, User__r.FirstName, User__r.LastName from Ticket__c where User__c = :myUserId LIMIT 1];

 

I have checked the Portal Profile and the Profile does have Read access to the Ticket object.

 

The VisualForce page I created is able to distinguish the Portal User in a greeting using

{!$User.Username}

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Debbie61Debbie61

Problem solved.

This is why I post to forums because when I am at the end of my rope and post, I suddenly stumble

on the solution.

 

I updated the code to ensure the case of the field names matched what was in the wsdl and corrected

both the apex code and the visualforce code.

 

Since this worked in normal sfc, I can only guess that the portal is more case sensitve than the

normal sfc??

 

:smileyhappy:

All Answers

Debbie61Debbie61

14:3:53.30|SOQL_EXECUTE_END|[17,24]|Rows:1|Duration:12

 

In the debug log, it does look the apex code is finding a row match. So it looks like something with VisualForce and the Portal is not displaying or populating the values returned from the Apex class.

 

getSecurity(): {!Security.M4_ticket__c}<br/>

 

 

Debbie61Debbie61

Problem solved.

This is why I post to forums because when I am at the end of my rope and post, I suddenly stumble

on the solution.

 

I updated the code to ensure the case of the field names matched what was in the wsdl and corrected

both the apex code and the visualforce code.

 

Since this worked in normal sfc, I can only guess that the portal is more case sensitve than the

normal sfc??

 

:smileyhappy:

This was selected as the best answer