• Sakti Sahoo 5
  • NEWBIE
  • 20 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 8
    Replies
HI,

Can it be possible, whenever I am doing mouse hover in a row present in the pagseblocktable, it will capture the record id as well as other field values present in that row.

Thanks,
SAKTI
Hi 

I have a requirement where to display User Name in Assigned To custom field available in my custom object.

My object is Incident__c. I have a field called Assigned_To__c, having lookup relationship with User object. I am fillingup the form and trying to save it. But its not getting save. In debug log, its showing following


(32921549)|FATAL_ERROR|System.StringException: Invalid id: Sakti Sahoo Class.IncGetParmAdminClass.SaveRecord: line 64, column 1 07:56:38.032 (32931039)|CODE_UNIT_FINISHED|IncGetParmAdminClass invoke(SaveRecord)


Page:
*********


<apex:page standardController="Incident__c" extensions="IncGetParmAdminClass" sidebar="false" showHeader="false">

<apex:form >

          <apex:pageBlock title="Please Review and Submit" mode="edit">

               <apex:pageBlockButtons location="bottom">               
                       <apex:commandButton value="Submit" action='{!SaveRecord}'/>               
               </apex:pageBlockButtons>

         <apex:pageBlockSection columns="2" title="Incident Details" showHeader="true" rendered="true" >
                 <apex:outputText value="Assigned To:  {!Assigned_To_Preview}"> </apex:outputText>
         </apex:pageBlockSection>
          
          </apex:pageBlock>
</apex:form>
</apex:page>


Apex Class:
**************


public class IncGetParmAdminClass
{
    
    public Incident__c param {get; set;}

    public String Assigned_To_Preview {get;set;}
  
    public ApexPages.StandardController standard_Controller;
    public IncGetParmAdminClass(ApexPages.StandardController standard_Controller)
    {
        param = new Incident__c();

        Assigned_To_Preview =   ApexPages.currentPage().getParameters().get('vAssigned_To');
        // Here vAssigned_To, I am getting it from another page URL

    }   
       
    
   public PageReference SaveRecord()
   {
      param.Assigned_To__c = Assigned_To_Preview;
      insert param;   
      return NULL;
    }
 
}




Thanks In advance.
SAKTI
Hi,

Can anyone please help me out understanding simple custom list controller example i.e; how to craete a simple custom list view with defining apex class.

Thanks,
SAKTI
Hi,

I am trying to display a custom enhanced list view , which is a visualforce page. Right now I can retrive the Incident Number by Database.getQueryLocator. And able to show in my list view.

I also want to display my custom field, short description in my list view, which I am not able to disply. 

I am defining custom contoller setCon, which will get incident number and short description value from database. But while trying to display in list view page, only incident numer is getting populated. Am I going any wrong way. 

I am going it by <apex:column value="{!Inc.Short_Description__c}"/>
Here my custom object name is Incident__c

Here is my Page

********************
<apex:page controller="EnhancedListExtention" showHeader="false" sidebar="false" showChat="false" id="pg_id">
    
    <script type="text/javascript">
    // This will give you alert msg when record submitted successfully.
 
    window.onload = new function() 
    { 
           submitForm();        
    }

    function submitForm() 
    {
        alert("Record Created Sucessfully");
        
    }
    </script>
        
    <apex:form id="frm_id" >
        <apex:pageBlock id="pgblk_id">  

            <apex:pageBlockTable value="{!incidents}" var="Inc" id="tbl_id">
                 
                <!-- This make the name field as hyperlink on click it will navigate to detailed page as readonly -->                
                <apex:column headerValue="Name" id="clm_id" >
                    <apex:outputLink value="javascript:void(0);" onclick="window.open('/{!Inc.id}');" >{!Inc.name}</apex:outputLink>
                 </apex:column>
                              
                <apex:column value="{!Inc.Short_Description__c}"/>
              
                
            </apex:pageBlockTable>
           
            <apex:commandButton rendered="{!setCon.hasPrevious}" value="First" action="{!setCon.first}"/>
            <apex:commandButton rendered="{!setCon.hasPrevious}" value="Previous" action="{!setCon.previous}"/>
            <apex:outputText rendered="{!(setCon.pageNumber * setCon.pageSize) < setCon.ResultSize}" value="{!setCon.pageNumber * setCon.pageSize} Of {!setCon.ResultSize}"></apex:outputText>
            <apex:outputText rendered="{!(setCon.pageNumber * setCon.pageSize) >= setCon.ResultSize}" value="{!setCon.ResultSize} Of {!setCon.ResultSize}"></apex:outputText>
           
            <apex:commandButton rendered="{!setCon.hasNext}" value="Next" action="{!setCon.next}"/>
           
            <apex:commandButton rendered="{!setCon.hasNext}" value="Last" action="{!setCon.last}"/>
           
        </apex:pageBlock>
    </apex:form>
    
</apex:page>

Apex Class
****************

public class EnhancedListExtention {
// ApexPages.StandardSetController must be initiated   
// for standard list controllers   
    
    public Incident__c Inc {get;set;}   
    public ApexPages.StandardSetController setCon {
  
        get {
            if(setCon == null) {
                setCon = new ApexPages.StandardSetController(Database.getQueryLocator(
                      [select Name,Short_Description__c from Incident__c ORDER BY Name DESC NULLS LAST]));
            }
            return setCon;
        }
        set;
    }

    // Initialize setCon and return a list of records
   
    public List<Incident__c> getIncidents() {
         setCon.setpagesize(10);
         return (List<Incident__c>) setCon.getRecords();
    }
   
}

List View Generated

Many Thanks in Advance
-SAKTI
Hi,

I am getting error like this : Unknown method 'Incident__cStandardController.SaveRecord()'

Below is my code:
*************************


Apex Page :
******************
<apex:page standardController="Incident__c" extensions="IncGetParmAdminClass" sidebar="false" showHeader="false">
.....
.....
.....

<apex:commandButton value="Submit" action='{!SaveRecord}'/>

Apex Class:
*******************
public class IncGetParmAdminClass
{
  Public Incident__c param {get; set;}
  private ApexPages.StandardController standard_Controller;
    public IncGetParmAdminClass(ApexPages.StandardController standard_Controller)
    {
        param = new Incident__c();
        .................
       ..................
      public PageReference SaveRecord(){
            insert param;
            
            return null; 
        }


For some of my earlier requerement, I have done in the same way and it is working perfect. but for the above senario, I am getting error like this. 
Am I doing any mistake on declaring custom action name inside standard controller page tag. Please help me out.

Thanks in advance.
SAKTI


 
HI,

Can it be possible, whenever I am doing mouse hover in a row present in the pagseblocktable, it will capture the record id as well as other field values present in that row.

Thanks,
SAKTI
Hi 

I have a requirement where to display User Name in Assigned To custom field available in my custom object.

My object is Incident__c. I have a field called Assigned_To__c, having lookup relationship with User object. I am fillingup the form and trying to save it. But its not getting save. In debug log, its showing following


(32921549)|FATAL_ERROR|System.StringException: Invalid id: Sakti Sahoo Class.IncGetParmAdminClass.SaveRecord: line 64, column 1 07:56:38.032 (32931039)|CODE_UNIT_FINISHED|IncGetParmAdminClass invoke(SaveRecord)


Page:
*********


<apex:page standardController="Incident__c" extensions="IncGetParmAdminClass" sidebar="false" showHeader="false">

<apex:form >

          <apex:pageBlock title="Please Review and Submit" mode="edit">

               <apex:pageBlockButtons location="bottom">               
                       <apex:commandButton value="Submit" action='{!SaveRecord}'/>               
               </apex:pageBlockButtons>

         <apex:pageBlockSection columns="2" title="Incident Details" showHeader="true" rendered="true" >
                 <apex:outputText value="Assigned To:  {!Assigned_To_Preview}"> </apex:outputText>
         </apex:pageBlockSection>
          
          </apex:pageBlock>
</apex:form>
</apex:page>


Apex Class:
**************


public class IncGetParmAdminClass
{
    
    public Incident__c param {get; set;}

    public String Assigned_To_Preview {get;set;}
  
    public ApexPages.StandardController standard_Controller;
    public IncGetParmAdminClass(ApexPages.StandardController standard_Controller)
    {
        param = new Incident__c();

        Assigned_To_Preview =   ApexPages.currentPage().getParameters().get('vAssigned_To');
        // Here vAssigned_To, I am getting it from another page URL

    }   
       
    
   public PageReference SaveRecord()
   {
      param.Assigned_To__c = Assigned_To_Preview;
      insert param;   
      return NULL;
    }
 
}




Thanks In advance.
SAKTI
Hi,

Can anyone please help me out understanding simple custom list controller example i.e; how to craete a simple custom list view with defining apex class.

Thanks,
SAKTI
Hi,

I am trying to display a custom enhanced list view , which is a visualforce page. Right now I can retrive the Incident Number by Database.getQueryLocator. And able to show in my list view.

I also want to display my custom field, short description in my list view, which I am not able to disply. 

I am defining custom contoller setCon, which will get incident number and short description value from database. But while trying to display in list view page, only incident numer is getting populated. Am I going any wrong way. 

I am going it by <apex:column value="{!Inc.Short_Description__c}"/>
Here my custom object name is Incident__c

Here is my Page

********************
<apex:page controller="EnhancedListExtention" showHeader="false" sidebar="false" showChat="false" id="pg_id">
    
    <script type="text/javascript">
    // This will give you alert msg when record submitted successfully.
 
    window.onload = new function() 
    { 
           submitForm();        
    }

    function submitForm() 
    {
        alert("Record Created Sucessfully");
        
    }
    </script>
        
    <apex:form id="frm_id" >
        <apex:pageBlock id="pgblk_id">  

            <apex:pageBlockTable value="{!incidents}" var="Inc" id="tbl_id">
                 
                <!-- This make the name field as hyperlink on click it will navigate to detailed page as readonly -->                
                <apex:column headerValue="Name" id="clm_id" >
                    <apex:outputLink value="javascript:void(0);" onclick="window.open('/{!Inc.id}');" >{!Inc.name}</apex:outputLink>
                 </apex:column>
                              
                <apex:column value="{!Inc.Short_Description__c}"/>
              
                
            </apex:pageBlockTable>
           
            <apex:commandButton rendered="{!setCon.hasPrevious}" value="First" action="{!setCon.first}"/>
            <apex:commandButton rendered="{!setCon.hasPrevious}" value="Previous" action="{!setCon.previous}"/>
            <apex:outputText rendered="{!(setCon.pageNumber * setCon.pageSize) < setCon.ResultSize}" value="{!setCon.pageNumber * setCon.pageSize} Of {!setCon.ResultSize}"></apex:outputText>
            <apex:outputText rendered="{!(setCon.pageNumber * setCon.pageSize) >= setCon.ResultSize}" value="{!setCon.ResultSize} Of {!setCon.ResultSize}"></apex:outputText>
           
            <apex:commandButton rendered="{!setCon.hasNext}" value="Next" action="{!setCon.next}"/>
           
            <apex:commandButton rendered="{!setCon.hasNext}" value="Last" action="{!setCon.last}"/>
           
        </apex:pageBlock>
    </apex:form>
    
</apex:page>

Apex Class
****************

public class EnhancedListExtention {
// ApexPages.StandardSetController must be initiated   
// for standard list controllers   
    
    public Incident__c Inc {get;set;}   
    public ApexPages.StandardSetController setCon {
  
        get {
            if(setCon == null) {
                setCon = new ApexPages.StandardSetController(Database.getQueryLocator(
                      [select Name,Short_Description__c from Incident__c ORDER BY Name DESC NULLS LAST]));
            }
            return setCon;
        }
        set;
    }

    // Initialize setCon and return a list of records
   
    public List<Incident__c> getIncidents() {
         setCon.setpagesize(10);
         return (List<Incident__c>) setCon.getRecords();
    }
   
}

List View Generated

Many Thanks in Advance
-SAKTI
Hi,

I am getting error like this : Unknown method 'Incident__cStandardController.SaveRecord()'

Below is my code:
*************************


Apex Page :
******************
<apex:page standardController="Incident__c" extensions="IncGetParmAdminClass" sidebar="false" showHeader="false">
.....
.....
.....

<apex:commandButton value="Submit" action='{!SaveRecord}'/>

Apex Class:
*******************
public class IncGetParmAdminClass
{
  Public Incident__c param {get; set;}
  private ApexPages.StandardController standard_Controller;
    public IncGetParmAdminClass(ApexPages.StandardController standard_Controller)
    {
        param = new Incident__c();
        .................
       ..................
      public PageReference SaveRecord(){
            insert param;
            
            return null; 
        }


For some of my earlier requerement, I have done in the same way and it is working perfect. but for the above senario, I am getting error like this. 
Am I doing any mistake on declaring custom action name inside standard controller page tag. Please help me out.

Thanks in advance.
SAKTI


 
Hi,

I'm trying to use the onRowClick of the pageBlockTable to update a section of a page with javascript based on which row was clicked. How can I determine which row has been clicked on the onRowClick event and grab the id of the object in that row?

Thanks for any help :)