• anu112
  • NEWBIE
  • 75 Points
  • Member since 2012

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

Hello Everyone,

 

Could anyone please let me know how we can write the SOQL Query to fetch the recently viewed Accounts.

 

Thanks in Advance,

 

Anil

Is this possible to use CustomController and ControllerExtension in One Visualforcepage,plz any examples...

 

Thanks

=========

VenkatSforce

Hi

 

I have an  End Date:7/1/2013 9.00am , and Start date:7/1/2013 6.00am, now i need to get the no.of hours between the start and end date.

 

Using  formula field my  Output should be : 3.00hr

 

Thank You.

HI Guys,

 

Please an example code for time depended trigger.

HI Guys,

 

Please guide me, how to integrate  salesforce with address doctor. 

HI,

 

what is difference between the the account and schema.account?.

why to write the schema.objectname, like schema.account, schema.contact, schema.opportunity. 

Hi, My requirement is, I have one visual force page, with in this visual force 2 iframes, in 1st iframe  displaying account list with commandlink, so when i click which account commandlink that account details will be display 2nd iframe.

 if it is possiable.... how do it?

 

Thank you.

 

  • April 03, 2013
  • Like
  • 0

 

Hi.

I  am displyed attachment with outputlink, so when i click the link the page will be navigating to this url   value="/servlet/servlet.FileDownload?file={!attachment.id}"  .  this is working fine. But here how to capture the attchement.id in apex class when i click the link. 

 

  <apex:repeat value="{!taskAttachments}" var="attachment">

<apex:outputLink target="attachmentdetails"   value="/servlet/servlet.FileDownload?file={!attachment.id}" >

</apex:outputLink> 

</apex:repeat>

  • March 28, 2013
  • Like
  • 0

HI,

 

I want like this type of output:

I am dispalying account list with using pageblocktable.

Account1 

Account2    --->commandlink. when i click account2 command link then display save button with in this only commandlink                                             below or side , then remaining account list dispaly as it is.                                                              

SAVE   -------->command button 

Account3

 

 

If in case I am selecting account1 , then save button will display below or side of account1 commandlink. I am displaying the accounts with in the page block table.

 

  • March 25, 2013
  • Like
  • 0

<apex:page controller="accountnames">
 <apex:form >
 <apex:pageBlock >
     <apex:pageBlockTable value="{!alist}" var="a"  >
     <apex:column >
     <apex:commandLink value="{!a.name}"  >    
     <apex:param name="aid" value="{!a.id}" / >
     <apex:commandButton value="SAVE"  />
     </apex:commandLink>
     </apex:column>
     </apex:pageBlockTable>
  </apex:pageBlock>
 </apex:form>
</apex:page>

  • March 21, 2013
  • Like
  • 0

I was write  a test class, but i am getting code coverage 54% only. 

 

 

public class abhinav {


    private Apexpages.StandardController controller;

    Public string selectedPRC{get;set;}
    //Public callRedirect();

    String Id;
    public abhinav(ApexPages.StandardController controller) {
        Id = ApexPages.currentPage().getParameters().get('id');
    }


    //Our collection of the class/wrapper objects cContact
    public List<cContact> contactList{get;set;}

    //This method uses a simple SOQL query to return a List of Contacts
    public List<cContact> getContacts(){
        
        
            contactList = new List<cContact>();
            for(Contact c: [select Id, firstName, lastname, Pcp_Roles__c from Contact where AccountId=:Id and Contact_Portal_ID__c!=null and Portal_User_Status__c='active'])
            {
                
                contactList.add(new cContact(c));
            }
       
        return contactList;
        
    }

    // This is our wrapper/container class. A container class is a class, a data structure, or an abstract data type whose instances are collections of other objects. In this example a wrapper class contains both the standard salesforce object Contact and a Boolean value
    public class cContact {
        public Contact con {get; set;}
        public Boolean selected {get; set;}

        public cContact(Contact c) {
            con = c;
            //selected;    
        }
    }
    
    
    public List<SelectOption> getPRCRoles()
        {
                List<SelectOption> options = new List<SelectOption>();
                
               Schema.DescribeFieldResult fieldResult =
             Contact.Pcp_Roles__c.getDescribe();
             
               List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
                
               options.add(new SelectOption(  'none','-- Select One --'));
               for( Schema.PicklistEntry f : ple)
               {
                  options.add(new SelectOption( f.getValue(), f.getLabel()));
               }
            return options;
            //System.debug('Options --'+options);
        }    
        
        
    Public Pagereference save(){
                                            

                    // this.controller.save();
                    System.debug('What is selected PRC'+selectedPRC);
                    if(selectedPRC.equalsIgnoreCase('none'))
                    {
                        System.debug('I got here');
                        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Please select a PCP role.'));
                        
                        return null;
                    }

            List<contact> selectedcontacts=new List<contact>();
           

            
                    for(cContact cCon: contactList) {
                    if(cCon.selected == true) {
                        selectedContacts.add(cCon.con);
                            }
                    }
                    System.debug('What is selected PRC and contact size-----'+selectedPRC);
                    System.debug('What is selected PRC and contact size-----'+selectedContacts.size());
                    if(selectedPRC != 'none' && selectedContacts.size() == 0)
                    {
                        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Select atleast one contact'));
                        return null;
                    }
            
                    System.debug('These are the selected Contacts...'+selectedContacts);
                    for(Contact con: selectedContacts) {
                    system.debug(con);
                    
                        if(selectedPRC != 'none')
                        {
                        if(con.Pcp_Roles__c==null)
                                {
                                        con.Pcp_Roles__c=selectedPRC+';';
                                 }       
                        else {                                
                                    if(!con.Pcp_Roles__c.contains(selectedPRC))
                                    {  
                                        con.Pcp_Roles__c+=';'+selectedPRC;
                                    }
                               }
                               }      
                    }

            
            try{
                    update selectedcontacts;
                    callRedirect();
                    }catch(Exception e){
                          ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Something happened: your action did not complete. Refresh the page and ry again.'));  
                    }
            
            return null;
            
                    
    }  
    
    Public Pagereference callRedirect(){
            System.debug('What is option '+selectedPRC);
            PageReference p = new PageReference('/' + Id);
            System.debug('What is completepagereferece '+p);
            p.setRedirect(true);
            return p;
                    
    }  

@istest
public static void test_abhinav()
    {
        Account a = new Account(id='0019000000LFNec');
        ApexPages.StandardController sc = new ApexPages.standardController(a);
       
        abhinav testcls = new abhinav(sc);
        List<cContact> aList = testcls.getContacts();
        testcls.ContactList=aList;
    
        List<SelectOption> aPRC = testcls.getPRCRoles();
      
        testcls.selectedPRC='none';
       // system.assertEquals(testcls.save(),null);
        for(SelectOption anOption : aPRC)
        {
            testcls.selectedPRC=String.valueOf(anOption);
            for(cContact con : testcls.ContactList)
            {
                con.selected=true;
            }
            system.assertEquals(testcls.save(),null);
        }

        
       // system.assertEquals(testcls.callRedirect(),null);
    }
}

 

 

<apex:page standardcontroller="Account" extensions="abhinav">
        
      <apex:form >
        <apex:pageMessages id="error"></apex:pageMessages>
        <apex:pageBlock title="GPRT Price Book Allocation" mode="edit" >
            <br></br>
            
            <apex:pageBlockButtons >
                 <apex:commandButton value="     Ok      " action="{!save}" rerender="Selected_PBS,error"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <apex:commandButton value="     Cancel      " action="{!Cancel}"/>
            </apex:pageBlockButtons>
        

             
             <apex:outputText style="font-style:regular; font-weight:Regular; font-size:14px; font-family:Helvetica" value="Add PCP role" ></apex:outputText>
             <br></br>
                                                    
             <apex:selectList size="1" value="{!selectedPRC}" id="PRCoptions" style="width: 300px;"   Title="Add PCP Role">
             <apex:selectOptions value="{!PRCRoles}"/>
             </apex:selectList>
             <br></br><br></br><br></br>

                
                <apex:pageBlockTable value="{!contacts}" var="c" id="Selected_PBS">
                    <apex:column ><apex:inputCheckbox value="{!c.selected}" id="checkedone"/></apex:column>
                    <apex:column value="{!c.con.firstName}" />
                    <apex:column value="{!c.con.lastname}" />
                    <apex:column value="{!c.con.Pcp_roles__c}" headerValue="PCP Roles (Read Only)"/>
                </apex:pageBlockTable>
                
            </apex:pageBlock>
          
        </apex:form>
       
<script>
function checkAll(cb)
{
var inputElem = document.getElementsByTagName("input");
for(var i=0; i<inputElem.length; i++)
{
if(inputElem[i].id.indexOf("checkedone")!=-1)
inputElem[i].checked = cb.checked;
}
}   

function checkAll(cb,cbid)
        {
            var inputElem = document.getElementsByTagName("input");                     
            for(var i=0; i<inputElem.length; i++)
            {             
                 if(inputElem[i].id.indexOf(cbid)!=-1){                                        
                    inputElem[i].checked = cb.checked;
                }
            }
        }
 
</script>
</apex:page>

  • February 13, 2013
  • Like
  • 0

HI

 I am getting this Error: Compile Error: Method does not exist or incorrect signature: [checkboxex123].setacctypes() at line 29 column 9

 

public class checkboxex123{
    public list<string> acctypes=new list<string>();
    boolean disable=true;
    public list<selectoption> getitems(){
    list<SelectOption> options=new list<SelectOption>();
    //options.add(new SelectOption('Demat','Demat'));
    //options.add(new SelectOption('savings','savings'));
    return options;
    }
    
   public void setacctypes( list<string> acctypes){
  this.acctypes=acctypes;
    }
    public list<string> getacctypes(){
    return acctypes;
    }
    public PageReference test() {
        return null;
    }
    
    private static testmethod void testclass()
    {
        checkboxex123 con=new checkboxex123();
        con.getacctypes();
        con.test();
        con.getitems();
       
        con.setacctypes( );
       
    }

     
}

  • February 01, 2013
  • Like
  • 0

HI Guys,

 

Please guide me, how to integrate  salesforce with address doctor. 

Hello Everyone,

 

Could anyone please let me know how we can write the SOQL Query to fetch the recently viewed Accounts.

 

Thanks in Advance,

 

Anil

Is this possible to use CustomController and ControllerExtension in One Visualforcepage,plz any examples...

 

Thanks

=========

VenkatSforce

 

Hi.

I  am displyed attachment with outputlink, so when i click the link the page will be navigating to this url   value="/servlet/servlet.FileDownload?file={!attachment.id}"  .  this is working fine. But here how to capture the attchement.id in apex class when i click the link. 

 

  <apex:repeat value="{!taskAttachments}" var="attachment">

<apex:outputLink target="attachmentdetails"   value="/servlet/servlet.FileDownload?file={!attachment.id}" >

</apex:outputLink> 

</apex:repeat>

  • March 28, 2013
  • Like
  • 0

HI,

 

I want like this type of output:

I am dispalying account list with using pageblocktable.

Account1 

Account2    --->commandlink. when i click account2 command link then display save button with in this only commandlink                                             below or side , then remaining account list dispaly as it is.                                                              

SAVE   -------->command button 

Account3

 

 

If in case I am selecting account1 , then save button will display below or side of account1 commandlink. I am displaying the accounts with in the page block table.

 

  • March 25, 2013
  • Like
  • 0

<apex:page controller="accountnames">
 <apex:form >
 <apex:pageBlock >
     <apex:pageBlockTable value="{!alist}" var="a"  >
     <apex:column >
     <apex:commandLink value="{!a.name}"  >    
     <apex:param name="aid" value="{!a.id}" / >
     <apex:commandButton value="SAVE"  />
     </apex:commandLink>
     </apex:column>
     </apex:pageBlockTable>
  </apex:pageBlock>
 </apex:form>
</apex:page>

  • March 21, 2013
  • Like
  • 0

HI

 I am getting this Error: Compile Error: Method does not exist or incorrect signature: [checkboxex123].setacctypes() at line 29 column 9

 

public class checkboxex123{
    public list<string> acctypes=new list<string>();
    boolean disable=true;
    public list<selectoption> getitems(){
    list<SelectOption> options=new list<SelectOption>();
    //options.add(new SelectOption('Demat','Demat'));
    //options.add(new SelectOption('savings','savings'));
    return options;
    }
    
   public void setacctypes( list<string> acctypes){
  this.acctypes=acctypes;
    }
    public list<string> getacctypes(){
    return acctypes;
    }
    public PageReference test() {
        return null;
    }
    
    private static testmethod void testclass()
    {
        checkboxex123 con=new checkboxex123();
        con.getacctypes();
        con.test();
        con.getitems();
       
        con.setacctypes( );
       
    }

     
}

  • February 01, 2013
  • Like
  • 0