• Srinivas Nimmagadda
  • NEWBIE
  • 50 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 6
    Replies
I was trying to install the local Dev Server and when I execute this command it is throwing an error.
 
C:\Users\Desktop\Salesforce> sfdx plugins:install @salesforce/lwc-dev-server

This plugin is not digitally signed and its authenticity cannot be verified. Continue installation y/n?: y
Finished digital signature check.
error An unexpected error occurred: "https://registry.yarnpkg.com/@salesforce%2flwc-dev-server: self signed certificate in certificate chain".
Installing plugin @salesforce/lwc-dev-server... !
Error: yarn add @salesforce/lwc-dev-server@latest --non-interactive --mutex=file:C:/Users/p2764490/AppData/Local/sfdx/yarn.lock --preferred-cache-folder=C:/Users/p2764490/AppData/Local/sfdx/yarn --check-files exited with code 
1
    at ChildProcess.<anonymous> (C:/Program Files/Salesforce CLI/client/node_modules/@oclif/plugin-plugins/lib/yarn.js:31:28)

 
When I try to push simple code from the visual studio into my scratch org it is throwing an error saying

User-added image

I am trying to achieve this by using SOQL.

Apex Class

public class soql_example_6 {
  //accountName 
    public String accName  {set;get;}
    // account rating 
    public String accRating  {set;get;}
    // query String 
    public String query    {set;get;}
    public String query2   {set;get;}
    // Result fetched
    public List<Account> accounts   {set;get;}
    public List<Opportunity> opps	{set;get;}
    
    public SOQL_Example_6(){
        accounts = new List<Account>();
        opps 	 = new List<Opportunity>();
    }
    // This search is for Accounts
    public void search(){
        // Default query 
        query='select id ,name,phone,rating,industry from Account';
        // if accName and accRating values are entered 
        // where name='TCS' and Rating ='Hot'
        if(accName!=''&&accRating!=''){
            query =query+' where name=\''+accName+'\' and rating=\''+accRating+'\'';      
        }else{
            // if only name is entered 
            // where name='TCS'
            if(accName!=''){
                query=query+' where name=\''+accName+'\'';
            } else if(accRating!=''){
                // if only rating is entered
                // where rating='Hot'
                query=query+' where rating=\''+accRating+'\'';
            }
        }
        accounts =Database.query(query);
    }

    // This search is for related Opportunities
    public void search2(){
        // Default Opportunity query
        query2='select id,name,Account, Amount, CloseDate, StageName from Opportunity';
        // If Account Name is selected
        // Fetch that Account Name ID to this query
        if(accName!=''){
// --------------
// Getting an error here in the below line.
            query2 = query2+'where ID=:\''+accId+'\' ';
        }
    }

}
VisualForce Page
<apex:page controller="SOQL_Example_6">
    <apex:form >
        <br/><br/>
    	<apex:outputPanel style="width:1000px; height:40px;padding:10px;border:1px solid grey;margin-top:50px;">
            Name : <apex:inputText value="{!accName}" /> 
            &nbsp;&nbsp;&nbsp;
            Rating : <apex:inputText value="{!accRating}" />
            &nbsp;&nbsp;&nbsp;
            <apex:commandButton value="Search" action="{!search}" reRender="fm"/>
        </apex:outputPanel>
        <br/><br/><br/>
        <apex:outputPanel id="fm">
            <apex:pageBlock>
            <apex:pageBlockSection columns="2" rendered="true">
                <apex:outputPanel title="Account Details">
                    <apex:dataTable value="{!accounts}" var="a" rules="rows" width="600" frame="border" cellpadding="10" rendered="{!accounts.size>0}">
                        <apex:column value="{!a.name}" headerValue="Name" />
                        <apex:column value="{!a.Phone}" headerValue="Phone" />
                        <apex:column value="{!a.Industry}" headerValue="Industry" />
                        <apex:column value="{!a.Rating}" headerValue="Rating" />
                    </apex:dataTable>
                </apex:outputPanel>
                
                 <apex:outputPanel title="Opportunity Details">
                    <apex:dataTable value="{!opps}" var="o" rules="rows" width="600" frame="border" cellpadding="10" rendered="{!opps.size>0}">
                        <apex:column value="{!o.name}" headerValue="Name" />
                        <apex:column value="{!o.Amount}" headerValue="Amount" />
                        <apex:column value="{!o.CloseDate}" headerValue="CloseDate" />
                        <apex:column value="{!o.stageName}" headerValue="StageName" />
                    </apex:dataTable>
                </apex:outputPanel>
        	</apex:pageBlockSection>
            </apex:pageBlock>    
		</apex:outputPanel>
    </apex:form>
</apex:page>



Now When I select Name only then its related Opportunities has to pop up in the right output panel window.

Eg:
-- if Name = Company_1 is written then
in the below-left output panel that Account column have to be displayed.
in the right output panel that Account related opportunities have to be displayed.

-- if Name is empty then
in the below-left page block all Accounts have to be displayed.
in the right page block, this output panel must not be displayed.
 
1. Creating a wrapper class Employee with last name, first name, phone, email.
2. SOQL query on Contact to fetch lastName, firstName, Phone, email.
3. Taking one by one contact and creating employee based on the data in the contact
4. Adding to a set
 
public class Employee {
        public String lastName;
        public String firstName;
        public String phone;
        public String email;
}
        List<Contact> contacts = [select FirstName,LastName,Phone,Email from Contact];
<!-- Here it is showing me the ERROR 
       ERROR: Missing '<EOF>' at 'List'        
-->
        Set<Employee> employees =new Set<Employee>();
        
        for(Contact c:contacts){
            
            Employee e =new Employee();
            e.LastName=c.LastName;
            e.firstName=c.firstName;
            e.Phone=c.Phone;
            e.Email =c.Email;
            employees.add(e);
        }

Can someone tell me what is the issue
Till now I have done the following as shown below
User-added image

Apex Class: Apex_SelectList_ObjectChange.apxc
public class Apex_SelectList_ObjectsChange {
// Account Fields
    public string 	accName		{set;get;}
    public string 	accNumber	{set;get;}
    public double 	accRevenue	{set;get;}
    public string	accPhone	{set;get;}
    public string	accFax		{set;get;}
    public integer	accemployees{set;get;}
    public string	accRating	{set;get;}
    public string 	accownership{set;get;}
    public string	accSource	{set;get;}
    public string	accDesc		{set;get;}
// Contact Fields
    public string	confirstName{set;get;}
    public string	conlastName	{set;get;}
    public string	conPhone	{set;get;}
    public string	conMobPhone	{set;get;}
    public string	conTitle	{set;get;}
    public date		conBirthdate{set;get;}
    public string	conEmail	{set;get;}
    public string	conLeadSource{set;get;}
// Opportunity Fields
    public string	oppName		{set;get;}
    public string	oppLeadSource{set;get;}
    public string	oppStage	{set;get;}
    public string	oppType		{set;get;}
    public double	oppAmount	{set;get;}
    public integer	oppQuantity	{set;get;}
    public date		oppCloseDate{set;get;}
    public string	selectedVal	{set;get;} // This is to hold the Selected Value, Id is in here

    // Declare List Options     
    public List<SelectOption> getObjectSelected(){
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('--None--','--None--'));
//        options.add(new SelectOption('Lead','Lead'));
        options.add(new SelectOption('Account','Account'));
        options.add(new SelectOption('Contact','Contact'));
        options.add(new SelectOption('Opportunity','Opportunity'));
        return options;
    }
    
    public PageReference create(){
        pageReference p;
        Apexpages.Message msg;
        try{
            Account a = new Account();
                a.Name 				= accName;
                a.AccountNumber 	= accNumber;
                a.AnnualRevenue 	= accRevenue;
                a.Phone 			= accPhone;
                a.Fax				= accFax;
                a.NumberOfEmployees = accemployees;
                a.Rating			= accRating;
                a.Ownership 		= accownership;
                a.AccountSource 	= accSource;
                a.Description 		= accDesc;
            insert a;
            Contact c = new Contact();
            	c.FirstName 		= confirstName;
                c.LastName 			= conlastName;
                c.Phone 			= conPhone;
                c.MobilePhone 		= conMobPhone;
                c.Title				= conTitle;
            	c.Birthdate 		= conBirthdate;
                c.Email 			= conEmail;
                c.LeadSource 		= conLeadSource;
            insert c;
            Opportunity o = new Opportunity();
            	o.Name 				= oppName;
                o.LeadSource 		= oppLeadSource;
                o.StageName 		= oppStage;
                o.Type 				= oppType;
                o.Amount 			= oppAmount;
                o.TotalOpportunityQuantity = oppQuantity;
                o.CloseDate 		= oppCloseDate;
            insert o;
            msg = new Apexpages.Message(Apexpages.Severity.CONFIRM,'Record Inserted Successfully');
        }catch(Exception e){
            msg = new Apexpages.Message(Apexpages.Severity.ERROR,'Error Reason is: '+e.getCause());
        }
        return p;
    }
    public void cancel(){
        accName			= null;
        accNumber		= null;
        accRevenue		= null;
        accPhone		= null;
        accFax			= null;
        accemployees	= null;
        accRating		= null;
        accownership	= null;
        accSource		= null;
        accDesc			= null;
        confirstName	= null;
        conlastName		= null;
        conPhone		= null;
        conTitle		= null;
        conMobPhone		= null;
        conBirthdate	= null;
        conEmail		= null;
        conLeadSource	= null;
        oppName			= null;
        oppLeadSource	= null;
        oppStage		= null;
        oppType			= null;
        oppAmount		= null;
        oppQuantity		= null;
        oppCloseDate	= null;
        selectedVal		= null;
    }
    
}
Visualforce Page: Apex_SelectList_ObjectsChange.vfp
<apex:page controller="Apex_SelectList_ObjectsChange" lightningStylesheets="true">
    <apex:sectionHeader title="Select List Options" subtitle="Swap Objects from List Selection" help="needHelp?" printUrl="Object Swap"/>
    <apex:form id="fm">
    	<apex:pageBlock id="pb">
            <apex:pageMessages />
            <apex:pageBlockButtons location="top"><b>Please Select an Object: </b>
                <apex:selectList value="{!selectedVal}" size="1" multiselect="false">
                    <apex:selectOptions value="{!ObjectSelected}" />
                </apex:selectList>
                <apex:commandButton value="Save" action="{!create}" reRender="pb"/>
                <apex:commandButton value="Cancel" action="{!cancel}" reRender="pb"/>                
            </apex:pageBlockButtons>
            
<!--Account Details -->
            <apex:pageBlockSection columns="1">
            	<apex:pageBlock title="Account" mode="mainDetail">
                    <apex:pageBlockSection id="AccountSection">
	                	<apex:pageBlockSectionItem >
                            <apex:outputLabel value="Account Name" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Account Number" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Account Phone" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Account Fax" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Account Rating" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Account Ownership" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Account Revenue" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Account Source" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Account Employees" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Account Description" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                	</apex:pageBlockSection>
                </apex:pageBlock>
                
<!--Contact Details -->            	
                <apex:pageBlock title="Contact" mode="mainDetail">
                    <apex:pageBlockSection id="ContactSection">
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Contact First Name" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Contact Last Name" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Contact Phone" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Contact Mobile Phone" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Contact Title" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Contact Birthdate" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Contact Email" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Contact Lead Source" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                    </apex:pageBlockSection>
                </apex:pageBlock>
                
<!--Opportunity Details -->            	
                <apex:pageBlock title="Opportunity" mode="mainDetail">
                    <apex:pageBlockSection id="OpportunitySection">
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Opportunity Name" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Opportunity Lead Source" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Opportunity Stage" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Opportunity Type" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Opportunity Amount" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Opportunity Quantity" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Opportunity Close Date" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                	</apex:pageBlockSection>        
                </apex:pageBlock>
                
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

When ever I select a value from the Select List value, then respective pageblocksection must be displayed like below

1. When I select "ACCOUNT" only account records should showup
User-added image
2. When I select "CONTACT" only contact records should showup
User-added image
3. When I select "OPPORTUNITY" only opportunity records should showup
User-added image
Hi, 
I am trying to recreate ACCOUNT object page in my custom visual force page.

Now I would like to know how to code for LIST VIEW OPTIONS, so that when ever we change the value the records in the pageblock section changes as selected.

Account Custom VisualForce PageList View Options

Code:
<!--
Author		: Srini
Description	: Create Account Object Duplicate Page
Version		: V1.0
CreatedDate	: 05-15-2019
-->
<apex:page standardController="Account" recordSetVar="accounts" tabStyle="account">
    <apex:form >
    <apex:sectionHeader title="Accounts" subtitle="Home" help="Account Page Help!"/>

<!-- VIEW -->	
<!--    <apex:pageBlock mode="maindetail"> -->
    	&nbsp; <b>View:</b> &nbsp;
        <apex:selectList value="{!filterId}" size="1">
<!-- ACTIONSUPPORT -- When View Option is changed we have to refresh below Page to change those values -->
        	<apex:actionSupport event="onchange" reRender="thechart"/>    
            <apex:selectOptions value="{!listviewoptions}" />
        </apex:selectList> &nbsp;
        <apex:commandButton id="go" value="Go!" title="Go" styleClass="buttonStyle" style="color:green"/> &nbsp;
        <apex:commandLink value="Edit"/> | &nbsp;
        <apex:commandLink value="Create New View"/> <br/> <br/>
<!--    </apex:pageBlock> -->

<!-- RECENT ACCOUNT -->    
    <apex:pageBlock title="Recent Accounts" mode="detail" tabStyle="dashboard">
    	<apex:pageBlockButtons location="top">
        	<apex:commandButton value="New" title="New Account" id="NAB" styleClass="buttonstyle" style="color:darkblue" />
       		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;	
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;	
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;	
            <apex:selectList value="{!filterId}" size="1">
                <apex:actionSupport event="onchange" reRender="thechart"/>
	            <apex:selectOption itemLabel="Recently Created" itemValue="" id="RC">			</apex:selectOption>
                <apex:selectOption itemLabel="Recently Modified" itemValue="" id="RM">			</apex:selectOption>
                <apex:selectOption itemLabel="Recently Viewed" itemValue="" id="RV">			</apex:selectOption>
			</apex:selectList>
        </apex:pageBlockButtons>
        <apex:pageBlockTable value="{!accounts}" var="acc" rows="5">
<!--            <apex:column headerValue="Account Name">
                <apex:outputLink value="{!acc.name}">{!acc.name}</apex:outputLink>
			</apex:column>
-->
            	<apex:column value="{!acc.name}"/>
                <apex:column value="{!acc.Id}"/>      	          	    
    	        <apex:column value="{!acc.Type}"/>
        </apex:pageBlockTable> 
        <apex:inlineEditSupport />
    </apex:pageBlock>

<!-- REPORTS -->       
    <apex:pageBlock mode="maindetail">
        <apex:pageBlockSection columns="2">
            <apex:pageBlock title="Reports" mode="detail" tabStyle="case" helpTitle="Reports Help !" helpUrl="/apex/VFpage_1">
                <apex:pageBlockSection columns="1">
                    <apex:commandLink value="Active Accounts"/>
                    <apex:commandLink value="Accounts with last activity > 30 days"/>
                    <apex:commandLink value="Account Owners"/>
                    <apex:commandLink value="Contact Role Report"/>
                    <apex:commandLink value="Account History Report"/>
                    <apex:commandLink value="Partner Accounts"/>   
                </apex:pageBlockSection> <br/>
                <apex:pageBlock mode="detail" tabStyle="opportunity">
                    <apex:commandLink value="Go to Reports"/>
                </apex:pageBlock>
            </apex:pageBlock>
            
<!-- TOOLS -->        
            <apex:pageBlock title="Tools" mode="detail" tabStyle="order" helpTitle="Tools Help !" helpUrl="/apex/VFpage_2">
            	<apex:pageBlockSection columns="1">
                    <apex:commandLink value="Import Accounts & Contacts"/>
					<apex:commandLink value="Mass Delete Accounts"/>
					<apex:commandLink value="Transfer Accounts"/>
					<apex:commandLink value="Merge Accounts"/>
					<apex:commandLink value="Mass Reassign Account Teams"/>
					<apex:commandLink value="Sales Methodologies"/>                    
                </apex:pageBlockSection>    
            </apex:pageBlock>
        </apex:pageBlockSection>
	</apex:pageBlock>        
 </apex:form>   
</apex:page>

 
Hi ,
I am new to VF programming. And I am trying to create a duplicate version of ACCOUT object page in my custom Visualforce Page.

My question is: How can I create a list view drop down in my VF page. like how we have in Accounts page as shown below.

List View VF page
Hi All,
I am getting this error when I am trying to create a 'No Show Prediction'.

Trailhead:
Trailhead
I followed all the steps as suggested in the trailhead. But when I click 'Build Prediction'. I am getting the following error

Error creating Application on EP for Id 0Pp1U000000PFVZSA4

Error which creating prediction
Can someone let me know how to clear this error
Hi All,
I am getting this Error for the PROJECT. 
This is from "Import and Export with Data Management Tools" -> "Use Data Loader to Import Data.
I have updated the records as instructed but the issue is with 'Accounts Modified Today as the List Name'. 
I have created the view as given and when I try verify the step it is throwing an error "Challenge Not yet complete... here's what's wrong:  Could not find the Account list view named 'Accounts Modified Today'. Check the instructions."

Below is the screen shot that I have created in my org
Account Modified Today Page View Error

Sharing Seetings

Please let me know is there any other way that can be done 
When I try to push simple code from the visual studio into my scratch org it is throwing an error saying

User-added image

I am trying to achieve this by using SOQL.

Apex Class

public class soql_example_6 {
  //accountName 
    public String accName  {set;get;}
    // account rating 
    public String accRating  {set;get;}
    // query String 
    public String query    {set;get;}
    public String query2   {set;get;}
    // Result fetched
    public List<Account> accounts   {set;get;}
    public List<Opportunity> opps	{set;get;}
    
    public SOQL_Example_6(){
        accounts = new List<Account>();
        opps 	 = new List<Opportunity>();
    }
    // This search is for Accounts
    public void search(){
        // Default query 
        query='select id ,name,phone,rating,industry from Account';
        // if accName and accRating values are entered 
        // where name='TCS' and Rating ='Hot'
        if(accName!=''&&accRating!=''){
            query =query+' where name=\''+accName+'\' and rating=\''+accRating+'\'';      
        }else{
            // if only name is entered 
            // where name='TCS'
            if(accName!=''){
                query=query+' where name=\''+accName+'\'';
            } else if(accRating!=''){
                // if only rating is entered
                // where rating='Hot'
                query=query+' where rating=\''+accRating+'\'';
            }
        }
        accounts =Database.query(query);
    }

    // This search is for related Opportunities
    public void search2(){
        // Default Opportunity query
        query2='select id,name,Account, Amount, CloseDate, StageName from Opportunity';
        // If Account Name is selected
        // Fetch that Account Name ID to this query
        if(accName!=''){
// --------------
// Getting an error here in the below line.
            query2 = query2+'where ID=:\''+accId+'\' ';
        }
    }

}
VisualForce Page
<apex:page controller="SOQL_Example_6">
    <apex:form >
        <br/><br/>
    	<apex:outputPanel style="width:1000px; height:40px;padding:10px;border:1px solid grey;margin-top:50px;">
            Name : <apex:inputText value="{!accName}" /> 
            &nbsp;&nbsp;&nbsp;
            Rating : <apex:inputText value="{!accRating}" />
            &nbsp;&nbsp;&nbsp;
            <apex:commandButton value="Search" action="{!search}" reRender="fm"/>
        </apex:outputPanel>
        <br/><br/><br/>
        <apex:outputPanel id="fm">
            <apex:pageBlock>
            <apex:pageBlockSection columns="2" rendered="true">
                <apex:outputPanel title="Account Details">
                    <apex:dataTable value="{!accounts}" var="a" rules="rows" width="600" frame="border" cellpadding="10" rendered="{!accounts.size>0}">
                        <apex:column value="{!a.name}" headerValue="Name" />
                        <apex:column value="{!a.Phone}" headerValue="Phone" />
                        <apex:column value="{!a.Industry}" headerValue="Industry" />
                        <apex:column value="{!a.Rating}" headerValue="Rating" />
                    </apex:dataTable>
                </apex:outputPanel>
                
                 <apex:outputPanel title="Opportunity Details">
                    <apex:dataTable value="{!opps}" var="o" rules="rows" width="600" frame="border" cellpadding="10" rendered="{!opps.size>0}">
                        <apex:column value="{!o.name}" headerValue="Name" />
                        <apex:column value="{!o.Amount}" headerValue="Amount" />
                        <apex:column value="{!o.CloseDate}" headerValue="CloseDate" />
                        <apex:column value="{!o.stageName}" headerValue="StageName" />
                    </apex:dataTable>
                </apex:outputPanel>
        	</apex:pageBlockSection>
            </apex:pageBlock>    
		</apex:outputPanel>
    </apex:form>
</apex:page>



Now When I select Name only then its related Opportunities has to pop up in the right output panel window.

Eg:
-- if Name = Company_1 is written then
in the below-left output panel that Account column have to be displayed.
in the right output panel that Account related opportunities have to be displayed.

-- if Name is empty then
in the below-left page block all Accounts have to be displayed.
in the right page block, this output panel must not be displayed.
 
Till now I have done the following as shown below
User-added image

Apex Class: Apex_SelectList_ObjectChange.apxc
public class Apex_SelectList_ObjectsChange {
// Account Fields
    public string 	accName		{set;get;}
    public string 	accNumber	{set;get;}
    public double 	accRevenue	{set;get;}
    public string	accPhone	{set;get;}
    public string	accFax		{set;get;}
    public integer	accemployees{set;get;}
    public string	accRating	{set;get;}
    public string 	accownership{set;get;}
    public string	accSource	{set;get;}
    public string	accDesc		{set;get;}
// Contact Fields
    public string	confirstName{set;get;}
    public string	conlastName	{set;get;}
    public string	conPhone	{set;get;}
    public string	conMobPhone	{set;get;}
    public string	conTitle	{set;get;}
    public date		conBirthdate{set;get;}
    public string	conEmail	{set;get;}
    public string	conLeadSource{set;get;}
// Opportunity Fields
    public string	oppName		{set;get;}
    public string	oppLeadSource{set;get;}
    public string	oppStage	{set;get;}
    public string	oppType		{set;get;}
    public double	oppAmount	{set;get;}
    public integer	oppQuantity	{set;get;}
    public date		oppCloseDate{set;get;}
    public string	selectedVal	{set;get;} // This is to hold the Selected Value, Id is in here

    // Declare List Options     
    public List<SelectOption> getObjectSelected(){
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('--None--','--None--'));
//        options.add(new SelectOption('Lead','Lead'));
        options.add(new SelectOption('Account','Account'));
        options.add(new SelectOption('Contact','Contact'));
        options.add(new SelectOption('Opportunity','Opportunity'));
        return options;
    }
    
    public PageReference create(){
        pageReference p;
        Apexpages.Message msg;
        try{
            Account a = new Account();
                a.Name 				= accName;
                a.AccountNumber 	= accNumber;
                a.AnnualRevenue 	= accRevenue;
                a.Phone 			= accPhone;
                a.Fax				= accFax;
                a.NumberOfEmployees = accemployees;
                a.Rating			= accRating;
                a.Ownership 		= accownership;
                a.AccountSource 	= accSource;
                a.Description 		= accDesc;
            insert a;
            Contact c = new Contact();
            	c.FirstName 		= confirstName;
                c.LastName 			= conlastName;
                c.Phone 			= conPhone;
                c.MobilePhone 		= conMobPhone;
                c.Title				= conTitle;
            	c.Birthdate 		= conBirthdate;
                c.Email 			= conEmail;
                c.LeadSource 		= conLeadSource;
            insert c;
            Opportunity o = new Opportunity();
            	o.Name 				= oppName;
                o.LeadSource 		= oppLeadSource;
                o.StageName 		= oppStage;
                o.Type 				= oppType;
                o.Amount 			= oppAmount;
                o.TotalOpportunityQuantity = oppQuantity;
                o.CloseDate 		= oppCloseDate;
            insert o;
            msg = new Apexpages.Message(Apexpages.Severity.CONFIRM,'Record Inserted Successfully');
        }catch(Exception e){
            msg = new Apexpages.Message(Apexpages.Severity.ERROR,'Error Reason is: '+e.getCause());
        }
        return p;
    }
    public void cancel(){
        accName			= null;
        accNumber		= null;
        accRevenue		= null;
        accPhone		= null;
        accFax			= null;
        accemployees	= null;
        accRating		= null;
        accownership	= null;
        accSource		= null;
        accDesc			= null;
        confirstName	= null;
        conlastName		= null;
        conPhone		= null;
        conTitle		= null;
        conMobPhone		= null;
        conBirthdate	= null;
        conEmail		= null;
        conLeadSource	= null;
        oppName			= null;
        oppLeadSource	= null;
        oppStage		= null;
        oppType			= null;
        oppAmount		= null;
        oppQuantity		= null;
        oppCloseDate	= null;
        selectedVal		= null;
    }
    
}
Visualforce Page: Apex_SelectList_ObjectsChange.vfp
<apex:page controller="Apex_SelectList_ObjectsChange" lightningStylesheets="true">
    <apex:sectionHeader title="Select List Options" subtitle="Swap Objects from List Selection" help="needHelp?" printUrl="Object Swap"/>
    <apex:form id="fm">
    	<apex:pageBlock id="pb">
            <apex:pageMessages />
            <apex:pageBlockButtons location="top"><b>Please Select an Object: </b>
                <apex:selectList value="{!selectedVal}" size="1" multiselect="false">
                    <apex:selectOptions value="{!ObjectSelected}" />
                </apex:selectList>
                <apex:commandButton value="Save" action="{!create}" reRender="pb"/>
                <apex:commandButton value="Cancel" action="{!cancel}" reRender="pb"/>                
            </apex:pageBlockButtons>
            
<!--Account Details -->
            <apex:pageBlockSection columns="1">
            	<apex:pageBlock title="Account" mode="mainDetail">
                    <apex:pageBlockSection id="AccountSection">
	                	<apex:pageBlockSectionItem >
                            <apex:outputLabel value="Account Name" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Account Number" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Account Phone" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Account Fax" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Account Rating" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Account Ownership" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Account Revenue" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Account Source" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Account Employees" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Account Description" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                	</apex:pageBlockSection>
                </apex:pageBlock>
                
<!--Contact Details -->            	
                <apex:pageBlock title="Contact" mode="mainDetail">
                    <apex:pageBlockSection id="ContactSection">
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Contact First Name" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Contact Last Name" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Contact Phone" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Contact Mobile Phone" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Contact Title" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Contact Birthdate" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Contact Email" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Contact Lead Source" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                    </apex:pageBlockSection>
                </apex:pageBlock>
                
<!--Opportunity Details -->            	
                <apex:pageBlock title="Opportunity" mode="mainDetail">
                    <apex:pageBlockSection id="OpportunitySection">
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Opportunity Name" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Opportunity Lead Source" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Opportunity Stage" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Opportunity Type" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Opportunity Amount" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Opportunity Quantity" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Opportunity Close Date" />
                            <apex:inputText label=""/>
                        </apex:pageBlockSectionItem>
                	</apex:pageBlockSection>        
                </apex:pageBlock>
                
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

When ever I select a value from the Select List value, then respective pageblocksection must be displayed like below

1. When I select "ACCOUNT" only account records should showup
User-added image
2. When I select "CONTACT" only contact records should showup
User-added image
3. When I select "OPPORTUNITY" only opportunity records should showup
User-added image
Hi ,
I am new to VF programming. And I am trying to create a duplicate version of ACCOUT object page in my custom Visualforce Page.

My question is: How can I create a list view drop down in my VF page. like how we have in Accounts page as shown below.

List View VF page
Hi All,
I am getting this error when I am trying to create a 'No Show Prediction'.

Trailhead:
Trailhead
I followed all the steps as suggested in the trailhead. But when I click 'Build Prediction'. I am getting the following error

Error creating Application on EP for Id 0Pp1U000000PFVZSA4

Error which creating prediction
Can someone let me know how to clear this error
Hi All,
I am getting this Error for the PROJECT. 
This is from "Import and Export with Data Management Tools" -> "Use Data Loader to Import Data.
I have updated the records as instructed but the issue is with 'Accounts Modified Today as the List Name'. 
I have created the view as given and when I try verify the step it is throwing an error "Challenge Not yet complete... here's what's wrong:  Could not find the Account list view named 'Accounts Modified Today'. Check the instructions."

Below is the screen shot that I have created in my org
Account Modified Today Page View Error

Sharing Seetings

Please let me know is there any other way that can be done