• Ruchie
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 1
    Replies

Hi All,

I need to find the distance in miles. If i provide to two zip codes of US, so it should calculate and give the distance in miles between the two. Can anyone help on this.

 

Thanks

Ruchie

 

Hi All,

We can auto accept the records from an org, this is a new feature in summer'09. What if i want to forward the newly created account records automatically. Is there a way out, through which we can access the External sharing object and forward the records automatically, as soon as it gets created. 

 

Please help,

Thanks

Hi,

Can anyone please help, how to read the contents of the CSS file or any other file placed in the documents. I need this, so that i can read the contents of CSS and modify the code accordingly, instead modifying in the CSS. Also, this is required, if i place the HTML static code in documents and name the file as header, footer. SO, i need to read the HTML content fom that file, and create the static HTML on the VF Page. I want to use that file as template in the VF page. Please help.

 

Thanks

Hi,
Can anyody help in getting the fields and label of the SObject in VisualForce Controller using DescribeObject.
 
Thanks
  • January 15, 2009
  • Like
  • 0
Hi All,
Can anybody help me in writing the test method for the controller below, as i am new to this:
 
public class Cnrl_Con_Inv 
{
    List<List<Contact>> listAccount = new List<List<Contact>>();
    List<Contact> accTemp;  
  
    String txtSearch=System.currentPageReference().getParameters().get('txt');      
    Integer intPageSize = 20;
    Integer intCount = 0;
    Integer intLimit = 13;
    Integer intListSize;
    
   
    String []strHeader = new String[]{'"Name"', '"Account"', '"Country"','"City"','"Title"','"InvId"','"ConId"'};
    String []strTemp = new String[]{};
    String strTemp1 = '0';
    Integer intTemp = -1;
    Integer intTemp1 = -1;
    String pagingStatus = '';
    
    public String objAssignValues {set;get;}

    public PageReference AWReference()
    {
       intTemp = 0;
        try{
            accTemp = new List<Contact>();
            
            system.debug('ABCDEFGH   $$$$$$');
            for(Contact a : [Select c.Name,c.Title, c.LastName, c.FirstName, c.MailingCountry, c.MailingCity, c.Id, c.Account.Name, c.AccountId From Contact c where c.FirstName like : txtSearch +'%' or c.LastName like : txtSearch +'%'])
            {                 
                intCount++;
                if(accTemp.size() < intPageSize)
                {
                     
                     accTemp.add(a);
                }
                else
                {
                     
                    listAccount.add(accTemp);
                    accTemp = new List<Contact>();
                    accTemp.add(a);
                }
            }
            
              listAccount.add(accTemp);
            intListSize = listAccount.size();
            system.debug(intListSize);
            if(intCount <= intPageSize)
            {
                strTemp1 = '3';
            }
        }
        catch(Exception e)
        {
            system.debug('Error Ocured: ' + e);
        }
        return null;
    }
    
   
 
    
    List<List<Account>> listAcc = new List<List<Account>>();
    List<Account> AccVal;  

    String []strAccHeader = new String[]{'"Name"', '"Country"','"Phone-No"'};

    
     public PageReference AccRecAW()
     {
             
        intTemp1 = 0;
//        intPageSize = (pageSizeVal==null)?(20):pageSizeVal;
        try
        {
            AccVal = new List<Account>();
            for(Account A : [Select a.Id, a.Name, a.Phone, a.BillingCountry From Account a where a.Name like : txtSearch +'%' ])
            {     
                intCount++;
                if(AccVal.size() < intPageSize)
                {
                     
                     AccVal.add(A);
                }
                else
                {
                     
                    listAcc.add(AccVal);
                    AccVal = new List<Account>();
                    AccVal.add(A);
                }
            }

            listAcc.add(AccVal);
            intListSize = listAcc.size();
            if(intCount <= intPageSize)
            {
                strTemp1 = '3';
            }


        }
        catch (Exception e)
        {
            system.debug('Error Ocured: ' + e);
        }
        return null;   

    }

   
    

   public PageReference AWReferenceCon()
    {
      
      
        intTemp = 0;
//        intPageSize = (pageSizeVal==null)?(20):pageSizeVal;
     
try{
            accTemp = new List<Contact>();
            
            for(Contact f : [Select c.Name,c.Title, c.LastName, c.FirstName, c.MailingCountry, c.MailingCity, c.Id, c.Account.Name, c.AccountId From Contact c where c.AccountId = : objAssignValues ])
            {                 
                intCount++;
                if(accTemp.size() < intPageSize)
                {
                     
                     accTemp.add(f);
                     
                }
                else
                {
                     
                    listAccount.add(accTemp);
                    accTemp = new List<Contact>();
                    accTemp.add(f);
                }
            }
            
           
           listAccount = new List<List<Contact>>();
          listAccount.add(accTemp);
            intListSize = listAccount.size();
             if(intCount <= intPageSize)
            {
                strTemp1 = '3';
            }
        }
        catch(Exception e)
        {
            system.debug('Error Ocured: ' + e);
        }
        return null;
    }

 public String[] getAccRecord()
    {
    
       
        if( intTemp1 == -1)
        {
            AccRecAW();
        }
        strTemp.clear();
        for(Integer w=0; w<listAcc[intTemp1].size(); w++)
            strTemp.add('["<a href=\'javascript:#\'>'+(listAcc[intTemp1][w].Name== null?'':listAcc[intTemp1][w].Name)+'</a>", "'+(listAcc[intTemp1][w].BillingCountry == null?'':listAcc[intTemp1][w].BillingCountry)+'", "'+(listAcc[intTemp1][w].Phone== null?'':listAcc[intTemp1][w].Phone)+'", "'+(listAcc[intTemp1][w].Id== null?'':listAcc[intTemp][w].Id)+'"]'); 
            //strTemp.add('["<a href=\'javascript:#\'>'+(listAccount[intTemp][w].Name== null?'':listAccount[intTemp][w].Name)+'</a>", "'+(listAccount[intTemp][w].Account.Name== null?'':listAccount[intTemp][w].Account.Name)+'", "'+(listAccount[intTemp][w].MailingCountry== null?'':listAccount[intTemp][w].MailingCountry)+'", "'+(listAccount[intTemp][w].MailingCity== null?'':listAccount[intTemp][w].MailingCity)+'", "'+(listAccount[intTemp][w].Title== null?'':listAccount[intTemp][w].Title)+'", "'+(listAccount[intTemp][w].AccountId== null?'':listAccount[intTemp][w].AccountId)+'", "'+(listAccount[intTemp][w].Id== null?'':listAccount[intTemp][w].Id)+'"]'); 
            //strTemp.add('["<a href=\'javascript:selLink();\'>'+listAccount[intTemp][w].Who.Name+'</a>", "'+listAccount[intTemp][w].InvestorName__c+'", "'+listAccount[intTemp][w].DealName__c+'", "'+listAccount[intTemp][w].Owner.Name+'", "'+listAccount[intTemp][w].Description+'"]');


        if(strTemp == null)
            return new string[]{'"No Data"'};
        else
        {
            pagingStatus = 'Displaying ' + (intTemp1*intPageSize+1) + ' - ' + ((intTemp1*intPageSize)+listAccount[intTemp1].size()) + ' of ' + intCount;
            return strTemp;
        }
    }





    public String getstrTemp1() {
        return strTemp1;
    }
        public PageReference first() {
        if(intTemp > 0)
        {
            strTemp1 = '0';
            intTemp = 0;
        }
        return null;
    }

    public PageReference increment() {
        if(intTemp < intListSize - 1)
        {
            strTemp1 = '1';
            intTemp++;
        }
        if(intTemp == intListSize - 1)
        {
            strTemp1 = '2';
        }
        return null;
    }

    public PageReference decrement() {
        if(intTemp >=1 )
        {
            strTemp1 = '1';
            intTemp--;
        }
        if(intTemp == 0 )
        {
            strTemp1 = '0';
        }
        return null;
    }

    public PageReference last() {
        if(intTemp < intListSize - 1)
        {
            strTemp1 = '2';
            intTemp = intListSize - 1;
        }
        return null;
    }

    public String getpagingStatus()
    {
        return pagingStatus;
    }
    
    public String[] getGetData()
    {
        if( intTemp == -1)
        {
            AWReference();
        }
        strTemp.clear();
        for(Integer w=0; w<listAccount[intTemp].size(); w++)
            strTemp.add('["<a href=\'javascript:#\'>'+(listAccount[intTemp][w].Name== null?'':listAccount[intTemp][w].Name)+'</a>", "'+(listAccount[intTemp][w].Account.Name== null?'':listAccount[intTemp][w].Account.Name)+'", "'+(listAccount[intTemp][w].MailingCountry== null?'':listAccount[intTemp][w].MailingCountry)+'", "'+(listAccount[intTemp][w].MailingCity== null?'':listAccount[intTemp][w].MailingCity)+'", "'+(listAccount[intTemp][w].Title== null?'':listAccount[intTemp][w].Title)+'", "'+(listAccount[intTemp][w].AccountId== null?'':listAccount[intTemp][w].AccountId)+'", "'+(listAccount[intTemp][w].Id== null?'':listAccount[intTemp][w].Id)+'"]'); 
       
            //strTemp.add('["<a href=\'javascript:selLink();\'>'+listAccount[intTemp][w].Who.Name+'</a>", "'+listAccount[intTemp][w].InvestorName__c+'", "'+listAccount[intTemp][w].DealName__c+'", "'+listAccount[intTemp][w].Owner.Name+'", "'+listAccount[intTemp][w].Description+'"]');


        if(strTemp == null)
            return new string[]{'"No Data"'};
        else
        {
            pagingStatus = 'Displaying ' + (intTemp*intPageSize+1) + ' - ' + ((intTemp*intPageSize)+listAccount[intTemp].size()) + ' of ' + intCount;
            return strTemp;
        }
    }
    
    public String[] getContactData()
    {
     
               intTemp = -1;
        AWReferenceCon();
                {
            strTemp.add('["<a href=\'javascript:#\'>'+(listAccount[intTemp][w].Name== null?'':listAccount[intTemp][w].Name)+'</a>", "'+(listAccount[intTemp][w].Account.Name== null?'':listAccount[intTemp][w].Account.Name)+'", "'+(listAccount[intTemp][w].MailingCountry== null?'':listAccount[intTemp][w].MailingCountry)+'", "'+(listAccount[intTemp][w].MailingCity== null?'':listAccount[intTemp][w].MailingCity)+'", "'+(listAccount[intTemp][w].Title== null?'':listAccount[intTemp][w].Title)+'", "'+(listAccount[intTemp][w].AccountId== null?'':listAccount[intTemp][w].AccountId)+'", "'+(listAccount[intTemp][w].Id== null?'':listAccount[intTemp][w].Id)+'"]'); 
        }
            //strTemp.add('["<a href=\'javascript:selLink();\'>'+listAccount[intTemp][w].Who.Name+'</a>", "'+listAccount[intTemp][w].InvestorName__c+'", "'+listAccount[intTemp][w].DealName__c+'", "'+listAccount[intTemp][w].Owner.Name+'", "'+listAccount[intTemp][w].Description+'"]');

             if(strTemp == null)
            return new string[]{'"No Data"'};
        else
        {
            pagingStatus = 'Displaying ' + (intTemp*intPageSize+1) + ' - ' + ((intTemp*intPageSize)+listAccount[intTemp].size()) + ' of ' + intCount;
            return strTemp;
        }
    }
    

    public String[] getGetHeader() {
        return strHeader;
    }


     public String[] getAccHeader() 
    {
        return strAccHeader;
    }
    
     
    
  
    
   
}
 
 
Thanks in Advance.
 
  • January 13, 2009
  • Like
  • 0
Hi All,
Can somebody help me, how to get the rowindex of a selected row in a datatable. Though, we have an event, but how to get the index out of it..
 
<apex:dataTable id="dt1" onRowClick=""  value="{!conlist}"  var="a" />
 
Please reply.
 
 
  • December 29, 2009
  • Like
  • 0
Hi All,
Can anybody tell, how to call, the javascript onload() function in the <body> in a javascript. I wanted to call an alert statement, through a javascript on the onload function. Please help. Below is the code for reference:
 
<apex:page>
  
    <script type="text/javascript" src="/js/functions.js"></script>
    <script src="/soap/ajax/11.1/connection.js"></script>
    
<apex:pageBlock>
<apex:form>
  
<body onload="init();">       
<table width="100%">
<tr>
<td>
  <input type="text" id="txtName" />
  <input type="button" value="Save"  />
 
</td>
</tr>
</table>
</body>
 <script language="javascript">
sforce.connection.sessionId = '{!$Api.Session_ID}';
function init()
{
  alert('hi');
}
 </script>

  </apex:form>
</apex:pageBlock>
</apex:page>
  • December 26, 2008
  • Like
  • 0
Hi All,
Can anybody tell, how to get values of a dependent picklist? For eg: If we have two picklist- Status and Stage, and if Stage is dependent on Status. So, through sforce.connection.describeSObject, we can get all the picklist values of status, but how to get the picklist values dependent on the status values, in an S-Control.
 
Please help
 
  • October 01, 2008
  • Like
  • 0
Hi All,
Can anybody tell, how to call, the javascript onload() function in the <body> in a javascript. I wanted to call an alert statement, through a javascript on the onload function. Please help. Below is the code for reference:
 
<apex:page>
  
    <script type="text/javascript" src="/js/functions.js"></script>
    <script src="/soap/ajax/11.1/connection.js"></script>
    
<apex:pageBlock>
<apex:form>
  
<body onload="init();">       
<table width="100%">
<tr>
<td>
  <input type="text" id="txtName" />
  <input type="button" value="Save"  />
 
</td>
</tr>
</table>
</body>
 <script language="javascript">
sforce.connection.sessionId = '{!$Api.Session_ID}';
function init()
{
  alert('hi');
}
 </script>

  </apex:form>
</apex:pageBlock>
</apex:page>
  • December 26, 2008
  • Like
  • 0