• subramanyam R
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 1
    Likes Given
  • 6
    Questions
  • 4
    Replies
**********controller page*******

public class MyController {

    private final Account account;

    public MyController() {
        account = [SELECT Id, Name, Site FROM Account 
                   WHERE Id = :ApexPages.currentPage().getParameters().get('id')];
    }

    public Account getAccount() {
        return account;
    }

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

******visualpage****************************


<apex:page controller="myController" tabStyle="Account">
    <apex:form>
        <apex:pageBlock title="Congratulations {!$User.FirstName}">
            You belong to Account Name: <apex:inputField value="{!account.name}"/>
            <apex:commandButton action="{!save}" value="save"/>
        </apex:pageBlock>
    </apex:form>
</apex:page>


*****************************************
throughing errorError    Error: myController Compile Error: Illegal assignment from List<Account> to account at line 6 column 9    
<apex:page standardController="account" recordSetVar="accounts">
<apex:form >
<apex:sectionHeader title="account"/>
<apex:pageBlock title="account names">
<apex:pageBlockTable value="{!account}" var="a">
<apex:column value="{!a.name}"/>
<apex:column value="{!a.phone}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
how to create the new visual page in force.com ide??? getting error while creating new page 
global class scheduleApex implements Schedulable {
   global void execute(SchedulableContext SC) {
       
       list<Account> acclist=[select id,description 
                               from account limit 20];
                               
       for(Account a: acclist){
           a.description='schedule apex';
       } 
       
       update acclist;                        
   }
   
 }
<apex:page standardController="account" recordSetVar="accounts">
<apex:form >
<apex:sectionHeader title="account"/>
<apex:pageBlock title="account names">
<apex:pageBlockTable value="{!account}" var="a">
<apex:column value="{!a.name}"/>
<apex:column value="{!a.phone}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
how to create the new visual page in force.com ide??? getting error while creating new page 
I'll post the VF page and the controller below.  Here's the error message I'm getting when trying to save my page:

Error: Unknown property 'String.Name'

VF Page code: 
<apex:page controller="TestPagination">
    <apex:form >
        <apex:pageBlock id="pb">
            <apex:pageBlockTable value="{!Lead}" var="a">
                <apex:column value="{!a.Name}}"/>
                <apex:column value="{!a.company}}"/>
                <apex:column value="{!a.Email}}"/>
                <apex:column value="{!a.Lead status}"/>
                <apex:column value="{!a.Lead source}"/>
            </apex:pageBlockTable>
            <apex:panelGrid columns="7">
                <apex:commandButton status="fetchStatus" reRender="pb" value="|<" action="{!first}" disabled="{!!hasPrevious}" title="First Page"/>
                <apex:commandButton status="fetchStatus" reRender="pb" value="<" action="{!previous}" disabled="{!!hasPrevious}" title="Previous Page"/>
                <apex:commandButton status="fetchStatus" reRender="pb" value=">" action="{!next}" disabled="{!!hasNext}" title="Next Page"/>
                <apex:commandButton status="fetchStatus" reRender="pb" value=">|" action="{!last}" disabled="{!!hasNext}" title="Last Page"/>
                <apex:outputText >{!(pageNumber * size)+1-size}-{!IF((pageNumber * size)>noOfRecords, noOfRecords,(pageNumber * size))} of {!noOfRecords}</apex:outputText>
                <apex:commandButton status="fetchStatus" reRender="pb" value="Refresh" action="{!refresh}" title="Refresh Page"/>
                <apex:outputPanel style="color:#4AA02C;font-weight:bold">
                    <apex:actionStatus id="fetchStatus" startText="Fetching..." stopText=""/>
                </apex:outputPanel>
            </apex:panelGrid>
        </apex:pageBlock>
    </apex:form>
</apex:page>


Controller code:

public with sharing class TestPagination {

    public String Lead { get; set; }
    Public Integer noOfRecords{get; set;}
    Public Integer size{get;set;}
    public ApexPages.StandardSetController setCon1 {
        get{
            if(setCon1 == null){
                size = 10;
                string queryString = 'Select Name, Company, Email, Lead Status, Lead Source from Lead order by Name';
                setCon1 = new ApexPages.StandardSetController(Database.getQueryLocator(queryString));
                setCon1.setPageSize(size);
                noOfRecords = setCon1.getResultSize();
            }
            return setCon1;
        }set;
    }
     
    Public List<Lead> getLead(){
        List<Lead> accList = new List<Lead>();
        for(Lead a : (List<Lead>)setCon1.getRecords())
            accList.add(a);
        return accList;
    }
     
    public pageReference refresh() {
        setCon1 = null;
        getLead();
        setCon1.setPageNumber(1);
        return null;
    }
     
    public Boolean hasNext {
        get {
            return setCon1.getHasNext();
        }
        set;
    }
    public Boolean hasPrevious {
        get {
            return setCon1.getHasPrevious();
        }
        set;
    }
  
    public Integer pageNumber {
        get {
            return setCon1.getPageNumber();
        }
        set;
    }
  
    public void first() {
        setCon1.first();
    }
  
    public void last() {
        setCon1.last();
    }
  
    public void previous() {
        setCon1.previous();
    }
  
    public void next() {
        setCon1.next();
    }
}


I am new to  apex. Please help me to resolve this error. Thanks in advance
global class scheduleApex implements Schedulable {
   global void execute(SchedulableContext SC) {
       
       list<Account> acclist=[select id,description 
                               from account limit 20];
                               
       for(Account a: acclist){
           a.description='schedule apex';
       } 
       
       update acclist;                        
   }
   
 }
 public class soapSforceComSchemasClassAccountins {
 public class SessionHeader_element {
        public String x00D90000000y0lh_AQ0AQGIsi542TCnp_73StsP8nawV5_7uVrHfVM0SyclcA_h1XKIVMRIiQAFjveUkYoo0HcVFXVHV1J6vjgM92eC2mdTmQCWQ;
        private String[] x00D90000000y0lh_AQ0AQGIsi542TCnp_73StsP8nawV5_7uVrHfVM0SyclcA_h1XKIVMRIiQAFjveUkYoo0HcVFXVHV1J6vjgM92eC2mdTmQCWQ_type_info = new String[]{'00D90000000y0lh!AQ0AQGIsi542TCnp.73StsP8nawV5.7uVrHfVM0SyclcA.h1XKIVMRIiQAFjveUkYoo0HcVFXVHV1J6vjgM92eC2mdTmQCWQ','http://soap.sforce.com/schemas/class/AccountInsert',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/schemas/class/AccountInsert','true','false'};
        private String[] field_order_type_info = new String[]{'x00D90000000y0lh_AQ0AQGIsi542TCnp_73StsP8nawV5_7uVrHfVM0SyclcA_h1XKIVMRIiQAFjveUkYoo0HcVFXVHV1J6vjgM92eC2mdTmQCWQ'};
    }
    public class DebuggingInfo_element {
        public String debugLog;
        private String[] debugLog_type_info = new String[]{'debugLog','http://soap.sforce.com/schemas/class/AccountInsert',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/schemas/class/AccountInsert','true','false'};
        private String[] field_order_type_info = new String[]{'debugLog'};
    }
    public class AccountInsert {
        public String endpoint_x = 'https://ap1.salesforce.com/services/Soap/class/AccountInsert';
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
        public soapSforceComSchemasClassAccountins.SessionHeader_element SessionHeader;
        public soapSforceComSchemasClassAccountins.DebuggingInfo_element DebuggingInfo;
        public soapSforceComSchemasClassAccountins.CallOptions_element CallOptions;
        public soapSforceComSchemasClassAccountins.DebuggingHeader_element DebuggingHeader;
        public soapSforceComSchemasClassAccountins.AllowFieldTruncationHeader_element AllowFieldTruncationHeader;
        private String SessionHeader_hns = 'SessionHeader=http://soap.sforce.com/schemas/class/AccountInsert';
        private String DebuggingInfo_hns = 'DebuggingInfo=http://soap.sforce.com/schemas/class/AccountInsert';
        private String CallOptions_hns = 'CallOptions=http://soap.sforce.com/schemas/class/AccountInsert';
        private String DebuggingHeader_hns = 'DebuggingHeader=http://soap.sforce.com/schemas/class/AccountInsert';
        private String AllowFieldTruncationHeader_hns = 'AllowFieldTruncationHeader=http://soap.sforce.com/schemas/class/AccountInsert';
        private String[] ns_map_type_info = new String[]{'http://soap.sforce.com/schemas/class/AccountInsert', 'soapSforceComSchemasClassAccountins'};
        public void opportunityUpdate(String Name,String AccountNumber,String Description) {
            soapSforceComSchemasClassAccountins.opportunityUpdate_element request_x = new soapSforceComSchemasClassAccountins.opportunityUpdate_element();
            request_x.Name = Name;
            request_x.AccountNumber = AccountNumber;
            request_x.Description = Description;
            soapSforceComSchemasClassAccountins.opportunityUpdateResponse_element response_x;
            Map<String, soapSforceComSchemasClassAccountins.opportunityUpdateResponse_element> response_map_x = new Map<String, soapSforceComSchemasClassAccountins.opportunityUpdateResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              '',
              'http://soap.sforce.com/schemas/class/AccountInsert',
              'opportunityUpdate',
              'http://soap.sforce.com/schemas/class/AccountInsert',
              'opportunityUpdateResponse',
              'soapSforceComSchemasClassAccountins.opportunityUpdateResponse_element'}
            );
            response_x = response_map_x.get('response_x');
        }
}

}
executing through Developer Console from other Salesforce Org:::

soapSforceComSchemasClassAccountins.AccountInsert a = new soapSforceComSchemasClassAccountins.AccountInsert();
a.opportunityUpdate('Microsoft','21232','Cognizant');

Line: 111, Column: 1
System.CalloutException: Web service callout failed: WebService returned a SOAP Fault: 

INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session faultcode=sf:INVALID_SESSION_ID faultactor=