• Abhiroop
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 6
    Replies

Hi everyone;

 

How can I access (retrieve)  the name of the account owner using the name of the account. 

 

I found that account is in look up relationship with User , So running this query results in an error

 

 a) String acctname= [select Owner from account where name=: objAccount.Name];

 

 

Error: MyController2 Compile Error: No such column 'Owner' on entity 'Account'. 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. at line 16 column 22

 

 

 

b) String acctname= [select a.$User.FirstName from account a where a.name=: objAccount.Name];

 

Error: MyController2 Compile Error: Didn't understand relationship '$User' 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 16 column 22

 

Thanx in advance !!

Hi everyone;

 

How can I access (retrieve)  the name of the account owner using the name of the account. 

 

I found that account is in look up relationship with User , So running this query results in an error

 

 a) String acctname= [select Owner from account where name=: objAccount.Name];

 

 

Error: MyController2 Compile Error: No such column 'Owner' on entity 'Account'. 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. at line 16 column 22

 

 

 

b) String acctname= [select a.$User.FirstName from account a where a.name=: objAccount.Name];

 

Error: MyController2 Compile Error: Didn't understand relationship '$User' 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 16 column 22

 

Thanx in advance !!

Hi all ,

 

I have created a standard visual force page to create a custom search page which returns Account information form accounts page based on the search criteria such as account name, industry etc... I have been able to create the VF page and the controller , however I am NOT able to transfer the value in the input field text to the contoller by which I can streamline my search results ... 

 

This is my VF Page:

 

<apex:page Controller="MyController1">

<apex:form >
<apex:pageBlock title="Account Search Page">
<apex:pageBlockSection columns="2">
<apex:inputField value="{!account.name}"/>
</apex:pageBlockSection>

<apex:pageBlockButtons location="bottom" >
<apex:commandButton value="Search" action="{!dosearch}" />
</apex:pageBlockButtons>
</apex:pageBlock>


<apex:pageBlock title="Search Results">
<apex:pageBlockTable value="{!pos}" var="sres" id="ResultTable" columns="2">
<apex:column value="{!sres.Name}"/>
<apex:column value="{!sres.Industry}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

 

and this is my code for controller

 

public class MyController1 {

public Account getAccount()

{
return null;
}
public Account setAccount()
{
return null;
}
public List<Account> getPos()
{
return pos;
}

public List<Account> pos=new List<Account>();

public MyController1() {
}

public pagereference dosearch()
{

pos = [select Name,Industry from Account where name=:------What do I put here ;  so that I can extract the matter in the inputField------------------];
return null;
}

}

 

 

Thanx in advance !!!

 

Hi all ,

 

I have created a standard visual force page to create a custom search page which returns Account information form accounts page based on the search criteria such as account name, industry etc... I have been able to create the VF page and the controller , however I am NOT able to transfer the value in the input field text to the contoller by which I can streamline my search results ... 

 

This is my VF Page:

 

<apex:page Controller="MyController1">

<apex:form >
<apex:pageBlock title="Account Search Page">
<apex:pageBlockSection columns="2">
<apex:inputField value="{!account.name}"/>
</apex:pageBlockSection>

<apex:pageBlockButtons location="bottom" >
<apex:commandButton value="Search" action="{!dosearch}" />
</apex:pageBlockButtons>
</apex:pageBlock>


<apex:pageBlock title="Search Results">
<apex:pageBlockTable value="{!pos}" var="sres" id="ResultTable" columns="2">
<apex:column value="{!sres.Name}"/>
<apex:column value="{!sres.Industry}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

 

and this is my code for controller

 

public class MyController1 {

public Account getAccount()

{
return null;
}
public Account setAccount()
{
return null;
}
public List<Account> getPos()
{
return pos;
}

public List<Account> pos=new List<Account>();

public MyController1() {
}

public pagereference dosearch()
{

pos = [select Name,Industry from Account where name=:------What do I put here ;  so that I can extract the matter in the inputField------------------];
return null;
}

}

 

 

Thanx in advance !!!