• Rajesh Kumar 455
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 4
    Replies
I have an Object Called Team which is in Relationship with Object User (Parrent)  , My requirement is Pull out the detail for which Team has not logged in Salesforce for example Team A contanina user 1 ,user 2,user 3 then if all user has not logged into salesforce then only this Team has to show in report if any one user has logged in then Team should not show in Report
Hello All, 
I have requirement for sending audit trail log to third party system on daily basis .

Can anybody help me out here how to achieve this ?
I am facing issue with Custom Visualforce Grid During Save .
When i click Save Changes Button I am getting below error 

**System.ListException: DML statement found null SObject at position 3
Error is in expression '{!Save1}' in component <apex:commandButton> in page r_gridpage: Class.R_GridClass.Save1: line 24, column 1
Class.R_GridClass.Save1: line 24, column 1** 


Below is my visualforce and Apex codes 

Visualforce Code
----------------

<apex:page standardController="Student__c" extensions="R_GridClass">  
    <apex:form id="formId">
        <apex:pageBlock >
        <apex:pageBlockButtons >
        <apex:commandButton value="Delete Selected Item" action="{!DeleteSelected}"/> 
        <apex:commandButton value="Add Student" action="{!AddSelected}"/> 
        <apex:commandButton value="Save Changes" action="{!Save1}"/>
        <apex:commandButton value="Update Selected Row" action="{!UpdateSelected}"/> 
        </apex:pageBlockButtons>
        <apex:pageBlockTable value="{!studentList}" var="st">
            <apex:column headerValue="Selection">
            <apex:inputCheckbox value="{!st.Selected}"/>
            </apex:column>
                <apex:column headerValue="Name">
                    <apex:inputField value="{!st.std.First_Name__c}" />
                </apex:column>
                <apex:column headerValue="Mobile">
                    <apex:inputField value="{!st.std.Mobile__c}" />
                </apex:column>
                <apex:column headerValue="Email">
                    <apex:inputField value="{!st.std.Email__c}" />
                </apex:column>
                <apex:column headerValue="Occupation">
                    <apex:inputField value="{!st.std.Occupation__c}" />
                </apex:column>
                <apex:column headerValue="DOJ">
                    <apex:inputField value="{!st.std.Date_of_Joining__c}" />
                </apex:column>
            </apex:pageBlockTable>
          <apex:pageBlockButtons >
         <!--<apex:commandButton value="Add New Student" action="{!addNew}"/><br/>-->
         <!--<apex:commandButton value="Save Records" action="{!Save}"/> --->
    </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>


Apex Code
----------------

public class R_GridClass {
Public List<WrapStudent> studentList {get;set;}
    public R_GridClass(ApexPages.StandardController ctrlr)
    {
      studentList = new List<WrapStudent>();
        for (Student__c stud :[SELECT Id, Name, OwnerId, First_Name__c, Last_Name__c, Mobile__c, Email__c, Date_of_Joining__c, Occupation__c FROM Student__c])
        {
           studentList.add(new WrapStudent(stud)); 
        }
    }
    
    public void AddSelected()
{
   studentList.add(new WrapStudent() );
}  
 public PageReference Save1()
{
List<Student__c> slist = new List<Student__c>();
for (Integer i = 0;i<studentList.size();i++)
{
 slist.add(studentList[i].std );
}
upsert slist;
 System.debug('Size of Selected List is -'+studentList.size());   
   PageReference tempPage = ApexPages.currentPage();            
   tempPage.setRedirect(true);
    return tempPage ;
}  
public PageReference DeleteSelected()
{
    List<Student__c> listToDelete = new List<Student__c>();
    for (WrapStudent wd : studentList)
    {
        if(wd.selected == true)
        {
            listToDelete.add(wd.std);
        }
    }
    if (listToDelete.size()>0)
    {
        
    Delete listToDelete;
        }
   PageReference tempPage = ApexPages.currentPage();            
   tempPage.setRedirect(true);
    return tempPage ;
    
     /*PageReference myVFPage = new PageReference('/'+'a007F000004tfiq');
         return myVFPage;*/

    
    public PageReference UpdateSelected()
{
    List<Student__c> listToUpdate = new List<Student__c>();
    for (WrapStudent wd : studentList)
    {
        if(wd.selected == true)
        {
            listToUpdate.add(wd.std);
        }
    }
    update listToUpdate;
   PageReference tempPage = ApexPages.currentPage();            
   tempPage.setRedirect(true);
    return tempPage ;
    
     /*PageReference myVFPage = new PageReference('/'+'a007F000004tfiq');
         return myVFPage;*/
}  
    
   
    
public class WrapStudent 
{
    
    Public Student__c std {get;set;}
    Public Boolean selected {get;set;} 
    Public WrapStudent (Student__c s)
    {
       std = s;
       selected = false; 
        
    }
    
    Public WrapStudent ()
    {
       
        
    }
}
}



Please help me on the above issue
 
I have an Object Called Team which is in Relationship with Object User (Parrent)  , My requirement is Pull out the detail for which Team has not logged in Salesforce for example Team A contanina user 1 ,user 2,user 3 then if all user has not logged into salesforce then only this Team has to show in report if any one user has logged in then Team should not show in Report
I am facing issue with Custom Visualforce Grid During Save .
When i click Save Changes Button I am getting below error 

**System.ListException: DML statement found null SObject at position 3
Error is in expression '{!Save1}' in component <apex:commandButton> in page r_gridpage: Class.R_GridClass.Save1: line 24, column 1
Class.R_GridClass.Save1: line 24, column 1** 


Below is my visualforce and Apex codes 

Visualforce Code
----------------

<apex:page standardController="Student__c" extensions="R_GridClass">  
    <apex:form id="formId">
        <apex:pageBlock >
        <apex:pageBlockButtons >
        <apex:commandButton value="Delete Selected Item" action="{!DeleteSelected}"/> 
        <apex:commandButton value="Add Student" action="{!AddSelected}"/> 
        <apex:commandButton value="Save Changes" action="{!Save1}"/>
        <apex:commandButton value="Update Selected Row" action="{!UpdateSelected}"/> 
        </apex:pageBlockButtons>
        <apex:pageBlockTable value="{!studentList}" var="st">
            <apex:column headerValue="Selection">
            <apex:inputCheckbox value="{!st.Selected}"/>
            </apex:column>
                <apex:column headerValue="Name">
                    <apex:inputField value="{!st.std.First_Name__c}" />
                </apex:column>
                <apex:column headerValue="Mobile">
                    <apex:inputField value="{!st.std.Mobile__c}" />
                </apex:column>
                <apex:column headerValue="Email">
                    <apex:inputField value="{!st.std.Email__c}" />
                </apex:column>
                <apex:column headerValue="Occupation">
                    <apex:inputField value="{!st.std.Occupation__c}" />
                </apex:column>
                <apex:column headerValue="DOJ">
                    <apex:inputField value="{!st.std.Date_of_Joining__c}" />
                </apex:column>
            </apex:pageBlockTable>
          <apex:pageBlockButtons >
         <!--<apex:commandButton value="Add New Student" action="{!addNew}"/><br/>-->
         <!--<apex:commandButton value="Save Records" action="{!Save}"/> --->
    </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>


Apex Code
----------------

public class R_GridClass {
Public List<WrapStudent> studentList {get;set;}
    public R_GridClass(ApexPages.StandardController ctrlr)
    {
      studentList = new List<WrapStudent>();
        for (Student__c stud :[SELECT Id, Name, OwnerId, First_Name__c, Last_Name__c, Mobile__c, Email__c, Date_of_Joining__c, Occupation__c FROM Student__c])
        {
           studentList.add(new WrapStudent(stud)); 
        }
    }
    
    public void AddSelected()
{
   studentList.add(new WrapStudent() );
}  
 public PageReference Save1()
{
List<Student__c> slist = new List<Student__c>();
for (Integer i = 0;i<studentList.size();i++)
{
 slist.add(studentList[i].std );
}
upsert slist;
 System.debug('Size of Selected List is -'+studentList.size());   
   PageReference tempPage = ApexPages.currentPage();            
   tempPage.setRedirect(true);
    return tempPage ;
}  
public PageReference DeleteSelected()
{
    List<Student__c> listToDelete = new List<Student__c>();
    for (WrapStudent wd : studentList)
    {
        if(wd.selected == true)
        {
            listToDelete.add(wd.std);
        }
    }
    if (listToDelete.size()>0)
    {
        
    Delete listToDelete;
        }
   PageReference tempPage = ApexPages.currentPage();            
   tempPage.setRedirect(true);
    return tempPage ;
    
     /*PageReference myVFPage = new PageReference('/'+'a007F000004tfiq');
         return myVFPage;*/

    
    public PageReference UpdateSelected()
{
    List<Student__c> listToUpdate = new List<Student__c>();
    for (WrapStudent wd : studentList)
    {
        if(wd.selected == true)
        {
            listToUpdate.add(wd.std);
        }
    }
    update listToUpdate;
   PageReference tempPage = ApexPages.currentPage();            
   tempPage.setRedirect(true);
    return tempPage ;
    
     /*PageReference myVFPage = new PageReference('/'+'a007F000004tfiq');
         return myVFPage;*/
}  
    
   
    
public class WrapStudent 
{
    
    Public Student__c std {get;set;}
    Public Boolean selected {get;set;} 
    Public WrapStudent (Student__c s)
    {
       std = s;
       selected = false; 
        
    }
    
    Public WrapStudent ()
    {
       
        
    }
}
}



Please help me on the above issue