• NJDeveloper019
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 25
    Questions
  • 28
    Replies

I downloaded the enterprise.wsdl and using axis tools managed to get the wsdl2java tool working and built the java stubs for the wsdl.  I'm trying to do a simple login into SalesForce and grab some data from the contact object, an extremely simple app.  I cannot find the SoapBindingStub and I am completely stuck and its making me so mad.  Below is a list of the java classes that were created as a result of using axis tools.

 

InvalidFieldFault.java

InvalidIdFault.java

InvalidNewPasswordFault.java

InvalidQueryLocatorFault.java

InvalidSObjectFault.java

LoginFault.java

MalformedQueryFault.java

MalformedSearchFault.java

SforceServiceCallbackHandler.java

SforceServiceStub.java

UnexpectedErrorFault.java

 

I read somewhere that SoapBindingStuf is found is SforceServiceStub.java but I cannot find it anywhere.  I am really stuck here and any help that anybody could give, I would really appreciate it.  I am kinda new to java as I'm mainly a .NET guy and this is bothering me.

 

Ralph

 

Alright I am about fed up with this SalesForce Eclipse IDE.  Can someone please tell me why I am getting an error for an unknown property.  I was having trouble adding new fields to the VF page recently and it would not save so I deleted the class and page and made new ones and pasted the code back in, thinking that maybe something got corrupted.  Now **bleep** near all properties and methods say they dont exist and it makes no sense to me.

 

Below is a copy of the class and VF page.  It looks clear to me that this property is in the controller, both get and set and I have a feeling that I am missing something blatant and easy.  Anybodies help in resolving this would be greatly appreciated as I'm on the verge of losing it.

 

PAGE (the actionsupport is commented out because it was also erroring.)

<apex:page controller="searchController" name="advancedSearch" Label="Advanced Search" title="Advanced Search">
<style type="text/css">
.unitDisabled {background-color: lightgray; }
.customMessage {background-color: #FFFFCC; border-style: solid; border-width: 1px; border-color: #3399FF; color: #000000; padding: 12px 14px 12px 12px; margin: 0 0 4px; }
</style>
<apex:form >
    <apex:pageBlock title="Choose Search Type" >
         <apex:outputPanel >
           <apex:selectRadio value="{!searchType}">
               <apex:selectOptions value="{!searchChoice}" />
           </apex:selectRadio>
         <!--apex:actionSupport event="onchange" action="{!toggleVisibility}" rerender="searchCriteria,businessUnit,searchStatus"></apex:actionSupport-->
         </apex:outputPanel>
     </apex:pageBlock>
</apex:form>
</apex:page>

 

I have a simple trigger written that everytime there is an insert or update on a custom object record, that record gets inserted into another object.  This is for transaction history but currently, the only data being copied is the name and Id.  The problem is that I have Name on the history object setup as an autonumber {0000000000} starting at 1.  But everytime I make an update or insert and the trigger fires, a record is inserted into the history object but the auto number is incrementing by 2, instead of one.  If I am to go into the submit history object and create a new record by hand, the auto number increments by 1 like its supposed to.  This means to me that the trigger must be firing twice.  But it is not inserting 2 records into the history object, only 1 and its skipping the insert for the first record.

 

I have read that this is the order of execution for updates / creates:

 

1. The original record is loaded from the database (or initialized for an insert statement)
2. The new record field values are loaded from the request and overwrite the old values
3. System validation occurs, such as verifying that all required fields have a non-null value, and running any user-defined validation rules
4. All before triggers execute
5. The record is saved to the database, but not yet committed
6. All after triggers execute
7. Assignment rules execute
8. Auto-response rules execute
9. Workflow rules execute
10. If there are workflow field updates, the record is updated again
11. If the record was updated with workflow field updates, before and after triggers fire one more time (and only one more time)
12. Escalation rules execute
13. All DML operations are committed to the database
14. Post-commit logic executes, such as sending email

 

I currently have no workflows activated and even if I did, none of them make changes to the submit record.  I also have two other triggers neither update or insert into the submit object thus firing off the trigger again.  I do not understand why the trigger would be firing twice and if it is, why only the second of the two is saved in submit history thus skipping over an auto number.  If anybody has any insight on this issue, I would be glad to hear it.

 

Thanks,

 

Ralph

 

Below is a copy of the trigger I wrote to save the history.

 

 trigger submitHistoryTrigger on Submit__c (after insert, after update)
{
    Submit_History__c submitHistory = new Submit_History__c();

    for (Submit__c s : Trigger.new)
    {
        submitHistory.Submit_ID__c = s.Name;
        submitHistory.Submit__c = s.Id;
        
        insert submitHistory;
        
    }

}

 

 

I have a VisualForce page built that allows users of our SalesForce instance to run an advanced search on objects.  This page uses actionSupport and outputPanel to utilize AJAX for different sections of the page.  The problem is that the AJAX does not seem to fire in IE8, Google Chrome, or Safari.  It works just fine in FireFox 3.5.  Why does this only work in Firefox? 

 

Below is some code showing my actionSupport usage.

 

 <apex:page controller="searchController" name="advancedSearch" Label="Advanced Search" title="Advanced Search">
<style type="text/css">
.unitDisabled {background-color: lightgray; }
.customMessage {background-color: #FFFFCC; border-style: solid; border-width: 1px; border-color: #3399FF; color: #000000; padding: 12px 14px 12px 12px; margin: 0 0 4px; }
</style>
  <apex:form >
     <apex:pageBlock title="Choose Search Type" >
         <apex:outputPanel >
           <apex:selectRadio value="{!searchType}">
               <apex:selectOptions value="{!searchChoice}" />
           </apex:selectRadio>
         <apex:actionSupport event="onchange" action="{!toggleVisibility}" rerender="searchCriteria,businessUnit,searchStatus"></apex:actionSupport>
         </apex:outputPanel>
     </apex:pageBlock>
     <apex:outputPanel id="businessUnit">
           <apex:pageBlock title="Choose Business Unit" >
                  <table>
                      <tr>
                    <td>                  
               <apex:selectList value="{!selectedUnits}" multiselect="true" disabled="{!unitDisabled}" disabledClass="unitDisabled">
                   <apex:selectOptions value="{!businessUnitList}" />
               </apex:selectList>
                       </td>
                       <td style="vertical-align: middle;">
                   <apex:outputText value="Business Unit Selection is disabled for Consultant Search." rendered="{!showUnitDisabled}" styleClass="customMessage"/>
                       </td>
                   </tr>
               </table>
         </apex:pageBlock>
     </apex:outputPanel>
     <apex:pageBlock title="Choose Owner">
           <apex:selectList value="{!selectedOwner}" multiselect="false" size="10">
               <apex:selectOptions value="{!userList}" />
           </apex:selectList>
     </apex:pageBlock>
     
     <apex:outputPanel id="searchCriteria">

 

          // Where users enter their search criteria and search.

 

     </apex:outputPanel>
    

I have a custom object named Consultant that holds contact information for consultants of our company.  FirstName and LastName are the two fields within this custom object that represent the consultants name.  My issue, is that when running a lookup to this Consultant object, the record name is the value that comes up.  I can add fields to the lookup so you could see the FirstName and LastName but there is still a problem.  The object that is related to Consultant, will only show the record name in the lookup field in the record.  I want to make my record name for Consultant a formula field that is a concatenation of First Name and LastName.  The standard object Contact has a setup like this and I want to replicate it.  I don't see how to handle this if it's even possible.  Can this be done and if so, how?

 

Thanks,

 

Ralph

I am new to triggers.  I am trying to build a trigger that will update a number field in a parent object before a delete or after an insert.  The workflow is as follows. (I only did the insert piece first just to try to get it working)

 

1. Check to see if the there is an insert from submit__c

2. Build a list of all submit records that have the same parent job order as the newly inserted submit record

3. Select all job orders that have the same id as the job order of the newly inserted record (should only be 1)

4. Foreach of these job orders (should be 1), set submit_count__c to the size of the list from step 2 and add to updatedCount

5. update updatedCount (job order that needs to have its submit_count__c updated)

 

This does not seem to be working at all.  How can I test to make sure the trigger is firing?  I've tried hardcoding jo.Submit_Count__c but still nothing.  Either something is wrong in my trigger code or the trigger isnt firing.  Any help would be greatly appreciated.

 

Following is the trigger code:

trigger rollupSubmits on Submit__c (before delete, after insert)
{
    List<Job_Order__c> updatedCount = new List<Job_Order__c>();
   
    if (Trigger.isInsert)
    {
        for (Submit__c s : Trigger.new)
        {
            List<Submit__c> submits = [SELECT Id FROM Submit__c WHERE Job_Order__c = :s.Job_Order__r.Id];
           
            for (Job_Order__c jo : [SELECT Id, Submit_Count__c FROM Job_Order__c WHERE Id = :s.Job_Order__r.Id])
            {
                jo.Submit_Count__c = submits.size();
                //jo.Submit_Count__c = 20;
                updatedCount.add(jo);
            }
           
            update updatedCount;
        }
    }
   
}

 

I want to create a new view for accounts.  There is a related list attached to the account object by way of a lookup field in a "discounts" custom object.  My problem is I want to create a new view that will show all accounts thats don't have any discounts.  So I need to check whether the discounts related list is empty or not.  I do not see how to do this and I'm not sure it's even possible, but this is a very important feature in our system.  Can anybody give me some insight into this?

 

Thanks,

 

Ralph

I am getting my test coverage up to snuff for deployment but I have a few page references that are connected to a commandbutton.  I am running a test for this that simply checks to make sure querySelect is not null.  However I am getting an assertion failed:

 

System.Exception: Assertion Failed: Same value: null

 

Now it is clearly not null because I am setting the variable querySelect but I am thinking querySelect is not staying set because of state of a page reference.  I really don't know though and it would be great if someone could give me a little insight as to why this is not working.

 

CONTROLLER CLASS (Some of the class has been omitted)

public class searchController
{
    private List<User> users = new List<User>();
    private List<Business_Unit__c> units = new List<Business_Unit__c>();
    private List<Account> accountResults = new List<Account>();
    private List<Contact> contactResults = new List<Contact>();
    private List<Consultant__c> consultantResults = new List<Consultant__c>();
    private List<Job_Order__c> jobOrderResults = new List<Job_Order__c>();
    private List<Submit__c> submitResults = new List<Submit__c>();
    //private List<Location__c> state = new List<Location__c>();
    //private string[] unit = new string[]{};
    private List<String> unit = new List<String>{};
    public string user = null;
    public string searchType = null;
    public integer unitCount = 0;
    private string queryUnit = null;
    private string queryUser = null;
    public string querySearch = null;
    public string querySelect = null;
   
    //Account Search Variables
    private string accountName = null;
    private string accountId = null;
    private string city = null;
    private string state = null;
   
    //Contact Search Variables
    private string contactName = null;
    private string contactId = null;
    private string contactEmail = null;
   
    //Consultant Search Variables
    private string consultantName = null;
    private string consultantId = null;
    private string consultantHomeEmail = null;
    private string consultantWorkEmail = null;
    private string consultantResume = null;
   
    //Job Order Search Variables
    private string jobOrderId = null;
    private string jobOrderPositionTitle = null;
    private string jobOrderDescription = null;
    private string jobOrderStatus = null;
   
    //Submit Search Variables
    private string submitId = null;
    private string submitStatus = null;
   
    //AJAX variables
    public boolean criteriaVal = false;
    public boolean accountVal = false;
    public boolean contactVal = false;
    public boolean consultantVal = false;
    public boolean jobOrderVal = false;
    public boolean submitVal = false;
    public boolean interviewVal = false;
    public boolean resultsVal = false;
    public boolean resultsTableVal = false;
   
    //Flags
    public boolean unitFlag = false;
    public boolean unitAllFlag = false;
    public boolean userFlag = false;
    public boolean userAllFlag = false;
    public boolean searchFlag = false;
    public boolean unitDisabledFlag = false;
   
    //Error variables
    public boolean noUnitUser = false;
    public boolean noResults = false;
    public boolean disabledUnit = false;

 

    // Account Search
    public PageReference searchAccount()
    {    
        resultsVal = true;
        unitCount = unit.size();
        querySearch = '';
        
        resetUserUnitAllFlag();
        checkUserUnit();
        
        if (userFlag == false && unitFlag == false)
        {
            setBusinessUnit();
            setUser();
            
            querySelect = 'SELECT Id, Account_ID__c, Name, Phone, Industry, Website FROM Account ';
            
            // Search Criteria entered
            if (searchFlag == true)
            {
                // Business Units chosen and All Owners
                if (unitAllFlag == true && userAllFlag == false)
                {
                    querySelect = querySelect + 'WHERE ' + querySearch + 'AND ' + queryUnit + 'ORDER BY Account_ID__c DESC';    
                }
                
                // All Business Units and Owner chosen
                if (unitAllFlag == false && userAllFlag == true)
                {
                    querySelect = querySelect + 'WHERE ' + querySearch + 'AND ' + queryUser + 'ORDER BY Account_ID__c DESC';
                }
                
                // All Business Units and Owners
                if (unitAllFlag == false && userAllFlag == false)
                {
                    querySelect = querySelect + 'WHERE ' + querySearch + 'ORDER BY Account_ID__c DESC';
                }
                
                // Business Units chosen and Owner chosen
                if (unitAllFlag == true && userAllFlag == true)
                {
                    querySelect = querySelect + 'WHERE ' + querySearch + 'AND ' + queryUnit + 'AND ' + queryUser + 'ORDER BY Account_ID__c DESC';
                }
            }
            // No Search Criteria Entered
            else
            {
                // Business Units chosen and All Owners
                if (unitAllFlag == true && userAllFlag == false)
                {
                    querySelect = querySelect + 'WHERE ' + queryUnit + 'ORDER BY Account_ID__c DESC';
                }
                
                // All Business Units and Owner chosen
                if (unitAllFlag == false && userAllFlag == true)
                {
                    querySelect = querySelect + 'WHERE ' + queryUser + 'ORDER BY Account_ID__c DESC';
                }
                
                // All Business Units and Owners
                if (unitAllFlag == false && userAllFlag == false)
                {
                    querySelect = querySelect + 'ORDER BY Account_ID__c DESC';
                }
                
                // Business Units chosen and Owner chosen
                if (unitAllFlag == true && userAllFlag == true)
                {
                    querySelect = querySelect + 'WHERE ' + queryUnit + 'AND ' + queryUser + 'ORDER BY Account_ID__c DESC';
                }    
            }

            accountResults = Database.query(querySelect);
                                
            if (accountResults.size() > 0)
            {
                noResults = false;
            }
            else
            {
                noResults = true;
            }
        }
        
        searchFlag = false;
        return null;
    }

 

    private void checkUserUnit()
    {
        if (user != null)
        {
            userFlag = false;
        }
        else
        {
            userFlag = true;
        }
        
        if (unitCount > 0)
        {
            unitFlag = false;
        }
        else
        {
            unitFlag = true;
        }
    }

}

 

TEST CLASS

@isTest
private class searchTest {
   
    static testMethod void searchTest()
    {
        PageReference pageRef = Page.AdvancedSearch;
       
        Test.setCurrentPageReference(pageRef);
       
        searchController mySearchCon = new searchController();
       
        List<SelectOption> l;
        string s;
        string t = 'true';
        string a = 'test';
        Boolean b;
        PageReference p;           

       
        mySearchCon.user = 'a';
        mySearchCon.unitCount = 1;
        mySearchCon.searchAccount();
        System.assertNotEquals(mySearchCon.querySelect, null);
       
    }
   
}

I am building a test Class that will get me over the 75% hump that I need to deploy again to Production.  The problem seems to be that I need to access and set variables in my controller class to be able to go through the conditional statements of the methods in the controller class.  Most of these variables are private but a few are public variables.  For both sets of variables tho I continue to get a save error stating, "Variable is not visible".  Am I doing something incorrect here or can I not access these variables.  Some code below will hopefully help illustrate my issue.  Mind you I removed almost everything from the controller class because it is much too large to post here.

 

TEST CLASS

@isTest
private class searchTest {
   
    static testMethod void searchTest()
    {
        PageReference pageRef = Page.AdvancedSearch;
       
        Test.setCurrentPageReference(pageRef);
       
        searchController mySearchCon = new searchController();
       
        string s = null;
       
        s = mySearchCon.toggleVisibility();
        system.assertEquals(s, null);
       
        mySearchCon.criteriaVal = true;
        Boolean b = mySearchCon.getShowCriteria();
        system.assertEquals(b, true);

       
        List<SelectOption> l = mySearchCon.getUserList();
        system.assert(l.size() > 0);
       
        l = mySearchCon.getBusinessUnitList();
        system.assert(l.size() > 0);
       
        l = mySearchCon.getSearchChoice();
        system.assert(l.size() > 0);
       
        l = mySearchCon.getStateList();
        system.assert(l.size() > 0);
       
        l = mySearchCon.getJOStatusList();
        system.assert(l.size() > 0);
       
        l = mySearchCon.getSubmitStatusList();
        system.assert(l.size() > 0);
    }
   
}

 

CONTROLLER CLASS

public class searchController
{
    private List<User> users = new List<User>();
    private List<Business_Unit__c> units = new List<Business_Unit__c>();
    private List<Account> accountResults = new List<Account>();
    private List<Contact> contactResults = new List<Contact>();
    private List<Consultant__c> consultantResults = new List<Consultant__c>();
    private List<Job_Order__c> jobOrderResults = new List<Job_Order__c>();
    private List<Submit__c> submitResults = new List<Submit__c>();
    //private List<Location__c> state = new List<Location__c>();
    //private string[] unit = new string[]{};
    private List<String> unit = new List<String>{};
    private string user = null;
    private string searchType = null;
    private integer unitCount = 0;
    private string queryUnit = null;
    private string queryUser = null;
    private string querySearch = null;
    private string querySelect = null;
   
    //Account Search Variables
    private string accountName = null;
    private string accountId = null;
    private string city = null;
    private string state = null;
   
    //Contact Search Variables
    private string contactName = null;
    private string contactId = null;
    private string contactEmail = null;
   
    //Consultant Search Variables
    private string consultantName = null;
    private string consultantId = null;
    private string consultantHomeEmail = null;
    private string consultantWorkEmail = null;
    private string consultantResume = null;
   
    //Job Order Search Variables
    private string jobOrderId = null;
    private string jobOrderPositionTitle = null;
    private string jobOrderDescription = null;
    private string jobOrderStatus = null;
   
    //Submit Search Variables
    private string submitId = null;
    private string submitStatus = null;
   
    //AJAX variables
    boolean criteriaVal = false;
    boolean accountVal = false;
    boolean contactVal = false;
    boolean consultantVal = false;
    boolean jobOrderVal = false;
    boolean submitVal = false;
    boolean interviewVal = false;
    boolean resultsVal = false;
    boolean resultsTableVal = false;

 

    //Flags
    boolean unitFlag = false;
    boolean unitAllFlag = false;
    boolean userFlag = false;
    boolean userAllFlag = false;
    boolean searchFlag = false;
    boolean unitDisabledFlag = false;
   
    //Error variablea
    boolean noUnitUser = false;
    boolean noResults = false;
    boolean disabledUnit = false;

   

 

    public Boolean getShowCriteria()
    {
        return criteriaVal;
    }

}

 

 

ERROR
Save error: Variable is not visible: criteriaVal

I have been building an advanced Search visualforce application for weeks now using Force.com IDE in eclipse.  The originally did it on the page but our SF account was upgraded to production and I was no longer able to access the APEX code on the page.  So I have been deploying to server everytime I made a change and wanted to do testing on our SF instance.  Just today I tried to deploy after some changes and got the error message,

 

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

 

This has never appeared before and I am stumped as to why it just appeared suddenly and it not allowing me to deploy my code anymore.  Did something change recently?  I have never written any tests for this and I am not sure even how to write tests in Apex.

I am building a dashboard with 3 columns to put charts in based on custom reports I have built.  I have put 5 charts in there with two in the left column, two in the middle column, and one in the right column.  But when I go to my homepage, only the top 3 charts appear.  I wasn't under the impression I was limited to only 3 charts on a dashboard.  Is this correct or can I have more than that?
I have a page that makes an changes an outputPanels visibility through AJAX based on a radio button selection with the use of an actionSupport.  Everything works 100% in IE and Firefox but does not seem to fire in Google Chrome.  When selecting a radio button or changing radio button selections in Chrome (and Safari), no changes in visibility of the outputPanel occur.  Has anyone else experienced this issue?  While I am assuming this is a browser issue, is there any workaround for this to allow the AJAX to work.

I have an outputPanel that has a radioList within it that I am using with an actionSupport .  I am using the actionSupport to rerender another outputPanel through the use of AJAX.  Now I would like the radioList selection to rerender more than one Panel.  I know I can obviously move the second pageBlock within the already controlled outputPanel but I was wondering if you can rerender multiple outPutPanels off of a single actionSupport?

 

When using a lookup field, it pops up a search window that allows me to search for a record and has a few record choices in there.  For example, if I had a relationship between Contact and Account and I clicked on the lookup field in a Contact record to relate an Account to it, it would give me a popup window showing me a few Account choices and also allow me to search for an account.  My question is can I change this window and if so how can I do so.  I want to be able to show all accounts in the window and also change the view so the user can see more information about an account record than just the Name.
Is there a way to set the default view when entering a tab.  For example, I want "All Accounts" to be the default view when entering the Account tab.
I have a single-select picklist built in a custom object holding states in my SalesForce instance.  I would like to repricate these picklist values in another picklist that I have in a custom VisualForce page.  I could enter all the values in manually with .add but this seems like a poor choice.  If someone changes values in the picklist in my custom object, I would also like the list to change in my VisualForce page.  This way a change in my custom object doesn't require a change in a VisualForce page everytime.  My question is how do I select all of the values out of the picklist in my custom object so I may bind them to my picklist in my VisualForce page.  If I have to loop through the values, that is fine too.

I am building an advanced search page using VisualForce for objects in our SalesForce implementation.  Because of the multiple variables and situations and the limitations of Apex and SOQL in general, I have chosen to build dynamic SOQL to accomplish my goals.  This is all working fine but I am having some issues with a relationship query and I'm having a bit of trouble wrapping my head around the proper resolution.  I am building a SOQL query to search the "Account" standard object but in our SalesForce we have a "Location" custom object that holds geographic location for accounts.  It is a master/child relationship so an account(parent) can have multiple locations(children).  If someone enters a city, the SOQL query WHERE must check againt a field in Location and not Account.  An example query is as follows:

 

SELECT Id, Account_ID__c, Name FROM Account WHERE Name = :accountName AND Locations__r.City__c = :accountCity ORDER BY Account_ID__c DESC

 

This does not work for me and does not even make sense to me that it would work.  In SQL this would be accomplished with a join between account and location and then you could check against the city, but there are no joins in SOQL.  The above query needs to return all accounts where name = "variable account name" and location.city = "variable account city".  A single account can have multiple cities though as each location for a particular account is a different address.  I probably did a poor job of explaining this, but if anyone can give me some insight as to how to get this done or let me know what I'm doing incorrectly, it would help quite a bit.

 

Thanx 

Once an account is created, I can go in and change the account owner to a different account.  I am looking to also have this functionality available upon account creation.  Currently, when creating an account, owner is read only and I have no option to change it to a different user.  Is there a setting to allow the changing of an owner at record creation?
I am building a workflow that will send out an email everytime an Account is created.  I would like the email template to include a link to the newly created account record although I do not see if this is possible.  Has anybody done anything like this?

I am trying to figure out how to concatenate strings in SalesForce Apex code.  I do not see it anywhere in string methods and as far as I can tell, its not possible.  Am i crazy here?  Is something as simple as string concatenation not available in SalesForce?

 

Thanks

I downloaded the enterprise.wsdl and using axis tools managed to get the wsdl2java tool working and built the java stubs for the wsdl.  I'm trying to do a simple login into SalesForce and grab some data from the contact object, an extremely simple app.  I cannot find the SoapBindingStub and I am completely stuck and its making me so mad.  Below is a list of the java classes that were created as a result of using axis tools.

 

InvalidFieldFault.java

InvalidIdFault.java

InvalidNewPasswordFault.java

InvalidQueryLocatorFault.java

InvalidSObjectFault.java

LoginFault.java

MalformedQueryFault.java

MalformedSearchFault.java

SforceServiceCallbackHandler.java

SforceServiceStub.java

UnexpectedErrorFault.java

 

I read somewhere that SoapBindingStuf is found is SforceServiceStub.java but I cannot find it anywhere.  I am really stuck here and any help that anybody could give, I would really appreciate it.  I am kinda new to java as I'm mainly a .NET guy and this is bothering me.

 

Ralph

 

Alright I am about fed up with this SalesForce Eclipse IDE.  Can someone please tell me why I am getting an error for an unknown property.  I was having trouble adding new fields to the VF page recently and it would not save so I deleted the class and page and made new ones and pasted the code back in, thinking that maybe something got corrupted.  Now **bleep** near all properties and methods say they dont exist and it makes no sense to me.

 

Below is a copy of the class and VF page.  It looks clear to me that this property is in the controller, both get and set and I have a feeling that I am missing something blatant and easy.  Anybodies help in resolving this would be greatly appreciated as I'm on the verge of losing it.

 

PAGE (the actionsupport is commented out because it was also erroring.)

<apex:page controller="searchController" name="advancedSearch" Label="Advanced Search" title="Advanced Search">
<style type="text/css">
.unitDisabled {background-color: lightgray; }
.customMessage {background-color: #FFFFCC; border-style: solid; border-width: 1px; border-color: #3399FF; color: #000000; padding: 12px 14px 12px 12px; margin: 0 0 4px; }
</style>
<apex:form >
    <apex:pageBlock title="Choose Search Type" >
         <apex:outputPanel >
           <apex:selectRadio value="{!searchType}">
               <apex:selectOptions value="{!searchChoice}" />
           </apex:selectRadio>
         <!--apex:actionSupport event="onchange" action="{!toggleVisibility}" rerender="searchCriteria,businessUnit,searchStatus"></apex:actionSupport-->
         </apex:outputPanel>
     </apex:pageBlock>
</apex:form>
</apex:page>

 

I have a simple trigger written that everytime there is an insert or update on a custom object record, that record gets inserted into another object.  This is for transaction history but currently, the only data being copied is the name and Id.  The problem is that I have Name on the history object setup as an autonumber {0000000000} starting at 1.  But everytime I make an update or insert and the trigger fires, a record is inserted into the history object but the auto number is incrementing by 2, instead of one.  If I am to go into the submit history object and create a new record by hand, the auto number increments by 1 like its supposed to.  This means to me that the trigger must be firing twice.  But it is not inserting 2 records into the history object, only 1 and its skipping the insert for the first record.

 

I have read that this is the order of execution for updates / creates:

 

1. The original record is loaded from the database (or initialized for an insert statement)
2. The new record field values are loaded from the request and overwrite the old values
3. System validation occurs, such as verifying that all required fields have a non-null value, and running any user-defined validation rules
4. All before triggers execute
5. The record is saved to the database, but not yet committed
6. All after triggers execute
7. Assignment rules execute
8. Auto-response rules execute
9. Workflow rules execute
10. If there are workflow field updates, the record is updated again
11. If the record was updated with workflow field updates, before and after triggers fire one more time (and only one more time)
12. Escalation rules execute
13. All DML operations are committed to the database
14. Post-commit logic executes, such as sending email

 

I currently have no workflows activated and even if I did, none of them make changes to the submit record.  I also have two other triggers neither update or insert into the submit object thus firing off the trigger again.  I do not understand why the trigger would be firing twice and if it is, why only the second of the two is saved in submit history thus skipping over an auto number.  If anybody has any insight on this issue, I would be glad to hear it.

 

Thanks,

 

Ralph

 

Below is a copy of the trigger I wrote to save the history.

 

 trigger submitHistoryTrigger on Submit__c (after insert, after update)
{
    Submit_History__c submitHistory = new Submit_History__c();

    for (Submit__c s : Trigger.new)
    {
        submitHistory.Submit_ID__c = s.Name;
        submitHistory.Submit__c = s.Id;
        
        insert submitHistory;
        
    }

}

 

 

I have a custom object named Consultant that holds contact information for consultants of our company.  FirstName and LastName are the two fields within this custom object that represent the consultants name.  My issue, is that when running a lookup to this Consultant object, the record name is the value that comes up.  I can add fields to the lookup so you could see the FirstName and LastName but there is still a problem.  The object that is related to Consultant, will only show the record name in the lookup field in the record.  I want to make my record name for Consultant a formula field that is a concatenation of First Name and LastName.  The standard object Contact has a setup like this and I want to replicate it.  I don't see how to handle this if it's even possible.  Can this be done and if so, how?

 

Thanks,

 

Ralph

I am new to triggers.  I am trying to build a trigger that will update a number field in a parent object before a delete or after an insert.  The workflow is as follows. (I only did the insert piece first just to try to get it working)

 

1. Check to see if the there is an insert from submit__c

2. Build a list of all submit records that have the same parent job order as the newly inserted submit record

3. Select all job orders that have the same id as the job order of the newly inserted record (should only be 1)

4. Foreach of these job orders (should be 1), set submit_count__c to the size of the list from step 2 and add to updatedCount

5. update updatedCount (job order that needs to have its submit_count__c updated)

 

This does not seem to be working at all.  How can I test to make sure the trigger is firing?  I've tried hardcoding jo.Submit_Count__c but still nothing.  Either something is wrong in my trigger code or the trigger isnt firing.  Any help would be greatly appreciated.

 

Following is the trigger code:

trigger rollupSubmits on Submit__c (before delete, after insert)
{
    List<Job_Order__c> updatedCount = new List<Job_Order__c>();
   
    if (Trigger.isInsert)
    {
        for (Submit__c s : Trigger.new)
        {
            List<Submit__c> submits = [SELECT Id FROM Submit__c WHERE Job_Order__c = :s.Job_Order__r.Id];
           
            for (Job_Order__c jo : [SELECT Id, Submit_Count__c FROM Job_Order__c WHERE Id = :s.Job_Order__r.Id])
            {
                jo.Submit_Count__c = submits.size();
                //jo.Submit_Count__c = 20;
                updatedCount.add(jo);
            }
           
            update updatedCount;
        }
    }
   
}

 

I want to create a new view for accounts.  There is a related list attached to the account object by way of a lookup field in a "discounts" custom object.  My problem is I want to create a new view that will show all accounts thats don't have any discounts.  So I need to check whether the discounts related list is empty or not.  I do not see how to do this and I'm not sure it's even possible, but this is a very important feature in our system.  Can anybody give me some insight into this?

 

Thanks,

 

Ralph

I am getting my test coverage up to snuff for deployment but I have a few page references that are connected to a commandbutton.  I am running a test for this that simply checks to make sure querySelect is not null.  However I am getting an assertion failed:

 

System.Exception: Assertion Failed: Same value: null

 

Now it is clearly not null because I am setting the variable querySelect but I am thinking querySelect is not staying set because of state of a page reference.  I really don't know though and it would be great if someone could give me a little insight as to why this is not working.

 

CONTROLLER CLASS (Some of the class has been omitted)

public class searchController
{
    private List<User> users = new List<User>();
    private List<Business_Unit__c> units = new List<Business_Unit__c>();
    private List<Account> accountResults = new List<Account>();
    private List<Contact> contactResults = new List<Contact>();
    private List<Consultant__c> consultantResults = new List<Consultant__c>();
    private List<Job_Order__c> jobOrderResults = new List<Job_Order__c>();
    private List<Submit__c> submitResults = new List<Submit__c>();
    //private List<Location__c> state = new List<Location__c>();
    //private string[] unit = new string[]{};
    private List<String> unit = new List<String>{};
    public string user = null;
    public string searchType = null;
    public integer unitCount = 0;
    private string queryUnit = null;
    private string queryUser = null;
    public string querySearch = null;
    public string querySelect = null;
   
    //Account Search Variables
    private string accountName = null;
    private string accountId = null;
    private string city = null;
    private string state = null;
   
    //Contact Search Variables
    private string contactName = null;
    private string contactId = null;
    private string contactEmail = null;
   
    //Consultant Search Variables
    private string consultantName = null;
    private string consultantId = null;
    private string consultantHomeEmail = null;
    private string consultantWorkEmail = null;
    private string consultantResume = null;
   
    //Job Order Search Variables
    private string jobOrderId = null;
    private string jobOrderPositionTitle = null;
    private string jobOrderDescription = null;
    private string jobOrderStatus = null;
   
    //Submit Search Variables
    private string submitId = null;
    private string submitStatus = null;
   
    //AJAX variables
    public boolean criteriaVal = false;
    public boolean accountVal = false;
    public boolean contactVal = false;
    public boolean consultantVal = false;
    public boolean jobOrderVal = false;
    public boolean submitVal = false;
    public boolean interviewVal = false;
    public boolean resultsVal = false;
    public boolean resultsTableVal = false;
   
    //Flags
    public boolean unitFlag = false;
    public boolean unitAllFlag = false;
    public boolean userFlag = false;
    public boolean userAllFlag = false;
    public boolean searchFlag = false;
    public boolean unitDisabledFlag = false;
   
    //Error variables
    public boolean noUnitUser = false;
    public boolean noResults = false;
    public boolean disabledUnit = false;

 

    // Account Search
    public PageReference searchAccount()
    {    
        resultsVal = true;
        unitCount = unit.size();
        querySearch = '';
        
        resetUserUnitAllFlag();
        checkUserUnit();
        
        if (userFlag == false && unitFlag == false)
        {
            setBusinessUnit();
            setUser();
            
            querySelect = 'SELECT Id, Account_ID__c, Name, Phone, Industry, Website FROM Account ';
            
            // Search Criteria entered
            if (searchFlag == true)
            {
                // Business Units chosen and All Owners
                if (unitAllFlag == true && userAllFlag == false)
                {
                    querySelect = querySelect + 'WHERE ' + querySearch + 'AND ' + queryUnit + 'ORDER BY Account_ID__c DESC';    
                }
                
                // All Business Units and Owner chosen
                if (unitAllFlag == false && userAllFlag == true)
                {
                    querySelect = querySelect + 'WHERE ' + querySearch + 'AND ' + queryUser + 'ORDER BY Account_ID__c DESC';
                }
                
                // All Business Units and Owners
                if (unitAllFlag == false && userAllFlag == false)
                {
                    querySelect = querySelect + 'WHERE ' + querySearch + 'ORDER BY Account_ID__c DESC';
                }
                
                // Business Units chosen and Owner chosen
                if (unitAllFlag == true && userAllFlag == true)
                {
                    querySelect = querySelect + 'WHERE ' + querySearch + 'AND ' + queryUnit + 'AND ' + queryUser + 'ORDER BY Account_ID__c DESC';
                }
            }
            // No Search Criteria Entered
            else
            {
                // Business Units chosen and All Owners
                if (unitAllFlag == true && userAllFlag == false)
                {
                    querySelect = querySelect + 'WHERE ' + queryUnit + 'ORDER BY Account_ID__c DESC';
                }
                
                // All Business Units and Owner chosen
                if (unitAllFlag == false && userAllFlag == true)
                {
                    querySelect = querySelect + 'WHERE ' + queryUser + 'ORDER BY Account_ID__c DESC';
                }
                
                // All Business Units and Owners
                if (unitAllFlag == false && userAllFlag == false)
                {
                    querySelect = querySelect + 'ORDER BY Account_ID__c DESC';
                }
                
                // Business Units chosen and Owner chosen
                if (unitAllFlag == true && userAllFlag == true)
                {
                    querySelect = querySelect + 'WHERE ' + queryUnit + 'AND ' + queryUser + 'ORDER BY Account_ID__c DESC';
                }    
            }

            accountResults = Database.query(querySelect);
                                
            if (accountResults.size() > 0)
            {
                noResults = false;
            }
            else
            {
                noResults = true;
            }
        }
        
        searchFlag = false;
        return null;
    }

 

    private void checkUserUnit()
    {
        if (user != null)
        {
            userFlag = false;
        }
        else
        {
            userFlag = true;
        }
        
        if (unitCount > 0)
        {
            unitFlag = false;
        }
        else
        {
            unitFlag = true;
        }
    }

}

 

TEST CLASS

@isTest
private class searchTest {
   
    static testMethod void searchTest()
    {
        PageReference pageRef = Page.AdvancedSearch;
       
        Test.setCurrentPageReference(pageRef);
       
        searchController mySearchCon = new searchController();
       
        List<SelectOption> l;
        string s;
        string t = 'true';
        string a = 'test';
        Boolean b;
        PageReference p;           

       
        mySearchCon.user = 'a';
        mySearchCon.unitCount = 1;
        mySearchCon.searchAccount();
        System.assertNotEquals(mySearchCon.querySelect, null);
       
    }
   
}

I am building a test Class that will get me over the 75% hump that I need to deploy again to Production.  The problem seems to be that I need to access and set variables in my controller class to be able to go through the conditional statements of the methods in the controller class.  Most of these variables are private but a few are public variables.  For both sets of variables tho I continue to get a save error stating, "Variable is not visible".  Am I doing something incorrect here or can I not access these variables.  Some code below will hopefully help illustrate my issue.  Mind you I removed almost everything from the controller class because it is much too large to post here.

 

TEST CLASS

@isTest
private class searchTest {
   
    static testMethod void searchTest()
    {
        PageReference pageRef = Page.AdvancedSearch;
       
        Test.setCurrentPageReference(pageRef);
       
        searchController mySearchCon = new searchController();
       
        string s = null;
       
        s = mySearchCon.toggleVisibility();
        system.assertEquals(s, null);
       
        mySearchCon.criteriaVal = true;
        Boolean b = mySearchCon.getShowCriteria();
        system.assertEquals(b, true);

       
        List<SelectOption> l = mySearchCon.getUserList();
        system.assert(l.size() > 0);
       
        l = mySearchCon.getBusinessUnitList();
        system.assert(l.size() > 0);
       
        l = mySearchCon.getSearchChoice();
        system.assert(l.size() > 0);
       
        l = mySearchCon.getStateList();
        system.assert(l.size() > 0);
       
        l = mySearchCon.getJOStatusList();
        system.assert(l.size() > 0);
       
        l = mySearchCon.getSubmitStatusList();
        system.assert(l.size() > 0);
    }
   
}

 

CONTROLLER CLASS

public class searchController
{
    private List<User> users = new List<User>();
    private List<Business_Unit__c> units = new List<Business_Unit__c>();
    private List<Account> accountResults = new List<Account>();
    private List<Contact> contactResults = new List<Contact>();
    private List<Consultant__c> consultantResults = new List<Consultant__c>();
    private List<Job_Order__c> jobOrderResults = new List<Job_Order__c>();
    private List<Submit__c> submitResults = new List<Submit__c>();
    //private List<Location__c> state = new List<Location__c>();
    //private string[] unit = new string[]{};
    private List<String> unit = new List<String>{};
    private string user = null;
    private string searchType = null;
    private integer unitCount = 0;
    private string queryUnit = null;
    private string queryUser = null;
    private string querySearch = null;
    private string querySelect = null;
   
    //Account Search Variables
    private string accountName = null;
    private string accountId = null;
    private string city = null;
    private string state = null;
   
    //Contact Search Variables
    private string contactName = null;
    private string contactId = null;
    private string contactEmail = null;
   
    //Consultant Search Variables
    private string consultantName = null;
    private string consultantId = null;
    private string consultantHomeEmail = null;
    private string consultantWorkEmail = null;
    private string consultantResume = null;
   
    //Job Order Search Variables
    private string jobOrderId = null;
    private string jobOrderPositionTitle = null;
    private string jobOrderDescription = null;
    private string jobOrderStatus = null;
   
    //Submit Search Variables
    private string submitId = null;
    private string submitStatus = null;
   
    //AJAX variables
    boolean criteriaVal = false;
    boolean accountVal = false;
    boolean contactVal = false;
    boolean consultantVal = false;
    boolean jobOrderVal = false;
    boolean submitVal = false;
    boolean interviewVal = false;
    boolean resultsVal = false;
    boolean resultsTableVal = false;

 

    //Flags
    boolean unitFlag = false;
    boolean unitAllFlag = false;
    boolean userFlag = false;
    boolean userAllFlag = false;
    boolean searchFlag = false;
    boolean unitDisabledFlag = false;
   
    //Error variablea
    boolean noUnitUser = false;
    boolean noResults = false;
    boolean disabledUnit = false;

   

 

    public Boolean getShowCriteria()
    {
        return criteriaVal;
    }

}

 

 

ERROR
Save error: Variable is not visible: criteriaVal

I have been building an advanced Search visualforce application for weeks now using Force.com IDE in eclipse.  The originally did it on the page but our SF account was upgraded to production and I was no longer able to access the APEX code on the page.  So I have been deploying to server everytime I made a change and wanted to do testing on our SF instance.  Just today I tried to deploy after some changes and got the error message,

 

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

 

This has never appeared before and I am stumped as to why it just appeared suddenly and it not allowing me to deploy my code anymore.  Did something change recently?  I have never written any tests for this and I am not sure even how to write tests in Apex.