• niladri_3121
  • NEWBIE
  • 0 Points
  • Member since 2013

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

VF PAGE:

<apex:page controller="search_global" tabstyle="account" sidebar="false">
<apex:form >
<apex:pageBlock title="Custom Search" mode="edit" id="block" >
<apex:pageBlockSection >
<apex:inputCheckbox label="Limit to accounts I own" />
<apex:pageBlockSectionItem >
<apex:outputLabel for="SearchText">Enter The Records Of Accounts
</apex:outputLabel>
<apex:panelGroup >
<apex:inputText id="searchText" value="{!searchText}"/>
<apex:commandButton value="Submit!" action="{!dosearch}" rerender="block" status="status"/>
</apex:panelGroup>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:actionStatus id="status" startText="requesting..."/>
<apex:pageBlockSection title="Results" id="results" columns="1">
<apex:pageBlockTable value="{!results}" var="l" rendered="{!NOT(ISNULL(results))}">
<apex:column value="{!l.name}"/>
<apex:column value="{!l.industry}"/>
<apex:column value="{!l.rating}"/>
<apex:column value="{!l.AccountPriority__c}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
<apex:form >
<apex:panelGrid columns="3" id="abcd">

<apex:selectList id="sel1" value="{!leftselected}" multiselect="true" style="width:100px" size="5">
<apex:selectOptions value="{!unselectedvalues}" />
</apex:selectList>
<apex:panelGroup >
<br/>
<apex:CommandButton value=" > " action="{!selectclick}"/> <br/>
<apex:CommandButton value=" < " action="{!unselectclick}"/>

</apex:panelGroup>
<apex:selectList id="sel2" value="{!rightselected}" multiselect="true" style="width:100px" size="5">
<apex:selectOptions value="{!SelectedValues}" />
</apex:selectList>
</apex:panelGrid>
</apex:form>
</apex:page>

 

CONTROLLER

 

public class search_global {

 

String searchtext;

String newsearchtext=searchtext+'%';
Set<String> originalvalues = new Set<String>{'name','Industry','Rating','AccountPriority__C'};
Public List<string> leftselected{get;set;}
Public List<string> rightselected{get;set;}
Set<string> leftvalues = new Set<string>();
Set<string> rightvalues = new Set<string>();

 

List<account> Results;

public String getsearchtext(){

return searchtext;

}

public Boolean check{

get{

if(check== null){

check = false;

}

return check;

}

set;

}

 

public void setsearchtext(String s)

{

searchtext=s;

}

public list<account> getResults()

{

return Results;

}

public pagereference dosearch()

{

if(check==false)

{

results=[select name,Industry,Rating,AccountPriority__C from account where account.name like :searchtext+'%' or industry=:searchtext or rating=:searchtext or AccountRegion__c=:searchtext or AccountPriority__c=:searchtext or AccountSummary__c like :searchtext+'%'];

}

else

{

results=[select name,Industry,Rating,AccountPriority__C from account where (account.name like :searchtext+'%' or industry=:searchtext or rating=:searchtext or AccountRegion__c=:searchtext or AccountPriority__c=:searchtext or AccountSummary__c like :searchtext+'%')and (ownerid=:UserInfo.getUserId())];

}

return null;

}
public search_global()
{
leftselected = new List<String>();
rightselected = new List<String>();
leftvalues.addAll(originalValues);
}
public PageReference selectclick()
{
rightselected.clear();
for(String s : leftselected)
{
leftvalues.remove(s);
rightvalues.add(s);
}
return null;
}
public PageReference unselectclick()
{
leftselected.clear();
for(String s : rightselected)
{
rightvalues.remove(s);
leftvalues.add(s);
}
return null;
}
public List<SelectOption> getunSelectedValues()
{
List<SelectOption> options = new List<SelectOption>();
List<string> tempList = new List<String>();
tempList.addAll(leftvalues);
tempList.sort();
for(string s : tempList)
options.add(new SelectOption(s,s));
return options;
}
public List<SelectOption> getSelectedValues()
{
List<SelectOption> options1 = new List<SelectOption>();
List<string> tempList = new List<String>();
tempList.addAll(rightvalues);
tempList.sort();
for(String s : tempList)
options1.add(new SelectOption(s,s));
return options1;
}

 

}

 

//Here i have added the code of  a search record  of Account object.i have added the picklist on the page thats having the account fields,but iam not able to filter the required fields from the Account records when iam selecting the particular field in the picklist,please provide me the solution.//

VF

<apex:page controller="search_global">

<apex:form >

<apex:pageBlock title="Custom Search" mode="edit" id="block" >

<apex:pageBlockSection >

<apex:inputCheckbox label="Limit to accounts I own" />

<apex:pageBlockSectionItem >

<apex:outputLabel for="SearchText">Enter The Records Of Accounts

</apex:outputLabel>

<apex:panelGroup >

<apex:inputText id="searchText" value="{!searchText}"/>

<apex:commandButton value="Submit!" action="{!dosearch}" rerender="block" status="status"/>

</apex:panelGroup>

</apex:pageBlockSectionItem>

</apex:pageBlockSection>

<apex:actionStatus id="status" startText="requesting..."/>

<apex:pageBlockSection title="Results" id="results" columns="1">

<apex:pageBlockTable value="{!results}" var="l" rendered="{!NOT(ISNULL(results))}">

<apex:column value="{!l.name}"/>

<apex:column value="{!l.industry}"/>

<apex:column value="{!l.rating}"/>

<apex:column value="{!l.AccountPriority__c}"/>

</apex:pageBlockTable>

</apex:pageBlockSection>

</apex:pageBlock>

</apex:form>

</apex:page>

 

CONTROLLER

 

public class search_global {

 

String searchtext;

String newsearchtext=searchtext+'%';

 

List<account> Results;

public String getsearchtext(){

return searchtext;

}

public Boolean check{

get{

if(check== null){

check = false;

}

return check;

}

set;

}

 

public void setsearchtext(String s)

{

searchtext=s;

}

public list<account> getResults()

{

return Results;

}

public pagereference dosearch()

{

if(check==false)

{

results=[select name,Industry,Rating,AccountPriority__C from account where account.name like :searchtext+'%' or industry=:searchtext or rating=:searchtext or AccountRegion__c=:searchtext or AccountPriority__c=:searchtext or AccountSummary__c like :searchtext+'%'];

}

else

{

results=[select name,Industry,Rating,AccountPriority__C from account where (account.name like :searchtext+'%' or industry=:searchtext or rating=:searchtext or AccountRegion__c=:searchtext or AccountPriority__c=:searchtext or AccountSummary__c like :searchtext+'%')and (ownerid=:UserInfo.getUserId())];

}

return null;

}

 

}

//Upto this i got the entire fields of the record types.But my requirment is to give all those field of account record should be in a picklist.

VF Page

<apex:page standardController="Account" recordSetVar="accounts" tabstyle="account"
sidebar="false" >
<apex:form>
<apex:pageBlock >

<apex:pageBlockTable value="{!accounts}" var="a">
<apex:column value="{!a.name}"/>
<apex:column value="{!a.Account_Priority__c}"/>
<apex:column value="{!a.Account_Region__c}"/>
<apex:column value="{!a.Account_Summary__c}"/>
<apex:column value="{!a.SLA__c}"/>
<apex:column value="{!a.Id}"/>
<apex:column value="{!a.Phone}"/>
<apex:column value="{!a.AccountNumber}"/>


<apex:inputCheckbox value="{!Limit to access I won}"/>

</apex:pageBlockTable>

<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!save}"/>
</apex:pageBlockButtons>

</apex:pageBlock>
</apex:form >
</apex:page>

 

Controller

public class datacon3{

public PageReference Search() {
return null;
}


public String getLimit() {
return null;
}


private final Account account;


public datacon3() {
account =[SELECT Name,AccountNumber,Phone,SLA__c,Account_Summary__c,AccountID,Account_Priority__c,Account_Region__c FROM Account
WHERE Id =:ApexPages.currentPage().getParameters().get('id')];

//

Error: datacon3 Compile Error: No such column 'AccountID' 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 17 column 26 

 

}
public Account getAccount(){
return account;
}


public PageReference save(){
update account;
return null;
}
}

//we are not getting a custom search button in visualforce page & a checkbox.The error what we got also i have mentioned inside the code.

                        please help us by rectifying the error.

VF

<apex:page controller="search_global">

<apex:form >

<apex:pageBlock title="Custom Search" mode="edit" id="block" >

<apex:pageBlockSection >

<apex:inputCheckbox label="Limit to accounts I own" />

<apex:pageBlockSectionItem >

<apex:outputLabel for="SearchText">Enter The Records Of Accounts

</apex:outputLabel>

<apex:panelGroup >

<apex:inputText id="searchText" value="{!searchText}"/>

<apex:commandButton value="Submit!" action="{!dosearch}" rerender="block" status="status"/>

</apex:panelGroup>

</apex:pageBlockSectionItem>

</apex:pageBlockSection>

<apex:actionStatus id="status" startText="requesting..."/>

<apex:pageBlockSection title="Results" id="results" columns="1">

<apex:pageBlockTable value="{!results}" var="l" rendered="{!NOT(ISNULL(results))}">

<apex:column value="{!l.name}"/>

<apex:column value="{!l.industry}"/>

<apex:column value="{!l.rating}"/>

<apex:column value="{!l.AccountPriority__c}"/>

</apex:pageBlockTable>

</apex:pageBlockSection>

</apex:pageBlock>

</apex:form>

</apex:page>

 

CONTROLLER

 

public class search_global {

 

String searchtext;

String newsearchtext=searchtext+'%';

 

List<account> Results;

public String getsearchtext(){

return searchtext;

}

public Boolean check{

get{

if(check== null){

check = false;

}

return check;

}

set;

}

 

public void setsearchtext(String s)

{

searchtext=s;

}

public list<account> getResults()

{

return Results;

}

public pagereference dosearch()

{

if(check==false)

{

results=[select name,Industry,Rating,AccountPriority__C from account where account.name like :searchtext+'%' or industry=:searchtext or rating=:searchtext or AccountRegion__c=:searchtext or AccountPriority__c=:searchtext or AccountSummary__c like :searchtext+'%'];

}

else

{

results=[select name,Industry,Rating,AccountPriority__C from account where (account.name like :searchtext+'%' or industry=:searchtext or rating=:searchtext or AccountRegion__c=:searchtext or AccountPriority__c=:searchtext or AccountSummary__c like :searchtext+'%')and (ownerid=:UserInfo.getUserId())];

}

return null;

}

 

}

//Upto this i got the entire fields of the record types.But my requirment is to give all those field of account record should be in a picklist.

VF Page

<apex:page standardController="Account" recordSetVar="accounts" tabstyle="account"
sidebar="false" >
<apex:form>
<apex:pageBlock >

<apex:pageBlockTable value="{!accounts}" var="a">
<apex:column value="{!a.name}"/>
<apex:column value="{!a.Account_Priority__c}"/>
<apex:column value="{!a.Account_Region__c}"/>
<apex:column value="{!a.Account_Summary__c}"/>
<apex:column value="{!a.SLA__c}"/>
<apex:column value="{!a.Id}"/>
<apex:column value="{!a.Phone}"/>
<apex:column value="{!a.AccountNumber}"/>


<apex:inputCheckbox value="{!Limit to access I won}"/>

</apex:pageBlockTable>

<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!save}"/>
</apex:pageBlockButtons>

</apex:pageBlock>
</apex:form >
</apex:page>

 

Controller

public class datacon3{

public PageReference Search() {
return null;
}


public String getLimit() {
return null;
}


private final Account account;


public datacon3() {
account =[SELECT Name,AccountNumber,Phone,SLA__c,Account_Summary__c,AccountID,Account_Priority__c,Account_Region__c FROM Account
WHERE Id =:ApexPages.currentPage().getParameters().get('id')];

//

Error: datacon3 Compile Error: No such column 'AccountID' 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 17 column 26 

 

}
public Account getAccount(){
return account;
}


public PageReference save(){
update account;
return null;
}
}

//we are not getting a custom search button in visualforce page & a checkbox.The error what we got also i have mentioned inside the code.

                        please help us by rectifying the error.