• nathanxlane
  • NEWBIE
  • 0 Points
  • Member since 2011

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

So I created a Force.com site for my organization. We have a non-profit edition and do not have a customer portal license. All I want to do is add a simple password protection component to the site so that a single outsider can simply access the data on the page. 

 

Questions:

 

1) Is it possible to add some basic authentication component to a force.com site without utilizing the customer portal?

2) Does doing so violate the user agreement? 

Hi,

 

I really don't understand the deployment process of salesforce. I'm trying to implement/deploy my first CONTROLLER. While it works in the Sandbox and when I run it with it's associated PAGE, it fails the deployment debug test each time.

 

I deleted the MyProfileController class which was first giving me a hard time, now I have test coverage of 73% out of 75%- what can i do in the code to increase this? Can one bypass this debug/testing process?

 

My controller (A very, very simple search - working)

 

public class ContactController {

        public String getSearchText() {
             return null;       
        }

   private List<Contact> result = new List<Contact>();
   private String searchText;

   public ContactController(){
   }

   public List<Contact> getResult() {return result;}

   public void setSearchText(String searchText) 
        { this.searchText = searchText; }

   public void search() { 
  String queryText = searchText + '%';
  result = [select Name, group__c, pre_commit__c, consent__c, Phone from Contact Where Name like :queryText ];}
}

 

 

Hi all,

 

So I have been trying to do this for days, where I am developing my first Visualpage.

 

I am using code modified from Jeff Douglass' wonderful dynamic search page: here, where I have taken out his custom picklist.

 

All I want is to list first, last, and account name with an associate search for the respective fields. The search doesn't seem to be implementing. I have a feeling the Javascript isn't passing the variables and/or the search simply isn't running.

 

Any thoughts?

 

 

The Controller:

 

public with sharing class ContactSearchController {
 
  // the soql without the order and limit
  private String soql {get;set;}
  // the collection of contacts to display
  public List<Contact> contacts {get;set;}
 
  // the current sort direction. defaults to asc
  public String sortDir {
    get  { if (sortDir == null) {  sortDir = 'asc'; } return sortDir;  }
    set;
  }
 
  // the current field to sort by. defaults to last name
  public String sortField {
    get  { if (sortField == null) {sortField = 'lastName'; } return sortField;  }
    set;
  }
 
  // format the soql for display on the visualforce page
  public String debugSoql {
    get { return soql + ' order by ' + sortField + ' ' + sortDir + ' limit 20'; }
    set;
  }
 
  // init the controller and display some sample data when the page loads
  public ContactSearchController() {
    soql = 'select firstname, lastname, account.name from contact where account.name != null';
    runQuery();
  }
 
  // toggles the sorting of query from asc<-->desc
  public void toggleSort() {
    // simply toggle the direction
    sortDir = sortDir.equals('asc') ? 'desc' : 'asc';
    // run the query again
    runQuery();
  }
 
  // runs the actual query
  public void runQuery() {
 
    try {
      contacts = Database.query(soql + ' order by ' + sortField + ' ' + sortDir + ' limit 20');
    } catch (Exception e) {
      ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Ooops!'));
    }
 
  }
 
  // runs the search with parameters passed via Javascript
  public PageReference runSearch() {
 
    String firstName = Apexpages.currentPage().getParameters().get('firstname');
    String lastName = Apexpages.currentPage().getParameters().get('lastname');
    String accountName = Apexpages.currentPage().getParameters().get('accountName');
 
    soql = 'select firstname, lastname, account.name from contact where account.name != null';
    if (!firstName.equals(''))
      soql += ' and firstname LIKE \''+String.escapeSingleQuotes(firstName)+'%\'';
    if (!lastName.equals(''))
      soql += ' and lastname LIKE \''+String.escapeSingleQuotes(lastName)+'%\'';
    if (!accountName.equals(''))
      soql += ' and account.name LIKE \''+String.escapeSingleQuotes(accountName)+'%\'';  
      
    // run the query again
    runQuery();
 
    return null;
  }
 
 
 
}

 

 

The Page Code: 

 

<apex:page controller="ContactSearchController" sidebar="false">
 
  <apex:form >
  <apex:pageMessages id="errors" />
 
  <apex:pageBlock title="Find Me A Customer!" mode="edit">
 
  <table width="100%" border="0">
  <tr>  
    <td width="200" valign="top">
 
      <apex:pageBlock title="Parameters" mode="edit" id="criteria">
 
      <script type="text/javascript">
      function doSearch() {
        searchServer(
          document.getElementById("firstName").value,
          document.getElementById("lastName").value,
          document.getElementById("accountName").value,
          );
      }
      </script> 
 
      <apex:actionFunction name="searchServer" action="{!runSearch}" rerender="results,debug,errors">
          <apex:param name="firstName" value="" />
          <apex:param name="lastName" value="" />
          <apex:param name="accountName" value="" />
      </apex:actionFunction>
 
      <table cellpadding="2" cellspacing="2">
      <tr>
        <td style="font-weight:bold;">First Name<br/>
        <input type="text" id="firstName" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">Last Name<br/>
        <input type="text" id="lastName" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">Account<br/>
        <input type="text" id="accountName" onkeyup="doSearch();"/>
        </td>
          </tr>

      </table>
 
      </apex:pageBlock>
 
    </td>
    <td valign="top">
 
    <apex:pageBlock mode="edit" id="results">
 
        <apex:pageBlockTable value="{!contacts}" var="contact">
 
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="First Name" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="firstName" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.firstName}"/>
            </apex:column>
 
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Last Name" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="lastName" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.lastName}"/>
            </apex:column>
 
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Account" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="account.name" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.account.name}"/>
            </apex:column>
 
         
 
        </apex:pageBlockTable>
 
    </apex:pageBlock>
 
    </td>
  </tr>
  </table>
 
  <apex:pageBlock title="Debug - SOQL" id="debug">
      <apex:outputText value="{!debugSoql}" />           
  </apex:pageBlock>    
 
  </apex:pageBlock>
 
  </apex:form>
 
</apex:page>

 

 

 

 

I get the following errors when tring to deploy my first website from sandbox to production

MyProfilePageController.testSave()Class7835Failure Message: "System.QueryException: List has no rows for assignment to SObject", Failure Stack Trace: "Class.MyProfilePageController.testSave: line 78, column 35 External entry point"
Deploy Error


Average test coverage across all Apex Classes and Triggers is 46%, at least 75% test coverage is required

 

 

However, MyProfilePageController is not my code and is not included in the change set anyway!  So what on earth is this all about?