• John De Santiago
  • NEWBIE
  • 288 Points
  • Member since 2007


  • Chatter
    Feed
  • 11
    Best Answers
  • 4
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 34
    Replies
When I run the test on my class i am getting the Attemp to de-reference a null object

@isTest
public class SV_Case{

static testMethod void createCase(){

sitevisit__c sVisit = new Sitevisit__c();

sVisit.RecordType.Name ='DM_of_Ops_Quality_Audit_Househeeping';
sVisit.baseboard_stairway__c = 'Fail';
sVisit.baseboard_hallways_corridors__c = 'Fail';
sVisit.baseboards_lobbies__c = 'Fail';
sVisit.baseboards_restroom__c = 'Fail';
sVisit.baseboards_conference__c = 'Fail';
sVisit.baseboards_office_area__c = 'Fail';
sVisit.baseboards_kitchen__c = 'Fail';
sVisit.switches_kitchen__c = 'Fail';
sVisit.switches_office__c = 'Fail';
sVisit.switches_lobbies__c = 'Fail';
sVisit.switches_conference_room__c = 'Fail';
sVisit.switches_hallways_corridors__c = 'Fail';
sVisit.switches_stairway__c = 'Fail';
sVisit.switches_kitchen__c = 'Fail';
sVisit.switches_warehouse__c = 'Fail';
sVisit.doors_office__c = 'Fail';
sVisit.doors_restrooms__c = 'Fail';
sVisit.doors_lobbies__c = 'Fail';
sVisit.doors_conference_room__c = 'Fail';
sVisit.doors_hallways_corridors__c = 'Fail';
sVisit.doors_stairway__c = 'Fail';
sVisit.doors_kitchen__c = 'Fail';
sVisit.doors_warehouse__c = 'Fail';
sVisit.walls_partitions_restroom_lockerroom__c = 'Fail';
sVisit.walls_partitions_hallways_partitions__c = 'Fail';
sVisit.walls_lobbies__c = 'Fail';
sVisit.walls_conference_room__c = 'Fail';
sVisit.walls_partitions_kitchen__c = 'Fail';
sVisit.walls_partitions_warehouse__c = 'Fail';
sVisit.walls_windows_partitions_office__c = 'Fail';
sVisit.walls_stairway__c = 'Fail';
sVisit.chair_office__c = 'Fail';
sVisit.chairs_lobbies__c = 'Fail';
sVisit.chairs_conference_room__c = 'Fail';
sVisit.chairs_kitchen__c = 'Fail';
sVisit.furniture_warehouse__c = 'Fail';
sVisit.furniture_conference_room__c = 'Fail';
sVisit.furnitures_desk_tables_office__c = 'Fail';
sVisit.furniture_warehouse__c = 'Fail';
sVisit.horizontal_surfaces_office__c = 'Fail';
sVisit.horizontal_surfaces_restroom_lockerroom__c = 'Fail';
sVisit.horizontal_surfaces_lobbies__c = 'Fail';
sVisit.horizontal_surfaces_conference_room__c = 'Fail';
sVisit.horizontal_surfaces_stairway__c = 'Fail';
sVisit.horizontal_surfaces_kitchen__c = 'Fail';
sVisit.horizontal_surfaces_warehouse__c = 'Fail';
sVisit.horizontal_surfaces_hallways_corridors__c = 'Fail';
sVisit.ceilings_office__c = 'Fail';
sVisit.ceiling_stairway__c = 'Fail';
sVisit.ceiling_lobbies__c = 'Fail';
sVisit.ceilings_restroom_lockerroom__c = 'Fail';
sVisit.ceilings_conference_room__c = 'Fail';
sVisit.ceilings_kitchen__c = 'Fail';
sVisit.ceilings_hallways_corridors__c = 'Fail';
sVisit.floors_drains_office__c = 'Fail';
sVisit.floors_lobbies__c = 'Fail';
sVisit.floors_conference_room__c = 'Fail';
sVisit.floors_drains_stairway__c = 'Fail';
sVisit.floors_drains_kitchen__c = 'Fail';
sVisit.floors_drains_warehouse__c = 'Fail';
sVisit.floors_hallways_corridors__c = 'Fail';
sVisit.floors_drains_restroom_lockerroom__c = 'Fail';
sVisit.corners_office__c = 'Fail';
sVisit.corners_restroom_lockerroom__c = 'Fail';
sVisit.corners_lobbies__c = 'Fail';
sVisit.corners_conference_room__c = 'Fail';
sVisit.corners_stairway__c = 'Fail';
sVisit.corners_kitchen__c = 'Fail';
sVisit.corners_warehouse__c = 'Fail';
sVisit.corners_hallways_corridors__c = 'Fail';
sVisit.vents_office__c = 'Fail';
sVisit.vents_restroom_lockerroom__c = 'Fail';
sVisit.vents_lobbies__c = 'Fail';
sVisit.vents_conference_room__c = 'Fail';
sVisit.vents_stairway__c = 'Fail';
sVisit.vents_kitchen__c = 'Fail';
sVisit.vents_hallways_corridors__c = 'Fail';
sVisit.trash_hallways_corridors__c = 'Fail';
sVisit.trash_office__c = 'Fail';
sVisit.trash_restroom_lockerroom__c = 'Fail';
sVisit.trash_conference_room__c = 'Fail';
sVisit.trash_kitchen__c = 'Fail';
sVisit.trash_warehouse__c = 'Fail';
sVisit.phones_office__c = 'Fail';
sVisit.phones_lobbies__c = 'Fail';
sVisit.phones_conference_room__c = 'Fail';
sVisit.phones_kitchen__c = 'Fail';
sVisit.baseboard_stairway__c = 'Fail';
sVisit.baseboard_hallways_corridors__c = 'Fail';
sVisit.baseboards_lobbies__c = 'Fail';
sVisit.baseboards_restroom__c = 'Fail';
sVisit.baseboards_conference__c = 'Fail';
sVisit.baseboards_office_area__c = 'Fail';
sVisit.baseboards_kitchen__c = 'Fail';
sVisit.appliances_vending_kitchen__c = 'Fail';
sVisit.drinking_fountains_eyewash_warehouse__c = 'Fail';
sVisit.safety_rails_fire_extinguisher_warehouse__c = 'Fail';
sVisit.stairs_risers_stairway__c = 'Fail';
sVisit.hand_rails_stairway__c = 'Fail';
sVisit.toilets_urinals_restrooms_lockerroom__c = 'Fail';
sVisit.sinks_restroom_lockerroom__c = 'Fail';
sVisit.mirrors_restrooms_lockerroom__c = 'Fail';
sVisit.tables_furniture_kitchen__c = 'Fail';
sVisit.dispensers_restroom__c = 'Fail';
sVisit.job__C='a013000000UHggN';

Test.startTest();

insert sVisit;

Test.stopTest();

}
}

Hi,

 

I am trying to load values into VF input box  based on the account selected from popup.

 

 

              <apex:pageBlockSectionItem id="pageblocksectionitem5">
<apex:outputLabel value="Account Name"></apex:outputLabel>
<apex:panelGroup style="border: 0px solid Blue;" >
<apex:outputPanel layout="inline" style="background-color:#CC0000; padding-left: 3px; position: absolute; margin-left: 0px; margin-top: 2px; margin-right: 0px; height: 20px; border: 0px Red; " ></apex:outputPanel>
<input type="text" name="AccountName" id="Input12" style="margin-left: 5px; " /><img src="/s.gif" class="lookupIcon" onClick='window.open("/apex/xyz,"width=600,height=400,left=150,top=200,toolbar=1,status =1,");'/>
</apex:panelGroup>
</apex:pageBlockSectionItem>

<apex:pageBlockSectionItem id="pageblocksectionitem3">
<apex:outputLabel value="Linea"></apex:outputLabel>
<apex:outputLabel value="{!linea}"></apex:outputLabel>
</apex:pageBlockSectionItem>

I need to populate linea from  the custom field linea__c which is from Account object.. I can query to get the field value. But i need it to happen immediately after the account is selected. How can i do it?

 

Any pointers would be great...

 

Thanks

 

 

 

 

 

 

 

  • November 23, 2010
  • Like
  • 0

I have a visual force page with an Opportunity standard controller.

 

The following code displays the proper information, but is not displaying as a link to that Account.  However, my custom lookup fields to other accounts are displaying properly and linked to their respective Account records. What am I missing here?

 

<apex:outputField value="{!opportunity.Account.name}"/>

 

 

  • November 18, 2010
  • Like
  • 0

I am writing a test class for a trigger.  I can save with no error messages, but when I run the test I get an error message:

MISSING_ARGUMENT, Id not specified in an update call

 

 

Here is the test class.  The part in red below is what I'm getting the message on.  I think I'm just not formatting it correctly.

 

 

@isTest
private class ContractTestFactory{
  private static TestMethod void ContractsonAccount()
    {    
    test.startTest(); 
      
    Account myAccount=new Account(name='testacct',recordtypeid='01270000000Dvnf',
    lead_converted_date__c=date.today());
    insert(myAccount);
    
    List<Contract> Contract= new List<Contract>();
    Contract myContract = new Contract(recordtypeid='01270000000DwX4',
            account=myAccount,StartDate=date.today());
    
    myContract.RPM_Signed_Contract__c=1;
    update(myContract);
    
    List<Account> insertedAccounts = [SELECT Name, RPM_Signed_Contracts__c 
                                      FROM Account];
    
    System.assertEquals(1,myAccount.RPM_Signed_Contracts__c);
              
    test.stopTest();  
    }    

 

Can anyone help me fix this test so that it runs correctly.  I really am very new to apex and have no idea how to go about fixing this message.

 

Thanks!!!

  • September 27, 2010
  • Like
  • 0

Hi There,

 

I have a 'Save' button on my page that starts as disabled = 'true' until the form fields have been filled with valid information.

 

I have an apex:function that tests the validity of data and rerenders the save button.

 

All works fine, and when the data is valid the save button becomes active. But only the top one!

 

http://awesomescreenshot.com/0dc1o2y57

 

Anyone got a fix?

Hello,

 

I turned on the new User Interface in our sandbox. 

 

When viewing some Visualforce pages, the style of the pageblocks & such seem to be retaining the old design style (e.g. background color, etc).

 

Is this something others have experienced?  Is there something special I need to load to utilize the new style?

 

Thank you

this is my first attempt at writing apex code and I am encountering a roadblock with writing test code for a basic apex class.

 

public class ExtContactRoles{
    
    private final Opportunity temp;
    private Boolean ContactRoleFound;
    
    private ApexPages.StandardController controller;
    
    public ExtContactRoles(ApexPages.StandardController stdController){
        
        ContactRoleFound = false;
        this.temp = (Opportunity)stdController.getRecord();
        for (OpportunityContactRole o:[select Id from OpportunityContactRole where OpportunityId =:temp.Id]){
            
            ContactRoleFound = true;
            
        }
        
    }
    
    
    public PageReference HasContactRole(){
        
        if(!ContactRoleFound){
            PageReference pr = new PageReference('/p/opp/ContactRoleEditUi/e?oppid='+temp.Id);
            pr.setRedirect(true);
            return pr;
        }
        else return Apexpages.currentPage();
    }

}

 

I am trying to write a test class but considering that this is an extension and this my first time writing a test class, I am not sure how to go about it.

 

this is the visual force page that accompanies it. Also the code works fine in the sandbox envoirnment. What it is supposed to do is that every time an opportunity is created, it redirects the user to add contact roles for the opporutnity. If does have an opportunity, it does not redirect. I have this visual force page embedded to the opporunity layout.

 

<apex:page standardController="Opportunity" extensions="ExtContactRoles" action="{!HasContactRole}">

</apex:page>

Hi,

 

I have a question in regards with when to fire a trigger.

 

Can i say on a Object , fire a trigger only when the Owner is "Some User".

 

I want to fire a trigger only when "user x" is the owner of the record.

 

Thanks in advance.

 

Sales4ce

Hi,

 

I wanted to know if at all this can be achieved.

 

Assume that i have a VF page that Overrides the "New" Button on Account Object.

I would force the user here to search for already existing accounts and then if the search returns "No Results", i shall then show the "New" button to create the Account.

 

How can we accomplish this? Can any one provide me some pointers on this.

Your help is highly appreciated.

 

Thanks,

Sales4ce

I need to modify a current API-query below to also include: Contact.Email and Asset.Description.

 

SELECT Account.Id, Account.Name, Description, Amount,

  (SELECT PriceBookEntry.Product2.Name, Id, Quantity, FROM OpportunityLineItems)

FROM Opportunity

 

 

How do I do this?

 

Thanks in advance

/Lars

After a lot of persistence I finally was able to get repeating header and footers when rendering a Visualforce page as a PDF. The key to this is the page2PDF support of CSS3. 

 

Here is the css I came up with:

 

<style type="text/css">

@page {

@top-center {

content: element(header);

}

}

div.header {

padding: 10px;

position: running(header);

}

</style>

 

In the visualforce page I have the header setup as a div with the class name "header" the position running command pulls the content in my div and repeats it at the top of every page. The key for some reason is to put your header and footer divs at the top before you put your content on the page.

 

Here is my page

 

<apex:page renderAs="pdf">

<head>

<style type="text/css" media="print">

@page {

@top-center {

content: element(header);

}

@bottom-left {

  content: element(footer);

}

}

 

div.header {

padding: 10px;

position: running(header);

}

div.footer {

display: block;

padding: 5px;

position: running(footer);

}

 

.pagenumber:before {

content: counter(page);

}

.pagecount:before {

content: counter(pages);

}

</style>

</head>

 

<div class="header">

<div>My Header Text</div>

</div>

 

<div class="footer">

<div>Page <span class="pagenumber"/> of <span class="pagecount"/></div>

</div>

 

<div class="content">

<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum nec nulla turpis. Suspendisse eget risus sit amet lectus ornare varius. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean nec urna purus, adipiscing accumsan massa. Nullam in justo nulla, sed placerat mauris. In ut nunc eget libero posuere luctus. Donec vulputate sollicitudin ultrices. Nulla facilisi. Mauris in sapien arcu. Phasellus sit amet quam non mi ornare tincidunt ac quis lectus.</p>

</div>

</apex:page>

 

I cut the content text short for the purpose of this post. I am sure it will just take some more playing around.

 

Hope this helps someone avoid some late nights like I spent trying to figure this out. :smileyhappy:

 

 

Message Edited by JohnDS on 03-10-2010 07:34 PM
I came across this issue when deploying my triggers to production. The resolution was that under the Project menu in Eclipse make sure Build Automatically is turned off (unchecked), otherwise the fix will get overwritten before you have a chance to deploy.

Once you do this go to the trigger-meta.xml file for your trigger and remove the Active element from the xml and save. You should be able to deploy with out an issue.

This is what worked for me. Hope it helps anyone with the same issue.

After a lot of persistence I finally was able to get repeating header and footers when rendering a Visualforce page as a PDF. The key to this is the page2PDF support of CSS3. 

 

Here is the css I came up with:

 

<style type="text/css">

@page {

@top-center {

content: element(header);

}

}

div.header {

padding: 10px;

position: running(header);

}

</style>

 

In the visualforce page I have the header setup as a div with the class name "header" the position running command pulls the content in my div and repeats it at the top of every page. The key for some reason is to put your header and footer divs at the top before you put your content on the page.

 

Here is my page

 

<apex:page renderAs="pdf">

<head>

<style type="text/css" media="print">

@page {

@top-center {

content: element(header);

}

@bottom-left {

  content: element(footer);

}

}

 

div.header {

padding: 10px;

position: running(header);

}

div.footer {

display: block;

padding: 5px;

position: running(footer);

}

 

.pagenumber:before {

content: counter(page);

}

.pagecount:before {

content: counter(pages);

}

</style>

</head>

 

<div class="header">

<div>My Header Text</div>

</div>

 

<div class="footer">

<div>Page <span class="pagenumber"/> of <span class="pagecount"/></div>

</div>

 

<div class="content">

<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum nec nulla turpis. Suspendisse eget risus sit amet lectus ornare varius. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean nec urna purus, adipiscing accumsan massa. Nullam in justo nulla, sed placerat mauris. In ut nunc eget libero posuere luctus. Donec vulputate sollicitudin ultrices. Nulla facilisi. Mauris in sapien arcu. Phasellus sit amet quam non mi ornare tincidunt ac quis lectus.</p>

</div>

</apex:page>

 

I cut the content text short for the purpose of this post. I am sure it will just take some more playing around.

 

Hope this helps someone avoid some late nights like I spent trying to figure this out. :smileyhappy:

 

 

Message Edited by JohnDS on 03-10-2010 07:34 PM
We're receiving an error stating that we have too many query rows, but the debug log is not showing us where these are coming from. Below is each line in the debug log, in order, containing "SOQL_EXECUTE_END" and its corresponding SQL statement:

11:05:55.603 (1603125374)|SOQL_EXECUTE_BEGIN|[27]|Aggregations:0|select AccountId, SUM(Amount) total from Opportunity where (IsWon = true and Rollup_Stop_Date__c &gt; :tmpVar1 and AccountId = :tmpVar2) group by AccountId
11:05:58.148 (4148435199)|SOQL_EXECUTE_END|[27]|Rows:292
11:05:58.149 (4149429111)|SOQL_EXECUTE_BEGIN|[30]|Aggregations:0|select Id, ParentId, TTM_Sales__c from Account where Id = :tmpVar1
11:05:58.185 (4185336466)|SOQL_EXECUTE_END|[30]|Rows:293
...
11:06:00.810 (6810750395)|SOQL_EXECUTE_BEGIN|[18]|Aggregations:0|select Id, AccountId, Account_Level_Expire__c, Account_Level__c, Hierarchy_TTM_Sales__c, CompanyName from User where AccountId IN :tmpVar1
11:06:00.906 (6906647173)|SOQL_EXECUTE_END|[18]|Rows:365
...
11:06:03.387 (9387092122)|SOQL_EXECUTE_BEGIN|[114]|Aggregations:0|select ParentId, SUM(TTM_Sales__c) total from Account where ParentId = :tmpVar1 group by ParentId
11:06:03.412 (9412617167)|SOQL_EXECUTE_END|[114]|Rows:14
11:06:03.412 (9412951386)|SOQL_EXECUTE_BEGIN|[117]|Aggregations:0|select Id, Hierarchy_TTM_Sales__c, ParentId, TTM_Sales__c from Account where Id = :tmpVar1
11:06:03.447 (9447288861)|SOQL_EXECUTE_END|[117]|Rows:301
11:06:03.489 (9489047107)|SOQL_EXECUTE_BEGIN|[151]|Aggregations:0|select Id, ParentId, TTM_Sales__c from Account
11:06:03.509 (9509692382)|SOQL_EXECUTE_END|[151]|Rows:140
...
Number of query rows: 30222 out of 50000 ******* CLOSE TO LIMIT

So, this is showing that it selecting a total of 1405 rows, then all of the sudden it is at 30222 without ever having shown that it selected anywhere near this many records. Thoughts?

Thanks,
Marc
When I run the test on my class i am getting the Attemp to de-reference a null object

@isTest
public class SV_Case{

static testMethod void createCase(){

sitevisit__c sVisit = new Sitevisit__c();

sVisit.RecordType.Name ='DM_of_Ops_Quality_Audit_Househeeping';
sVisit.baseboard_stairway__c = 'Fail';
sVisit.baseboard_hallways_corridors__c = 'Fail';
sVisit.baseboards_lobbies__c = 'Fail';
sVisit.baseboards_restroom__c = 'Fail';
sVisit.baseboards_conference__c = 'Fail';
sVisit.baseboards_office_area__c = 'Fail';
sVisit.baseboards_kitchen__c = 'Fail';
sVisit.switches_kitchen__c = 'Fail';
sVisit.switches_office__c = 'Fail';
sVisit.switches_lobbies__c = 'Fail';
sVisit.switches_conference_room__c = 'Fail';
sVisit.switches_hallways_corridors__c = 'Fail';
sVisit.switches_stairway__c = 'Fail';
sVisit.switches_kitchen__c = 'Fail';
sVisit.switches_warehouse__c = 'Fail';
sVisit.doors_office__c = 'Fail';
sVisit.doors_restrooms__c = 'Fail';
sVisit.doors_lobbies__c = 'Fail';
sVisit.doors_conference_room__c = 'Fail';
sVisit.doors_hallways_corridors__c = 'Fail';
sVisit.doors_stairway__c = 'Fail';
sVisit.doors_kitchen__c = 'Fail';
sVisit.doors_warehouse__c = 'Fail';
sVisit.walls_partitions_restroom_lockerroom__c = 'Fail';
sVisit.walls_partitions_hallways_partitions__c = 'Fail';
sVisit.walls_lobbies__c = 'Fail';
sVisit.walls_conference_room__c = 'Fail';
sVisit.walls_partitions_kitchen__c = 'Fail';
sVisit.walls_partitions_warehouse__c = 'Fail';
sVisit.walls_windows_partitions_office__c = 'Fail';
sVisit.walls_stairway__c = 'Fail';
sVisit.chair_office__c = 'Fail';
sVisit.chairs_lobbies__c = 'Fail';
sVisit.chairs_conference_room__c = 'Fail';
sVisit.chairs_kitchen__c = 'Fail';
sVisit.furniture_warehouse__c = 'Fail';
sVisit.furniture_conference_room__c = 'Fail';
sVisit.furnitures_desk_tables_office__c = 'Fail';
sVisit.furniture_warehouse__c = 'Fail';
sVisit.horizontal_surfaces_office__c = 'Fail';
sVisit.horizontal_surfaces_restroom_lockerroom__c = 'Fail';
sVisit.horizontal_surfaces_lobbies__c = 'Fail';
sVisit.horizontal_surfaces_conference_room__c = 'Fail';
sVisit.horizontal_surfaces_stairway__c = 'Fail';
sVisit.horizontal_surfaces_kitchen__c = 'Fail';
sVisit.horizontal_surfaces_warehouse__c = 'Fail';
sVisit.horizontal_surfaces_hallways_corridors__c = 'Fail';
sVisit.ceilings_office__c = 'Fail';
sVisit.ceiling_stairway__c = 'Fail';
sVisit.ceiling_lobbies__c = 'Fail';
sVisit.ceilings_restroom_lockerroom__c = 'Fail';
sVisit.ceilings_conference_room__c = 'Fail';
sVisit.ceilings_kitchen__c = 'Fail';
sVisit.ceilings_hallways_corridors__c = 'Fail';
sVisit.floors_drains_office__c = 'Fail';
sVisit.floors_lobbies__c = 'Fail';
sVisit.floors_conference_room__c = 'Fail';
sVisit.floors_drains_stairway__c = 'Fail';
sVisit.floors_drains_kitchen__c = 'Fail';
sVisit.floors_drains_warehouse__c = 'Fail';
sVisit.floors_hallways_corridors__c = 'Fail';
sVisit.floors_drains_restroom_lockerroom__c = 'Fail';
sVisit.corners_office__c = 'Fail';
sVisit.corners_restroom_lockerroom__c = 'Fail';
sVisit.corners_lobbies__c = 'Fail';
sVisit.corners_conference_room__c = 'Fail';
sVisit.corners_stairway__c = 'Fail';
sVisit.corners_kitchen__c = 'Fail';
sVisit.corners_warehouse__c = 'Fail';
sVisit.corners_hallways_corridors__c = 'Fail';
sVisit.vents_office__c = 'Fail';
sVisit.vents_restroom_lockerroom__c = 'Fail';
sVisit.vents_lobbies__c = 'Fail';
sVisit.vents_conference_room__c = 'Fail';
sVisit.vents_stairway__c = 'Fail';
sVisit.vents_kitchen__c = 'Fail';
sVisit.vents_hallways_corridors__c = 'Fail';
sVisit.trash_hallways_corridors__c = 'Fail';
sVisit.trash_office__c = 'Fail';
sVisit.trash_restroom_lockerroom__c = 'Fail';
sVisit.trash_conference_room__c = 'Fail';
sVisit.trash_kitchen__c = 'Fail';
sVisit.trash_warehouse__c = 'Fail';
sVisit.phones_office__c = 'Fail';
sVisit.phones_lobbies__c = 'Fail';
sVisit.phones_conference_room__c = 'Fail';
sVisit.phones_kitchen__c = 'Fail';
sVisit.baseboard_stairway__c = 'Fail';
sVisit.baseboard_hallways_corridors__c = 'Fail';
sVisit.baseboards_lobbies__c = 'Fail';
sVisit.baseboards_restroom__c = 'Fail';
sVisit.baseboards_conference__c = 'Fail';
sVisit.baseboards_office_area__c = 'Fail';
sVisit.baseboards_kitchen__c = 'Fail';
sVisit.appliances_vending_kitchen__c = 'Fail';
sVisit.drinking_fountains_eyewash_warehouse__c = 'Fail';
sVisit.safety_rails_fire_extinguisher_warehouse__c = 'Fail';
sVisit.stairs_risers_stairway__c = 'Fail';
sVisit.hand_rails_stairway__c = 'Fail';
sVisit.toilets_urinals_restrooms_lockerroom__c = 'Fail';
sVisit.sinks_restroom_lockerroom__c = 'Fail';
sVisit.mirrors_restrooms_lockerroom__c = 'Fail';
sVisit.tables_furniture_kitchen__c = 'Fail';
sVisit.dispensers_restroom__c = 'Fail';
sVisit.job__C='a013000000UHggN';

Test.startTest();

insert sVisit;

Test.stopTest();

}
}

Hello,

I am not able to save my components or refresh my components from Server via Eclipse IDE for Force.com after I updated to Winter 12. I always get Connection Timeout exception. 

 

java.net.SocketTimeoutException: connect timed out
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.PlainSocketImpl.doConnect(Unknown Source)
	at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
	at java.net.PlainSocketImpl.connect(Unknown Source)
	at java.net.SocksSocketImpl.connect(Unknown Source)
	at java.net.Socket.connect(Unknown Source)
	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(Unknown Source)
	at sun.net.NetworkClient.doConnect(Unknown Source)
	at sun.net.www.http.HttpClient.openServer(Unknown Source)
	at sun.net.www.http.HttpClient.openServer(Unknown Source)
	at sun.net.www.protocol.https.HttpsClient.<init>(Unknown Source)
	at sun.net.www.protocol.https.HttpsClient.New(Unknown Source)
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
	at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(Unknown Source)
	at com.sforce.ws.transport.JdkHttpTransport.connectRaw(JdkHttpTransport.java:133)
	at com.sforce.ws.transport.JdkHttpTransport.connectLocal(JdkHttpTransport.java:97)
	at com.sforce.ws.transport.JdkHttpTransport.connectLocal(JdkHttpTransport.java:92)
	at com.sforce.ws.transport.JdkHttpTransport.connect(JdkHttpTransport.java:88)
	at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:94)
	at com.sforce.soap.metadata.MetadataConnection.describeMetadata(MetadataConnection.java:345)
	at com.salesforce.ide.core.remote.MetadataStubExt.describeMetadata(MetadataStubExt.java:303)
	at com.salesforce.ide.core.remote.MetadataStubExt.describeMetadata(MetadataStubExt.java:311)
	at com.salesforce.ide.core.remote.MetadataStubExt$$FastClassByCGLIB$$9404e285.invoke(<generated>)
	at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
	at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:700)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
	at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:77)
	at com.salesforce.ide.core.internal.aspects.MetadataOperationsRetryAspect.metadataOperationsRetry(MetadataOperationsRetryAspect.java:22)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:627)
	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:616)
	at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:64)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
	at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635)
	at com.salesforce.ide.core.remote.MetadataStubExt$$EnhancerByCGLIB$$c1ac1f9d.describeMetadata(<generated>)
	at com.salesforce.ide.core.services.MetadataService.getDescribeMetadata(MetadataService.java:54)
	at com.salesforce.ide.core.services.PackageDeployService.adjustDeployOptions(PackageDeployService.java:300)
	at com.salesforce.ide.core.services.PackageDeployService.deployWork(PackageDeployService.java:264)
	at com.salesforce.ide.core.services.PackageDeployService.deploy(PackageDeployService.java:144)
	at com.salesforce.ide.core.services.PackageDeployService.deploy(PackageDeployService.java:127)
	at com.salesforce.ide.core.services.PackageDeployService.deploy(PackageDeployService.java:111)
	at com.salesforce.ide.ui.actions.SaveToServerActionController.deploy(SaveToServerActionController.java:132)
	at com.salesforce.ide.ui.actions.SaveToServerActionController.saveResourcesToServer(SaveToServerActionController.java:114)
	at com.salesforce.ide.ui.actions.SaveToServerAction$1.execute(SaveToServerAction.java:63)
	at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:106)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
	at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:118)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)

 Please let me know if anyone has the similar problem.

 

i am running WIndows 7 professional, Eclipse Indigo R1 and have latest Force.com IDE plugin available.

 

 

Been reading the docs (Using Constructors & Using Initialization Code) trying to understand when to use initializer vs. constructor.  In the "Using Initialization Code" link it is stated:

 

 

If you do not want to write your own constructor for a class, you can use an instance initialization code block to initialize instance variables. However, most of the time you should either give the variable a default value or use the body of a constructor to do initialization and not use instance initialization code.

 

 

It's a bit vague.  Is there a good rule of thumb to follow?

 

Cheers,

 

Tyler

I have a VisualForce page with a table. My costumer wants to be able to download it as an Excel file, using Internet Explorer. I've tried using the contenttype="application/vnd.ms-excel" resource in the "page" tag, but doesn't work.

 

There's no way to convince my costumer to change its browser... how could I do?

  • November 23, 2010
  • Like
  • 0

Hi,

 

I am trying to load values into VF input box  based on the account selected from popup.

 

 

              <apex:pageBlockSectionItem id="pageblocksectionitem5">
<apex:outputLabel value="Account Name"></apex:outputLabel>
<apex:panelGroup style="border: 0px solid Blue;" >
<apex:outputPanel layout="inline" style="background-color:#CC0000; padding-left: 3px; position: absolute; margin-left: 0px; margin-top: 2px; margin-right: 0px; height: 20px; border: 0px Red; " ></apex:outputPanel>
<input type="text" name="AccountName" id="Input12" style="margin-left: 5px; " /><img src="/s.gif" class="lookupIcon" onClick='window.open("/apex/xyz,"width=600,height=400,left=150,top=200,toolbar=1,status =1,");'/>
</apex:panelGroup>
</apex:pageBlockSectionItem>

<apex:pageBlockSectionItem id="pageblocksectionitem3">
<apex:outputLabel value="Linea"></apex:outputLabel>
<apex:outputLabel value="{!linea}"></apex:outputLabel>
</apex:pageBlockSectionItem>

I need to populate linea from  the custom field linea__c which is from Account object.. I can query to get the field value. But i need it to happen immediately after the account is selected. How can i do it?

 

Any pointers would be great...

 

Thanks

 

 

 

 

 

 

 

  • November 23, 2010
  • Like
  • 0

Is there any way to alter the Quote Name so that it auto-populates with a number?

 

I see there is Quote Name and Quote Number standard fields, but I'm unable to alter any of them.  Ideally, I would want to change the Quote Name to Quote Number with an auto-number with a specific format.

 

We do not want our users to worry about the naming convention of the quote.  So, I removed the quote number and I'm trying to figure out a way to have the Quote Name auto-populate with a number, but it's not as easy as I thought.

 

Any work arounds out there?  I've also looked into field update rules to update the Quote Name with a custom Quote Number field, but it still requires the user to enter something into the Quote Name field when creating a new one.

 

Thanks in advance!

I have a visual force page with an Opportunity standard controller.

 

The following code displays the proper information, but is not displaying as a link to that Account.  However, my custom lookup fields to other accounts are displaying properly and linked to their respective Account records. What am I missing here?

 

<apex:outputField value="{!opportunity.Account.name}"/>

 

 

  • November 18, 2010
  • Like
  • 0

Ok, I know there are a lot of posts on this topic, and I am familiar with the two Visualforce techniques for doing this (using an outputField bound to an SObject currency field, and using the outputText value="{0,number,###,##0.00}" ). However, in my use case, I'm trying to display a currency value in the title of a pageBlock:

 

 

<apex:pageBlock title="Refund Amount: {!refundAmount}" >

 

I can't really use the outputText or outputField options here, so I think I need to do the formatting in my controller. The Apex documentation states that String.format(String, List<String>) works "in the same manner as apex:outputText." Has anyone actually used this method to format a Decimal value into a properly formatted currency String in Apex code?

  • November 17, 2010
  • Like
  • 0

I am writing a test class for a trigger.  I can save with no error messages, but when I run the test I get an error message:

MISSING_ARGUMENT, Id not specified in an update call

 

 

Here is the test class.  The part in red below is what I'm getting the message on.  I think I'm just not formatting it correctly.

 

 

@isTest
private class ContractTestFactory{
  private static TestMethod void ContractsonAccount()
    {    
    test.startTest(); 
      
    Account myAccount=new Account(name='testacct',recordtypeid='01270000000Dvnf',
    lead_converted_date__c=date.today());
    insert(myAccount);
    
    List<Contract> Contract= new List<Contract>();
    Contract myContract = new Contract(recordtypeid='01270000000DwX4',
            account=myAccount,StartDate=date.today());
    
    myContract.RPM_Signed_Contract__c=1;
    update(myContract);
    
    List<Account> insertedAccounts = [SELECT Name, RPM_Signed_Contracts__c 
                                      FROM Account];
    
    System.assertEquals(1,myAccount.RPM_Signed_Contracts__c);
              
    test.stopTest();  
    }    

 

Can anyone help me fix this test so that it runs correctly.  I really am very new to apex and have no idea how to go about fixing this message.

 

Thanks!!!

  • September 27, 2010
  • Like
  • 0

Hi All,

 

I am doing cloud deployment in an Enterprise Edition of Salesforce. I am deploying Apex class from sandbox to production server. I have added appex class to outbound change set and uploaded to production org. When I click on the deploy, I am getting the error which says 

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

 

How can I run the test and see the test coverage in cloud deploy? Any direction on this is greatly appreciated.

 

 

  • September 24, 2010
  • Like
  • 0

I'm trying to figure out how to set a variable based on a child field.  My SOQL is part of a for loop and I need to reference the CloseDate and Committed_Premium__c fields but I don't know how.  I've searched and read all morning and can't figure this out.  Please help.

 

 

for (Account A : [Select a.Id, a.Name, a.OwnerId, a.Total_Premium__c, (Select o.CloseDate, o.Committed_Premium__c From Opportunities o where o.CloseDate > 2010-03-01) From Account a where a.type in ('Prospective Agency', 'Existing Agency')]) {

Hello

 

I am trying to write a validation rule on a save or update to an opportunity that checks that the Opportunity Contains a Product (Product Type = Configuration) if the Config_Required Checkbox field is TRUE.

 

I have been trying to write a trigger but cannot get it to work.  Any thought or example would be greatly appreciated.

 

Thank You

 

Jay

Hi There,

 

I have a 'Save' button on my page that starts as disabled = 'true' until the form fields have been filled with valid information.

 

I have an apex:function that tests the validity of data and rerenders the save button.

 

All works fine, and when the data is valid the save button becomes active. But only the top one!

 

http://awesomescreenshot.com/0dc1o2y57

 

Anyone got a fix?

I have an application designed on Developer edition which reads from an external WSDL.

I want to move it to the Enterprise edition.

How to achieve this.?

What are the important points that should be considered before migrating.

 

An urgent help is required

Hello,

 

I turned on the new User Interface in our sandbox. 

 

When viewing some Visualforce pages, the style of the pageblocks & such seem to be retaining the old design style (e.g. background color, etc).

 

Is this something others have experienced?  Is there something special I need to load to utilize the new style?

 

Thank you

After a lot of persistence I finally was able to get repeating header and footers when rendering a Visualforce page as a PDF. The key to this is the page2PDF support of CSS3. 

 

Here is the css I came up with:

 

<style type="text/css">

@page {

@top-center {

content: element(header);

}

}

div.header {

padding: 10px;

position: running(header);

}

</style>

 

In the visualforce page I have the header setup as a div with the class name "header" the position running command pulls the content in my div and repeats it at the top of every page. The key for some reason is to put your header and footer divs at the top before you put your content on the page.

 

Here is my page

 

<apex:page renderAs="pdf">

<head>

<style type="text/css" media="print">

@page {

@top-center {

content: element(header);

}

@bottom-left {

  content: element(footer);

}

}

 

div.header {

padding: 10px;

position: running(header);

}

div.footer {

display: block;

padding: 5px;

position: running(footer);

}

 

.pagenumber:before {

content: counter(page);

}

.pagecount:before {

content: counter(pages);

}

</style>

</head>

 

<div class="header">

<div>My Header Text</div>

</div>

 

<div class="footer">

<div>Page <span class="pagenumber"/> of <span class="pagecount"/></div>

</div>

 

<div class="content">

<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum nec nulla turpis. Suspendisse eget risus sit amet lectus ornare varius. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean nec urna purus, adipiscing accumsan massa. Nullam in justo nulla, sed placerat mauris. In ut nunc eget libero posuere luctus. Donec vulputate sollicitudin ultrices. Nulla facilisi. Mauris in sapien arcu. Phasellus sit amet quam non mi ornare tincidunt ac quis lectus.</p>

</div>

</apex:page>

 

I cut the content text short for the purpose of this post. I am sure it will just take some more playing around.

 

Hope this helps someone avoid some late nights like I spent trying to figure this out. :smileyhappy:

 

 

Message Edited by JohnDS on 03-10-2010 07:34 PM