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
rakiraki 

soql query issue error

Hi, I am new to salesforce.

 

I creates a VF page to retrieve the data from custom object this page is design for customer portal user. There is a check box in object the condition is if check box is checked then record need to display if not record should not exist and also if potal user create the record in that case records should display by default even thought whether the check box is ticked are not

 

my soql query

public list<Support__c> objs = [select id,name,checkbox__c,question__c from Support__c where checkbox__c =: true or owner.Id = '00520000001wFyE' ];

 

for this IM getting error as

 

 

 IssueUpdateClass Compile Error: Didn't understand relationship 'owner' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 7 column 42

 

bob_buzzardbob_buzzard

Change 'owner.id' to 'ownerid' - that is a field present on the record.

rakiraki

i changed fro owner.id to ownerId

 

this is the error im getting now

 No such column 'ownerId' on entity 'Customobject__c'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names

bob_buzzardbob_buzzard

Is this a detail record in a master detail relationship?

rakiraki

yes,there is one look up field in this object with master detail relationship

bob_buzzardbob_buzzard

In that case the detail won't have an owner - you'll need to follow the relationship to the master and check the owner id of that.

rakiraki

how to do that to follow the relationship to master

bob_buzzardbob_buzzard

The relationship will be the name of the custom field that has the relationship, but with '__r' rather than '__c'.

 

E.g. if the relationship field is 'Parent__c', then you'd have:

 

Parent__r.OwnerId

 

rakiraki

Yeah, but IM looking for user id

E.g.: I created a visualforce page in which object had a check box so if this check box =: 'true' than the records should display (working properly)

 

I need to put this page in customer portal, Here will be only one user to login to this portal to my knowledge. Here comes the trouble

 

if customer portal user insert the record then the record should display in visualforce page  even though if the check box is checked or not

rakiraki

public list<Support__c> objs = [select id,name,checkbox__c,question__c from Support__c where checkbox__c =: true or ownerId = '00520000001wFyE' ];

bob_buzzardbob_buzzard

I understand that. However, the fact is that detail records don't have owners.  The owner is derived from the parent record.

bob_buzzardbob_buzzard

You could use the CreatedById on the record - that would have the id of the user that created the record.

rakiraki

thanks bob

rakiraki

How to make the check box true even if it is not ticked in visual force page, I mean the picture with tick mark.

 

<apex:column headerValue="checkBox" value="{!Records.checkBox__c}" style="{!IF(Records.checkBox == true,'','')}"/>

 

but its not working, is ther any other way

bob_buzzardbob_buzzard

You'd need checkbox__c to be set to true to get this.  Otherwise you need to decouple the value from your record, maybe via a wrapper class.