• varun.sforce
  • NEWBIE
  • 30 Points
  • Member since 2012

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

I keep getting a null object error on this part of my controller but can't figure out why... 

 

I am trying to determine the age of the opportunity as CloseDate - CreateDate for closed opportunities and Today - Created Date for open opportunities. I can't quite figure out how any of these could be null... and in anycase I tried to account for that in the code but is still haunting me... 

 

 public integer getAge() {
    	date close;
    		if( opp.CloseDate == null) {close = system.today();} else {close = opp.CloseDate;}
    	integer openAge = date.valueof(opp.CreatedDate).daysbetween(opp.CloseDate);
    	integer closeAge = date.valueof(opp.CreatedDate).daysBetween(system.today());
        if(opp.isClosed == true && closeAge != null && openAge != null) { return closeAge; } else {return openAge;} 
    }   

Any pointers are greatly appreciated!

 

How can I access the first element in a set?  Example in a list, you can use this to get the first element in the list  

 

Integer x = xList.get(0);

 

What would be a quick equivalent way of doing this in a set?

I keep getting a null object error on this part of my controller but can't figure out why... 

 

I am trying to determine the age of the opportunity as CloseDate - CreateDate for closed opportunities and Today - Created Date for open opportunities. I can't quite figure out how any of these could be null... and in anycase I tried to account for that in the code but is still haunting me... 

 

 public integer getAge() {
    	date close;
    		if( opp.CloseDate == null) {close = system.today();} else {close = opp.CloseDate;}
    	integer openAge = date.valueof(opp.CreatedDate).daysbetween(opp.CloseDate);
    	integer closeAge = date.valueof(opp.CreatedDate).daysBetween(system.today());
        if(opp.isClosed == true && closeAge != null && openAge != null) { return closeAge; } else {return openAge;} 
    }   

Any pointers are greatly appreciated!

 

Hi All,

 

I am working on salesforce to java integration through webservices

 

How to write a select query using two tables like QuoteLineItem and PricebookEntry and compare id's  and get the product2id . this query how to write ?

 

i write a query like this 

 

QueryResult q = binding.query("select id,(select id,product2id from PricebookEntry)from QuoteLineItem");

 

i am getting errors

 

AxisFault
faultCode: {urn:fault.enterprise.soap.sforce.com}INVALID_TYPE
faultSubcode:
faultString: INVALID_TYPE:
id,(select id,product2id from PricebookEntry)from QuoteLineItem
^
ERROR at Row:1:Column:38
Didn't understand relationship 'PricebookEntry' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.
faultActor:
faultNode:
faultDetail:
{urn:fault.enterprise.soap.sforce.com}InvalidSObjectFault:<ns1:exceptionCode>INVALID_TYPE</ns1:exceptionCode><ns1:exceptionMessage>
id,(select id,product2id from PricebookEntry)from QuoteLineItem
^

 

plz help..

 

 

  • September 21, 2012
  • Like
  • 0
<apex:panelBar >
      <apex:repeat value="{!OpenProjects}" var="project" id="panelBarItems">
          <apex:panelBarItem label="Project Name: {!project.Project_Name__c}">
              <apex:detail subject="{!project.ID}" relatedList="false" inlineEdit="true" title="false" rendered="{!showDetails}"/>
              <apex:panelBar >
                  <apex:repeat value="{!Milestones(project.ID)}" var="milestone">
                      <apex:panelBarItem label="Milestone Name: {!milestone.Name}">
                      </apex:panelBarItem>
                  </apex:repeat>
              </apex:panelBar>
          </apex:panelBarItem>
      </apex:repeat>
  </apex:panelBar>

 

    //Get Milestones Based On Project
    public List<Milestone__c> getMilestones(ID Project) {
        return [SELECT Name FROM Milestone__c WHERE Project__c = :Project];
    }

 I'm trying to call a method "getMilestones" with a parameter called "Project" however i'm getting an apex error: Unknown Function Milestones