• sunfishette
  • NEWBIE
  • 75 Points
  • Member since 2012

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

I have a question that seems easy enough ...

 

I have two date fields:

Effective_Date__c

Expiration_Date__c

 

and one picklist field:

Term__c  (populated with: --None--, 1 YEAR, 2 YEARS, 3 YEARS)

 

All I want to do is make the Expiration Date a formula field dependent on the Effective Date plus the Term__c.  Here is what I have so far in my formula field.

Expiration_Date__c =
IF(ISPICKVAL(Term__c, '1 YEAR' ), Effective_Date__c.addYears(1), IF(ISPICKVAL(Term__c, '2 YEARS'), Effective_Date__c.addYears(2), IF(ISPICKVAL(Term__c, '3 YEARS') Effective_Date.addYears(3), NULL)))

 But of course, addYears does not seem to be valid.

 

Go figure.

 

Does anyone have any thoughts on a workaround for this?  I understand that I have not accounted for the --None-- value, and that is fine for now, I just want to see how I can calculate the additional years before I continue with this folly.

 

Thanks folks!!

 

Quick question:

 

I have a SOQL call in my apex class that returns all the opportunity records from a logged in user and displays them on a VF page.  I just figured out that there are some users that have Sharing rules (manual sharing) that connects two different accounts and the records from both accounts are not displaying (despite 'public with sharing' being used in the definition of my class) .

 

IE...

Bob Smith logs in

Bob is with Company ABC

Bob also has access to Opportunity records from Company MNO and XYZ.

In Bobs Opportunity tab, he can see all the records from the three different companies, but he can only see the records from his ABC company displayed on the Visual force page. 

 

Is there something simple that I am missing?  Is there a typical line of apex code that connects the SOQL call to all shared accounts?  I had originally  thought that "WITH SHARING" automatically caused the users login rules to apply to the apex class and all its methods.

 

Thoughts?

Thanks!

Hi -

 

I want to be able to attach a file from opportunity objects Notes and Attachments section to an email.

 

Example:

Fred logs in through partner portal.  He opens Opportunity XYZ and sees there are 6 attached pdf files.  He wants to select 1 of the files, attach it to an email and send it.


So far, the only way he can do it is to download the file to his desktop and work from there. 

 

Can we accomplish this without the download?

 

How?

Thanks!

I have a test class that I am writing, and I need to insert a record.  The records custom object has two master-detail relationships.

Custom Object = Invoice__c

Standard = Opportunity

Standard = Account

 

My insert statement is as such:

Invoice__c invoice = new Invoice__c(T_Invoice__c = '1234', Date_of_Purchase_Order_Authorization__c = testdate, Payment_Due_Date__c = testdate, Payment_Received_Date__c = testdate, Aging__c = 0, Your_Purchase_Order__c = '1234', Account_Name__c = testrenewal.accountId, Amount_w_o_Tax__c = 100.00, Amount__c = 100.00, MR_Opportunity__c = ???, Account_Id__c = ???);

When I try to add logic to get the "id" from the opportunity record, I dont seem to get any errors, but the account "id" keeps throwing errors at me like:

Missing required field (if I remove account_id__c)

Insufficient access on cross reference entity (if I try to grab the id from a test opportunity that I insert before this invoice)

Insufficient access on cross reference entity(if I try to grab the id from a test account that I insert before this invoice)

 

 

The idea is that I am creating an invoice from an opportunity, but it must have the Account Name and Opportunity Name on the invoice. The invoice is created from a button off the opportunity page (code for that is done and testing at 94%).

 

Not sure what else to do !!

 

Any help is appreciated.  Thank you.

My faithful saviors,

I have tried a dozen different ways of doing the below mentioned by reading through the discussion boards for ideas.  It sounds SO simple, but its very frustrating.

 

I have one VF page.

I have two objects (one standard, one custom)

I want to display a tab panel on my VF page that shows a list on one tab from the standard object, and a list on the second tab from the custom object.

 

I have the list working great for the standard object.  No issues there.  But now I want to display the custom object list, and all I get are errors.  I understand that there is an issue with controllers here, but I am not able to get an effective and clear result from the 9,215 different suggested ways to configure my pages and classes.

 

It doesnt help that I suck at apex.

 

So ... here goes:

<apex:page showHeader="false" sidebar="false" standardController="Opportunity" tabStyle="Opportunity" extensions="getAllRecords">
                                                                  
                 <apex:pageBlock id="block1" mode="detail" rendered="true">
                    <apex:tabPanel selectedTab="MaintenanceRenewals" id="theTabPanel"  tabClass="activeTab" inactiveTabClass="inactiveTab"  width="100%">                    
                        <apex:tab label="Maintenance Renewals" name="MaintenanceRenewals" labelWidth="250px" >
                            <apex:pageBlockSection id="underFive" title="Within 5 Days or Past Due Maintenance Renewals" columns="1" collapsible="false"> 
                               <apex:PageBlockTable value="{!DuePastDue}" var="records" rowClasses="brightRed1,brightRed2"> 
                                    <apex:column value="{!records.CloseDate}" headerValue="Renewal Due By" width="16%"/>
                                    <apex:column headerValue="Manufacturer Name" width="20%">
                                        <apex:outputLink target="URLFOR('//006/e')" value="/{!records.Id}">{!records.Name}</apex:outputLink>
                                    </apex:column>
                                    <apex:column value="{!records.Contract_Owner__c}" headerValue="Contract Owner" width="16%"/>
                                    <apex:column value="{!records.StageName}" headerValue="Stage" width="16%"/>
                                    <apex:column value="{!records.Renewal_Status__c}" headerValue="Renewal Status" width="16%"/>
                                    <apex:column value="{!records.Amount}" headerValue="Renewal Amount" width="16%" />
                                </apex:pageBlockTable>                                 
                             <apex:form >
                                 <input type="button" value="Hide / Unhide Renewals" onClick="collapse('{!$Component.fiveThirty},{!$Component.thirtySixty},{!$Component.over60}');return false;">
                                 </input>
                             </apex:form>
                            </apex:pageBlockSection>                                                                  
                            <apex:pageBlockSection id="fiveThirty" title="5-30 Days Maintenance Renewals" columns="1" collapsible="false"> 
                               <apex:PageBlockTable value="{!FiveThirty}" var="records" rowClasses="red1,red2">
                                    <apex:column value="{!records.CloseDate}" headerValue="Renewal Due By" width="16%"/>
                                    <apex:column headerValue="Manufacturer Name" width="20%">
                                        <apex:outputLink target="URLFOR('//006/e')" value="/{!records.Id}">{!records.Name}</apex:outputLink>
                                    </apex:column>
                                    <apex:column value="{!records.Contract_Owner__c}" headerValue="Contract Owner" width="16%"/>
                                    <apex:column value="{!records.StageName}" headerValue="Stage" width="16%"/>
                                    <apex:column value="{!records.Renewal_Status__c}" headerValue="Renewal Status" width="16%"/>
                                    <apex:column value="{!records.Amount}" headerValue="Renewal Amount" width="16%" />
                                </apex:pageBlockTable>                                    
                            </apex:pageBlockSection>
                            <apex:pageBlockSection id="thirtySixty" title="31-60 Days Maintenance Renewals" columns="1" collapsible="false">
                               <apex:PageBlockTable value="{!ThirtySixty}" var="records" rowClasses="yellow1,yellow2">
                                   <apex:column value="{!records.CloseDate}" headerValue="Renewal Due By" width="16%"/>
                                    <apex:column headerValue="Manufacturer Name" width="20%">
                                        <apex:outputLink target="URLFOR('//006/e')" value="/{!records.Id}">{!records.Name}</apex:outputLink>
                                    </apex:column>
                                    <apex:column value="{!records.Contract_Owner__c}" headerValue="Contract Owner" width="16%"/>
                                    <apex:column value="{!records.StageName}" headerValue="Stage" width="16%"/>
                                    <apex:column value="{!records.Renewal_Status__c}" headerValue="Renewal Status" width="16%"/>
                                    <apex:column value="{!records.Amount}" headerValue="Renewal Amount" width="16%" />
                                </apex:pageBlockTable>
                            </apex:pageBlockSection>
                            <apex:pageBlockSection id="over60" title="61-120 Days Maintenance Renewals" columns="1" collapsible="false">
                                <apex:PageBlockTable value="{!OverSixty}" var="records" rowClasses="green1,green2">
                                   <apex:column value="{!records.CloseDate}" headerValue="Renewal Due By" width="16%"/>
                                    <apex:column headerValue="Manufacturer Name" width="20%">
                                        <apex:outputLink target="URLFOR('//006/e')" value="/{!records.Id}">{!records.Name}</apex:outputLink>
                                    </apex:column>
                                    <apex:column value="{!records.Contract_Owner__c}" headerValue="Contract Owner" width="16%"/>
                                    <apex:column value="{!records.StageName}" headerValue="Stage" width="16%"/>
                                    <apex:column value="{!records.Renewal_Status__c}" headerValue="Renewal Status" width="16%"/>
                                    <apex:column value="{!records.Amount}" headerValue="Renewal Amount" width="16%" />
                                </apex:pageBlockTable>
                            </apex:pageBlockSection>     
                        </apex:tab>
                        <apex:tab label="COMING SOON" name="scorecard" labelWidth="250px" >
                            <apex:pageBlockSection title="New things to come!" columns="1" collapsible="false">
                               
                            </apex:pageBlockSection>
                        </apex:tab>                        
                    </apex:tabPanel>
                  </apex:pageBlock>
                </div>
            </div>
        </div>
    </body>   
</html>
</apex:page>

 I removed all the javascript and css as it was not relevant and took up space.

public class getAllRecords {
    public getAllRecords(ApexPages.StandardController Controller) {
    }  
    //method to get all maint. renewals
    public Opportunity[] getRecordDetail(){
    //declare and instantiate recordList
    Opportunity[]recordList = new List<Opportunity>();
    //SOQL call to get all the records
        recordList = [SELECT Name,
                             Contract_Owner__c,
                             Amount,
                             CloseDate,
                             StageName,
                             Renewal_Status__c
                        FROM Opportunity
                       WHERE AccountId IN 
                            (SELECT AccountId 
                             From User 
                             WHERE username=:UserInfo.getUsername())
                         AND (Stagename = 'Baseline' OR Stagename = 'Review' OR Stagename = 'Execution' OR Stagename = 'Customer Input Required')
                       ORDER BY CloseDate];
       return recordList;
    }
    //method to strip out pastdue to 5 days from close_date
    public Opportunity[] getDuePastDue(){
    List<Opportunity> recordList = getRecordDetail();
    List<Opportunity> pastDueList = new List<Opportunity>();
        for(Opportunity obj:recordList) {
                if(obj.CloseDate < (system.today() +5)) {
                   pastDueList.add(obj);
                }    
        }
    return pastDueList;
    }
    //method to strip out 5-30 days from close_date
    public Opportunity[] getFiveThirty(){
    List<Opportunity> recordList = getRecordDetail();
    List<Opportunity> fiveThirtyList = new List<Opportunity>();
        for(Opportunity obj4:recordList) {
            if((obj4.CloseDate > (system.today() + 5)) && (obj4.CloseDate <= (system.today() + 30)))  {
                fiveThirtyList.add(obj4);
            }
        }
    return fiveThirtyList;
    }
    //method to strip out over 60 days from close date
    public Opportunity[] getOverSixty(){
        List<Opportunity> recordList = getRecordDetail();
        List<Opportunity> overSixtyList = new List<Opportunity>();
            for(Opportunity obj2:recordList) {
                if((obj2.CloseDate <= (system.today() + 120)) && (obj2.CloseDate > (system.today() + 60))){
                    overSixtyList.add(obj2);
                }
            }
    return overSixtyList;
    }    
    //method to strip out 30-60 days from close date
    public Opportunity[] getThirtySixty(){
    List<Opportunity> recordList = getRecordDetail();
    List<Opportunity> thirtySixtyList = new List<Opportunity>();
        for(Opportunity obj3:recordList) {
            if((obj3.CloseDate <= (system.today() + 60)) && (obj3.CloseDate > (system.today() + 30))) {
                thirtySixtyList.add(obj3);
            }
        }
    return thirtySixtyList;
    }  
}

 Now what I need to do us get the custom object list inserted into the "Coming Soon" section.

 

Could someone please give me a code sample to push me in the right direction?  Much appreciated!!

Right now I have a visualforce page that uses my opportunity for a standardController.  I am looking to add the funtionality of supplying my partner portal customers with the option of selecting an "opportunity" and printing/viewing a pdf file that is attatched to it.  I have scoured the force.com boards and googled some other places (stack overflow) for an idea on how to best approach this.  I have found some fine suggestions on returning a relatedList, and various things, but I am still not sure this is even possible.  Especially if the opportunity has multiple files attached to it that are not invoices.

 

Is it possible for a partner portal user to log in, view the VF page list of closed opportunities, select it as a hyperlink and view/print the pdf (even if its in a sep. window!) ??  As I have said, I have read quite a few board postings, but they are all in disagreement with one another!  Some say yes, some say no.  Most provide no arguments to support their statements.  Even the "Development with the Force.com Platform" book provided no thoughts (that I could find).

 

Here is a typical output:

Date                 Opportunity Name      Status      Invoiced    Invoice Number    Paid     

1/15/2012        Widgets                        Closed      Yes           123456                 

2/1/2012          Thingy's                        Open          Yes           456789

1/8/2012           Doo-dads                    Closed      Yes           740593                   Yes

 

What I want is for the user to click on the invoice number that is a link and they can view the invoice.

 

What say you all ?

 

Thanks!

 

 

 

I have cobbled together a Test Method (my first one!) by reading what I could from here and other places.  I have no idea why it isnt giving me higher code coverage, but I am guessing someone out there can help me!  With what I have listed below, I get only 2% coverage.  I highlighted the only purple line in my code coverage result, all the other lines are either comments or red.    

 

 

Here is my test code as is:

@isTest
private with sharing class TestgetAllRecords {               
    static testMethod void myTest(){
        List<Opportunity> oList = new List<Opportunity>{};
        test.startTest();  
                date testdate = date.parse('12/31/2020');
                Account testaccount = new Account();
                    testaccount.Name = 'test';
                    insert testaccount;
                Contact testcontact = new Contact();
                    testcontact.LastName = 'test';
                    testcontact.AccountId = testaccount.Id;
                    insert testcontact;
                Opportunity testrenewal =  new Opportunity();
                    testrenewal.accountid = testaccount.Id;
                    testrenewal.Amount = 100.00;
                    testrenewal.Closedate = testdate;
                    testrenewal.Description = 'test';
                    testrenewal.Name =  'test';
                    testrenewal.Stagename = 'Baseline';
                    testrenewal.Probability = 100;
                    testrenewal.OwnerId = UserInfo.getUserId();
                    testrenewal.Coverage_Start_Date__c = testdate;
                    testrenewal.Coverage_End_Date__c = testdate;
                    insert testrenewal;
                Asset_Information__c testasset = new Asset_Information__c();
                    testasset.Name = 'test';
                    testasset.Maintenance_Renewal__c = testrenewal.Id;
                    testasset.Coverage_Start_Date__c = testdate;
                    testasset.Coverage_End_Date__c = testdate;
                    insert testasset;
         oList = [SELECT Name, Contract_Owner__c, Amount, CloseDate FROM Opportunity WHERE Name = 'test'];
         test.stopTest();          
    ApexPages.StandardController sc1 = new ApexPages.StandardController(testrenewal);        
    getAllRecords controller1 = new getAllRecords(sc1);
    }
}

 

and here is my actual class:

public class getAllRecords {
    public getAllRecords(ApexPages.StandardController Controller) {
    }  
    //method to get all maint. renewals
    public Opportunity[] getRecordDetail(){
    //declare and instantiate recordList
    Opportunity[]recordList = new List<Opportunity>();
    //SOQL call to get all the records
        recordList = [SELECT Name,
                             Contract_Owner__c,
                             Amount,
                             CloseDate
                        FROM Opportunity
                       WHERE AccountId IN
                            (SELECT AccountId
                             From User
                             WHERE username=:UserInfo.getUsername())
                         AND (Stagename = 'Baseline' OR Stagename = 'Review' OR Stagename = 'Execution')
                       ORDER BY CloseDate];
       return recordList;
    }
    //method to strip out pastdue to 5 days from close_date
    public Opportunity[] getDuePastDue(){
    List<Opportunity> recordList = getRecordDetail();
    List<Opportunity> pastDueList = new List<Opportunity>();
        for(Opportunity obj:recordList) {
                if(obj.CloseDate < (system.today() +5)) {
                   obj.Name = obj.Name.toUpperCase();
                   if(obj.Contract_Owner__c != Null) {
                       obj.Contract_Owner__c = obj.Contract_Owner__c.toUpperCase();
                   }
                   pastDueList.add(obj);
                }    
        }
    return pastDueList;
    }
    //method to strip out 5-30 days from close_date
    public Opportunity[] getFiveThirty(){
    List<Opportunity> recordList = getRecordDetail();
    List<Opportunity> fiveThirtyList = new List<Opportunity>();
        for(Opportunity obj4:recordList) {
            if((obj4.CloseDate > (system.today() + 5)) && (obj4.CloseDate <= (system.today() + 30)))  {
                fiveThirtyList.add(obj4);
            }
        }
    return fiveThirtyList;
    }
    //method to strip out over 60 days from close date
    public Opportunity[] getOverSixty(){
        List<Opportunity> recordList = getRecordDetail();
        List<Opportunity> overSixtyList = new List<Opportunity>();
            for(Opportunity obj2:recordList) {
                if(obj2.CloseDate > (system.today() + 60)) {
                    overSixtyList.add(obj2);
                }
            }
    return overSixtyList;
    }    
    //method to strip out 30-60 days from close date
    public Opportunity[] getThirtySixty(){
    List<Opportunity> recordList = getRecordDetail();
    List<Opportunity> thirtySixtyList = new List<Opportunity>();
        for(Opportunity obj3:recordList) {
            if((obj3.CloseDate <= (system.today() + 60)) && (obj3.CloseDate > (system.today() + 30))) {
                thirtySixtyList.add(obj3);
            }
        }
    return thirtySixtyList;
    }
    // get a company logo: based on user log in, strip spaces, return image name
    public String getImageName(){     
       String file = [SELECT Name
                        FROM Account
                       WHERE Id IN
                            (SELECT AccountId
                               FROM user
                              WHERE username=:UserInfo.getUsername()
                             )
                       LIMIT 1
                     ].Name;
       file = file.replace(' ', '');  
       String foldername = 'Logos/';
       String extension = '.jpg';
       String fullImageName = foldername + file + extension;
       return fullImageName;
    }  
}

 

 

 

Thank you!!!

I am trying to get the content of a variable and display it on a visualforce page in an effort to track where I am going wrong.  Something similar to Visual Basics MessageBox.Show(variable) or a javascripts alert(variable); function.

 

I need to make sure that what I "think" is inside my variable is actually there.  I am sure this is a simple thing, but I cant find the answer!

 

Thanks!

 

 

Hello one and all,


I have a Visualforce page that I created as the landing page in my Partner Portal.  I have populated the page with selected Opportunities based on the current logged in users id.  All is working great there.  I want to make the Opportunities links that open up the actual Opportunity, but not inside the Home page (wow that looks goofy!) ...  I want it to open the Opportunity tab and display the record there.

 

Here is my sample code:

 

<apex:PageBlockTable value="{!ZeroThirty}" var="records" rowClasses="red1,red2">
       <apex:column headerValue="Manufacturer Name">
             <apex:outputLink value="/{!records.Id}">{!records.Name}</apex:outputLink>
       </apex:column>
       <apex:column value="{!records.Contract_Owner__c}" headerValue="Contract Owner" />
       <apex:column value="{!records.Amount}" headerValue="Amount" />
       <apex:column value="{!records.CloseDate}" headerValue="Renwal Due By" />
</apex:pageBlockTable>

 

The way it is now, it opens up the opportunity record INSIDE the home page.  I can open 5 different ones and they just keep layering on top of one another.  How do I redirect them to the Opportunity tab passing in the ID of the record?

 

As always -->  Thanks in advance

 

Hello All!

 

2 parts to this question, then I will add code.

 

I have an Apex Class that calls information from my Opportunity record and displays it on my VisualForce page.  The data is then sorted into three categories on my page.  All is working well there.  But there are still 2 things I want to do.

 

1. I want to make the results clickable to take them to their appropriate opportunity record.

2. I want to add an image onto their Partner Portal page on login, based on their company Name.

   ----> I have stored the jpg's in to a zipped static resource folder called "Logos" and I have named each one identical to the name of the Portal login user   ------>Company name (for example, Charlie Brown logs in, he is from Brown Ltd, and his logo image is called "Brown Ltd.jpg"

 

I know I have a lot of oddball things in the code, but, I am new at this.  For example, my script twist thingy doesnt work.  No idea why.  For somereason, my pageBlockSections dont expand or collapse.  Its werid.  Any help would be .... helpful ...  I would like to point out an error, but I do not get any errors.  I simply do not get the image.  Thank you!!

 

VF PAGE:

<apex:page showHeader="false" sidebar="false" standardController="Opportunity" tabStyle="Opportunity" extensions="getAllRecords">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <body>   
                    <h5>
                       <p>Welcome Back {!$User.FirstName & ' ' & $User.LastName}!<br />
                          Todays Date: {!MONTH(TODAY())}/{!DAY(TODAY())}/{!YEAR(TODAY())}
                       </p>
                    </h5>
      
            <!-- ----------------------------------------- -->
            <!-- ---- INSERT THEIR LOGO ----- -->
            <!-- ----------------------------------------- -->  
                    <div id="displayDiv">Logo Image/Picture Loading...<br />(Want to see your logo displayed here?  Contact support for details)
                        <apex:variable var="imageVar" value="{!ImageName}"/>
                        <apex:image url="{!URLFOR($Resource.Logos, imageVar)}"/>
                    </div>
                 <apex:pageBlock id="block1">
                    <script>
                        twistSection(document.getElementById('{!$Component.block1.zero30}').getElementsByTagName('img')[0])                       
                    </script>
                    <apex:tabPanel selectedTab="MaintenanceRenewals" id="theTabPanel"  tabClass="activeTab" inactiveTabClass="inactiveTab"  width="100%">
                        <apex:tab label="Maintenance Renewals" name="MaintenanceRenewals" labelWidth="250px" >                                      
                            <apex:pageBlockSection id="zero30" title="0-30 Days Maintenance Renewals" columns="1">
                                <apex:PageBlockTable value="{!ZeroThirty}" var="records" rowClasses="red1,red2">
                                    <apex:column value="{!records.Name}" headerValue="Manufacturer Name" />
                                    <apex:column value="{!records.Contract_Owner__c}" headerValue="Contract Owner" />
                                    <apex:column value="{!records.Amount}" headerValue="Amount" />
                                    <apex:column value="{!records.CloseDate}" headerValue="Renwal Due By" />
                                </apex:pageBlockTable>      
                            </apex:pageBlockSection>
                            <apex:pageBlockSection title="31-60 Days Maintenance Renewals" columns="1">
                               <apex:PageBlockTable value="{!ThirtySixty}" var="records" rowClasses="yellow1,yellow2">
                                    <apex:column value="{!records.Name}" headerValue="Manufacturer Name" />
                                    <apex:column value="{!records.Contract_Owner__c}" headerValue="Contract Owner" />
                                    <apex:column value="{!records.Amount}" headerValue="Amount" />
                                    <apex:column value="{!records.CloseDate}" headerValue="Renwal Due By" />
                                </apex:pageBlockTable>
                            </apex:pageBlockSection>
                            <apex:pageBlockSection title="61 Days (or more) Maintenance Renewals" columns="1">
                                <apex:PageBlockTable value="{!OverSixty}" var="records" rowClasses="green1,green2">
                                    <apex:column value="{!records.Name}" headerValue="Manufacturer Name" />
                                    <apex:column value="{!records.Contract_Owner__c}" headerValue="Contract Owner" />
                                    <apex:column value="{!records.Amount}" headerValue=" Amount" />
                                    <apex:column value="{!records.CloseDate}" headerValue="Renwal Due By" />
                                </apex:pageBlockTable>
                            </apex:pageBlockSection>     
                        </apex:tab>
                    </apex:tabPanel>
                  </apex:pageBlock>
    </body>   
</html>
</apex:page>

APEX CLASS:

public class getAllRecords {
    public getAllRecords(ApexPages.StandardController Controller) {
    } 
    public Opportunity[] getRecordDetail(){
    Opportunity[]recordList = new List<Opportunity>();
        recordList = [SELECT Name,
                             Contract_Owner__c,
                             Amount,
                             CloseDate
                        FROM Opportunity
                       WHERE AccountId IN 
                            (SELECT AccountId 
                             FROM User 
                             WHERE username=:UserInfo.getUsername())
                        ORDER BY CloseDate];
       return recordList;
    }
    public Opportunity[] getZeroThirty(){
    List<Opportunity> recordList = getRecordDetail();
    List<Opportunity> zeroThirtyList = new List<Opportunity>();
        for(Opportunity obj:recordList) {
            if(obj.CloseDate < (system.today() + 30)) {
                zeroThirtyList.add(obj);
            }
        }
    return zeroThirtyList;
    }
    public Opportunity[] getOverSixty(){
        List<Opportunity> recordList = getRecordDetail();
        List<Opportunity> overSixtyList = new List<Opportunity>();
            for(Opportunity obj2:recordList) {
                if(obj2.CloseDate > (system.today() + 60)) {
                    overSixtyList.add(obj2);
                }
            }
    return overSixtyList;
    }
    public Opportunity[] getThirtySixty(){
    List<Opportunity> recordList = getRecordDetail();
    List<Opportunity> thirtySixtyList = new List<Opportunity>();
        for(Opportunity obj3:recordList) {
            if((obj3.CloseDate < (system.today() + 60)) && (obj3.CloseDate > (system.today() + 30))) {
                thirtySixtyList.add(obj3);
            }
        }
    return thirtySixtyList;
    }
    public String getImageName() {
        Opportunity fileName = new Opportunity();
            fileName = [SELECT Name FROM Opportunity WHERE AccountId IN (SELECT AccountId From User WHERE username=:UserInfo.getUsername())];
            string image = '';
            image = fileName + '.jpg';
        return image;
        }

I have started working with a clip of code from a different post to work in an image to a visual force page that is based on the credentials of the current user.

 

I have stored the image in the "Notes and Attachements" section of the contact object, the title of the file is "Contact.jpg" ...

Here is the javascript &colon;

 

 

<script src="/soap/ajax/15.0/connection.js"  type="text/javascript">
        function doit() {
            var ids = sforce.connection.query("SELECT id FROM Attachment WHERE ParentId = '{!Contact.Id}' AND Name='Contact.jpg' limit 1");
            if(ids == NULL) {   
                document.getElementById('displayDiv').innerHTML = '<br />No Image Found.<br />';
            } else {
                var srv = ("{!Scontrol.URL}".split(/salesforce.com/))[0] + 'salesforce.com/services/SRedirect?u=';
                var url = '/servlet/servlet.FileDownload?file=' + ids.records.Id + '&retURL=/' + '{!Contact.Id}';
                document.getElementById('displayDiv').innerHTML = '<img src=' + srv + url + ' alt="Unable to Display Picture/>';
            }    
        }

 

 

Here is my call :

   <body onload="doit()">

 

Here is my error:

ERROR: index line 10, column 92 The reference to entity “retURL” must end with the ‘;’ delimiter

ERROR: The reference to entity “retURL” must end with the ‘;’ delimiter

 

(LINE 10 =)

                var url = '/servlet/servlet.FileDownload?file=' + ids.records.Id + '&retURL=/' + '{!Contact.Id}';

 

I think the error lies in the URL itself that I am trying to assemble, but I have gone around this issue so much today, I think my eyeballs are going to fall out soon.   Can anyone spot the error and help me out?  Thank you!!!

 


First, thank you all for your help.  I am learning quite quickly.  But now:

 

On to the next hurdle:

   My recordList returns four values to my apex page.  I need to split the recordList into three parts based on the Close_Date__c field.

  I then need to return the new list (or 3 new lists?) to my VF page based on the date sort.

 

So, if the "Close_Date__c" is less than 30 days from today, it goes in one section of the VF page.  If it is over 60 days, it goes in another, and anything that is between 30 and 60 goes to the third section. 

 

My question is this:  how / where do I sort the list, and how do I return it to the VF page?

 

 

My Apex Class:

public class getAllRecords {

    public getAllRecords(ApexPages.StandardController Controller) {
    }
    
    public Opportunity__c[]getRecordDetail(){
        Opportunity__c[]recordList;
        recordList = [SELECT Opportunity_Name__c,
                                                Owner__c,
                                                Amount__c,
                                               Close_Date__c
                               FROM Opportunity__c
                               WHERE Account__c IN
                                      (SELECT AccountId
                                       FROM User
                                       WHERE username=:UserInfo.getUsername())
                               ORDER BY Close_Date__c];
        return recordList;
    }
}

 

my current setup in VF is like this(I have three identical, but only put in one to keep it short):

 

                          <apex:pageBlockSection id="zero30" title="0-30 Days" columns="1">
                                <apex:PageBlockTable value="{!RecordDetail}" var="records" rowClasses="red1,red2">
                                    <apex:column value="{!records.Opportunity_Name__c}" headerValue="Name" />
                                    <apex:column value="{!records.Owner__c}" headerValue="Owner" />
                                    <apex:column value="{!records.Amount__c}" headerValue="Amount" />
                                    <apex:column value="{!records.Close_Date__c}" headerValue="Due By" />
                                </apex:pageBlockTable>      
                            </apex:pageBlockSection>

 

Thanks again in advance.

This is getting pretty thick on my end.  But here goes:

 I have an org that allows multiple partner portal users.  Some are executive level, some are manager level.  I want to allow the visual force page to display opportunity records based on the user log in.  I cannot figure out how to connect them in my SOQL statement.   I have pasted in the applicable code, and when I run it on my end (with some fiddling, I can get the records to display based on the user ID, BUT, if a different user from the same company logs in, they cannot see the records that they should be able to since the Owner ID is tied to someone else.

How do i connect them?  Is there some field I can add to an opportunity to make it easier (well, not easier, then i would have to change ALL my opportunity records).

 

Visualforce Page:VF PAGE:
<apex:pageBlock >
    <apex:tabPanel id="theTabPanel" tabClass="activeTab" inactiveTabClass="inactiveTab" switchType="server" width="100%">
        <apex:tab label="Opportunity" labelWidth="250px" >                                      
            <apex:pageBlockSection id="zero30" title="0-30 Days Opportunity" columns="1">
                <apex:PageBlockTable value="{!RecordDetail}" var="records" rowClasses="red1,red2">
                    <apex:column value="{!records.Opportunity_Name}" headerValue="Opportunity Name" />
                    <apex:column value="{!records.Opportunity_Owner}" headerValue="Opportunity Owner" />
                    <apex:column value="{!records.Amount}" headerValue="Amount" />
                    <apex:column value="{!records.Close_Date}" headerValue="Close Date Due By" />
                </apex:pageBlockTable>      
            </apex:pageBlockSection>
            <apex:pageBlockSection title="31-60 Days Opportunity" columns="1">
               <apex:PageBlockTable value="{!RecordDetail}" var="records" rowClasses="yellow1,yellow2">
                    <apex:column value="{!records.Opportunity_Name}" headerValue="Opportunity Name" />
                    <apex:column value="{!records.Opportunity_Owner}" headerValue="Opportunity Owner" />
                    <apex:column value="{!records.Amount}" headerValue="Amount" />
                    <apex:column value="{!records.Close_Date}" headerValue="Close Date Due By" />
                </apex:pageBlockTable>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="61 Days (or more) Opportunity" columns="1">
                <apex:PageBlockTable value="{!RecordDetail}" var="records" rowClasses="green1,green2">
                    <apex:column value="{!records.Opportunity_Name}" headerValue="Opportunity Name" />
                    <apex:column value="{!records.Opportunity_Owner}" headerValue="Opportunity Owner" />
                    <apex:column value="{!records.Amount}" headerValue="Amount" />
                    <apex:column value="{!records.Close_Date}" headerValue="Close Date Due By" />
                </apex:pageBlockTable>
            </apex:pageBlockSection>     
        </apex:tab>
    </apex:tabPanel>
</apex:pageBlock>

CLASS:
public class getAllRecords {
    public getAllRecords(ApexPages.StandardController Controller) {
    }   
    public Opportunity[]getRecordDetail(){
        Opportunity[]recordList;
        recordList = [SELECT Opportunity.Opportunity_Name,
                             Opportunity.Opportunity_Owner,
                             Opportunity.Amount,
                             Opportunity.Close_Date
                        FROM Opportunity
                       WHERE OwnerId= :UserInfo.getUserID()];
        return recordList;
    }
}

 

 

 

 

 

Thank you in advance for looking and helping.

In my apex class, I am selecting a list of records to be returned to a visualforce page.

 

The question I have is:  how do I limit the records (WHERE clause) to only be returned IF they are assigned to the logged in user?

 

I.E.  "Jack" logs into partner portal, how do I return only his records?

 

Thanks!

I am trying to pull data from four custom fields on my custom object to display them in my visual force page.  I have only been using salesforce for a few days, and I am completely stuck.

 

I have custom object: Book

with custom fields: Book Title, Author Name, Book Cost, Book Genre

 

I want to loop through each record on my custom object and display them on my visual force page in my partner portal.  I have an Apex class:

 

public class getAllBooks {
    public getAllBooks(ApexPages.StandardController Controller) {
    }
    public Books__c[]getBookDetail(){
        Book__c[]bookList;
        bookList = [SELECT Books__c.Book_Title__c,
                             Book__c.Author_Name__c,
                             Book__c.Book_Cost__c,
                             Book__c.Book_Genre__c
                        FROM Book__c];
        return bookList;
    }
}

and my VF page:

<apex:page standardController="Books__c" extensions="getAllBooks"

    <apex:form>
        <apex:pageBlock>
            <apex:PageBlockTable value="{!getAllBooks}" var="book">
                <apex:column value="{!book.Book_Title__c}" headerValue="Book Title" />
                <apex:column value="{!book.Author_Name__c}" headerValue="Author Name" />
                <apex:column value="{!book.Book_Cost__c}" headerValue="Book Cost" />
                <apex:column value="{!book.Book_Genre__c}" headerValue="Book Genre" />
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>

</apex:page>

 

Error: Unknown property 'Book_cStandardController.getAllBooks'

 

I have no idea what to try next. 

Any suggestions would be helpful.  Laymens terms are also helpful, as I am not the sharpest Apex/Visualforce programmer around!

Thanks in advance.

  

Hi I am a newbie and need some help with a workflow.  Hopefully I will explain it well enought.  I have an Object (order line) that has several lines (products) listed in it.
I setup a workflow for to check for a false value in a field (Ship) Obect:(Order Line).  If false make update object:(order) field (DS2) = true.  The rule works well as long as all the lines (products)  have the same data, but if one of the products is true and one is false then it marks the (Order)(DS2)true.  Is there anyway in a workflow to tell it that everything in the Object (Order Line) must equal true for it to update Order DS2.
Please let me know if this isn't clear. Thanks for any help.

  • October 17, 2012
  • Like
  • 0

Hi,

 

 

I have created one partner portal and added Partner Portal Lead Inbox Component to the home page layout but I am not able to see any leads in the related list. Is there any setting I am missing?

 

Can anyone tell how to add or assign leads into 'Partner Portal Lead Inbox'?

 

 

Thanks. 

Quick question:

 

I have a SOQL call in my apex class that returns all the opportunity records from a logged in user and displays them on a VF page.  I just figured out that there are some users that have Sharing rules (manual sharing) that connects two different accounts and the records from both accounts are not displaying (despite 'public with sharing' being used in the definition of my class) .

 

IE...

Bob Smith logs in

Bob is with Company ABC

Bob also has access to Opportunity records from Company MNO and XYZ.

In Bobs Opportunity tab, he can see all the records from the three different companies, but he can only see the records from his ABC company displayed on the Visual force page. 

 

Is there something simple that I am missing?  Is there a typical line of apex code that connects the SOQL call to all shared accounts?  I had originally  thought that "WITH SHARING" automatically caused the users login rules to apply to the apex class and all its methods.

 

Thoughts?

Thanks!

I have a test class that I am writing, and I need to insert a record.  The records custom object has two master-detail relationships.

Custom Object = Invoice__c

Standard = Opportunity

Standard = Account

 

My insert statement is as such:

Invoice__c invoice = new Invoice__c(T_Invoice__c = '1234', Date_of_Purchase_Order_Authorization__c = testdate, Payment_Due_Date__c = testdate, Payment_Received_Date__c = testdate, Aging__c = 0, Your_Purchase_Order__c = '1234', Account_Name__c = testrenewal.accountId, Amount_w_o_Tax__c = 100.00, Amount__c = 100.00, MR_Opportunity__c = ???, Account_Id__c = ???);

When I try to add logic to get the "id" from the opportunity record, I dont seem to get any errors, but the account "id" keeps throwing errors at me like:

Missing required field (if I remove account_id__c)

Insufficient access on cross reference entity (if I try to grab the id from a test opportunity that I insert before this invoice)

Insufficient access on cross reference entity(if I try to grab the id from a test account that I insert before this invoice)

 

 

The idea is that I am creating an invoice from an opportunity, but it must have the Account Name and Opportunity Name on the invoice. The invoice is created from a button off the opportunity page (code for that is done and testing at 94%).

 

Not sure what else to do !!

 

Any help is appreciated.  Thank you.

Right now I have a visualforce page that uses my opportunity for a standardController.  I am looking to add the funtionality of supplying my partner portal customers with the option of selecting an "opportunity" and printing/viewing a pdf file that is attatched to it.  I have scoured the force.com boards and googled some other places (stack overflow) for an idea on how to best approach this.  I have found some fine suggestions on returning a relatedList, and various things, but I am still not sure this is even possible.  Especially if the opportunity has multiple files attached to it that are not invoices.

 

Is it possible for a partner portal user to log in, view the VF page list of closed opportunities, select it as a hyperlink and view/print the pdf (even if its in a sep. window!) ??  As I have said, I have read quite a few board postings, but they are all in disagreement with one another!  Some say yes, some say no.  Most provide no arguments to support their statements.  Even the "Development with the Force.com Platform" book provided no thoughts (that I could find).

 

Here is a typical output:

Date                 Opportunity Name      Status      Invoiced    Invoice Number    Paid     

1/15/2012        Widgets                        Closed      Yes           123456                 

2/1/2012          Thingy's                        Open          Yes           456789

1/8/2012           Doo-dads                    Closed      Yes           740593                   Yes

 

What I want is for the user to click on the invoice number that is a link and they can view the invoice.

 

What say you all ?

 

Thanks!

 

 

 

I have cobbled together a Test Method (my first one!) by reading what I could from here and other places.  I have no idea why it isnt giving me higher code coverage, but I am guessing someone out there can help me!  With what I have listed below, I get only 2% coverage.  I highlighted the only purple line in my code coverage result, all the other lines are either comments or red.    

 

 

Here is my test code as is:

@isTest
private with sharing class TestgetAllRecords {               
    static testMethod void myTest(){
        List<Opportunity> oList = new List<Opportunity>{};
        test.startTest();  
                date testdate = date.parse('12/31/2020');
                Account testaccount = new Account();
                    testaccount.Name = 'test';
                    insert testaccount;
                Contact testcontact = new Contact();
                    testcontact.LastName = 'test';
                    testcontact.AccountId = testaccount.Id;
                    insert testcontact;
                Opportunity testrenewal =  new Opportunity();
                    testrenewal.accountid = testaccount.Id;
                    testrenewal.Amount = 100.00;
                    testrenewal.Closedate = testdate;
                    testrenewal.Description = 'test';
                    testrenewal.Name =  'test';
                    testrenewal.Stagename = 'Baseline';
                    testrenewal.Probability = 100;
                    testrenewal.OwnerId = UserInfo.getUserId();
                    testrenewal.Coverage_Start_Date__c = testdate;
                    testrenewal.Coverage_End_Date__c = testdate;
                    insert testrenewal;
                Asset_Information__c testasset = new Asset_Information__c();
                    testasset.Name = 'test';
                    testasset.Maintenance_Renewal__c = testrenewal.Id;
                    testasset.Coverage_Start_Date__c = testdate;
                    testasset.Coverage_End_Date__c = testdate;
                    insert testasset;
         oList = [SELECT Name, Contract_Owner__c, Amount, CloseDate FROM Opportunity WHERE Name = 'test'];
         test.stopTest();          
    ApexPages.StandardController sc1 = new ApexPages.StandardController(testrenewal);        
    getAllRecords controller1 = new getAllRecords(sc1);
    }
}

 

and here is my actual class:

public class getAllRecords {
    public getAllRecords(ApexPages.StandardController Controller) {
    }  
    //method to get all maint. renewals
    public Opportunity[] getRecordDetail(){
    //declare and instantiate recordList
    Opportunity[]recordList = new List<Opportunity>();
    //SOQL call to get all the records
        recordList = [SELECT Name,
                             Contract_Owner__c,
                             Amount,
                             CloseDate
                        FROM Opportunity
                       WHERE AccountId IN
                            (SELECT AccountId
                             From User
                             WHERE username=:UserInfo.getUsername())
                         AND (Stagename = 'Baseline' OR Stagename = 'Review' OR Stagename = 'Execution')
                       ORDER BY CloseDate];
       return recordList;
    }
    //method to strip out pastdue to 5 days from close_date
    public Opportunity[] getDuePastDue(){
    List<Opportunity> recordList = getRecordDetail();
    List<Opportunity> pastDueList = new List<Opportunity>();
        for(Opportunity obj:recordList) {
                if(obj.CloseDate < (system.today() +5)) {
                   obj.Name = obj.Name.toUpperCase();
                   if(obj.Contract_Owner__c != Null) {
                       obj.Contract_Owner__c = obj.Contract_Owner__c.toUpperCase();
                   }
                   pastDueList.add(obj);
                }    
        }
    return pastDueList;
    }
    //method to strip out 5-30 days from close_date
    public Opportunity[] getFiveThirty(){
    List<Opportunity> recordList = getRecordDetail();
    List<Opportunity> fiveThirtyList = new List<Opportunity>();
        for(Opportunity obj4:recordList) {
            if((obj4.CloseDate > (system.today() + 5)) && (obj4.CloseDate <= (system.today() + 30)))  {
                fiveThirtyList.add(obj4);
            }
        }
    return fiveThirtyList;
    }
    //method to strip out over 60 days from close date
    public Opportunity[] getOverSixty(){
        List<Opportunity> recordList = getRecordDetail();
        List<Opportunity> overSixtyList = new List<Opportunity>();
            for(Opportunity obj2:recordList) {
                if(obj2.CloseDate > (system.today() + 60)) {
                    overSixtyList.add(obj2);
                }
            }
    return overSixtyList;
    }    
    //method to strip out 30-60 days from close date
    public Opportunity[] getThirtySixty(){
    List<Opportunity> recordList = getRecordDetail();
    List<Opportunity> thirtySixtyList = new List<Opportunity>();
        for(Opportunity obj3:recordList) {
            if((obj3.CloseDate <= (system.today() + 60)) && (obj3.CloseDate > (system.today() + 30))) {
                thirtySixtyList.add(obj3);
            }
        }
    return thirtySixtyList;
    }
    // get a company logo: based on user log in, strip spaces, return image name
    public String getImageName(){     
       String file = [SELECT Name
                        FROM Account
                       WHERE Id IN
                            (SELECT AccountId
                               FROM user
                              WHERE username=:UserInfo.getUsername()
                             )
                       LIMIT 1
                     ].Name;
       file = file.replace(' ', '');  
       String foldername = 'Logos/';
       String extension = '.jpg';
       String fullImageName = foldername + file + extension;
       return fullImageName;
    }  
}

 

 

 

Thank you!!!

I am trying to get the content of a variable and display it on a visualforce page in an effort to track where I am going wrong.  Something similar to Visual Basics MessageBox.Show(variable) or a javascripts alert(variable); function.

 

I need to make sure that what I "think" is inside my variable is actually there.  I am sure this is a simple thing, but I cant find the answer!

 

Thanks!

 

 

Hello one and all,


I have a Visualforce page that I created as the landing page in my Partner Portal.  I have populated the page with selected Opportunities based on the current logged in users id.  All is working great there.  I want to make the Opportunities links that open up the actual Opportunity, but not inside the Home page (wow that looks goofy!) ...  I want it to open the Opportunity tab and display the record there.

 

Here is my sample code:

 

<apex:PageBlockTable value="{!ZeroThirty}" var="records" rowClasses="red1,red2">
       <apex:column headerValue="Manufacturer Name">
             <apex:outputLink value="/{!records.Id}">{!records.Name}</apex:outputLink>
       </apex:column>
       <apex:column value="{!records.Contract_Owner__c}" headerValue="Contract Owner" />
       <apex:column value="{!records.Amount}" headerValue="Amount" />
       <apex:column value="{!records.CloseDate}" headerValue="Renwal Due By" />
</apex:pageBlockTable>

 

The way it is now, it opens up the opportunity record INSIDE the home page.  I can open 5 different ones and they just keep layering on top of one another.  How do I redirect them to the Opportunity tab passing in the ID of the record?

 

As always -->  Thanks in advance

 

Hello All!

 

2 parts to this question, then I will add code.

 

I have an Apex Class that calls information from my Opportunity record and displays it on my VisualForce page.  The data is then sorted into three categories on my page.  All is working well there.  But there are still 2 things I want to do.

 

1. I want to make the results clickable to take them to their appropriate opportunity record.

2. I want to add an image onto their Partner Portal page on login, based on their company Name.

   ----> I have stored the jpg's in to a zipped static resource folder called "Logos" and I have named each one identical to the name of the Portal login user   ------>Company name (for example, Charlie Brown logs in, he is from Brown Ltd, and his logo image is called "Brown Ltd.jpg"

 

I know I have a lot of oddball things in the code, but, I am new at this.  For example, my script twist thingy doesnt work.  No idea why.  For somereason, my pageBlockSections dont expand or collapse.  Its werid.  Any help would be .... helpful ...  I would like to point out an error, but I do not get any errors.  I simply do not get the image.  Thank you!!

 

VF PAGE:

<apex:page showHeader="false" sidebar="false" standardController="Opportunity" tabStyle="Opportunity" extensions="getAllRecords">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <body>   
                    <h5>
                       <p>Welcome Back {!$User.FirstName & ' ' & $User.LastName}!<br />
                          Todays Date: {!MONTH(TODAY())}/{!DAY(TODAY())}/{!YEAR(TODAY())}
                       </p>
                    </h5>
      
            <!-- ----------------------------------------- -->
            <!-- ---- INSERT THEIR LOGO ----- -->
            <!-- ----------------------------------------- -->  
                    <div id="displayDiv">Logo Image/Picture Loading...<br />(Want to see your logo displayed here?  Contact support for details)
                        <apex:variable var="imageVar" value="{!ImageName}"/>
                        <apex:image url="{!URLFOR($Resource.Logos, imageVar)}"/>
                    </div>
                 <apex:pageBlock id="block1">
                    <script>
                        twistSection(document.getElementById('{!$Component.block1.zero30}').getElementsByTagName('img')[0])                       
                    </script>
                    <apex:tabPanel selectedTab="MaintenanceRenewals" id="theTabPanel"  tabClass="activeTab" inactiveTabClass="inactiveTab"  width="100%">
                        <apex:tab label="Maintenance Renewals" name="MaintenanceRenewals" labelWidth="250px" >                                      
                            <apex:pageBlockSection id="zero30" title="0-30 Days Maintenance Renewals" columns="1">
                                <apex:PageBlockTable value="{!ZeroThirty}" var="records" rowClasses="red1,red2">
                                    <apex:column value="{!records.Name}" headerValue="Manufacturer Name" />
                                    <apex:column value="{!records.Contract_Owner__c}" headerValue="Contract Owner" />
                                    <apex:column value="{!records.Amount}" headerValue="Amount" />
                                    <apex:column value="{!records.CloseDate}" headerValue="Renwal Due By" />
                                </apex:pageBlockTable>      
                            </apex:pageBlockSection>
                            <apex:pageBlockSection title="31-60 Days Maintenance Renewals" columns="1">
                               <apex:PageBlockTable value="{!ThirtySixty}" var="records" rowClasses="yellow1,yellow2">
                                    <apex:column value="{!records.Name}" headerValue="Manufacturer Name" />
                                    <apex:column value="{!records.Contract_Owner__c}" headerValue="Contract Owner" />
                                    <apex:column value="{!records.Amount}" headerValue="Amount" />
                                    <apex:column value="{!records.CloseDate}" headerValue="Renwal Due By" />
                                </apex:pageBlockTable>
                            </apex:pageBlockSection>
                            <apex:pageBlockSection title="61 Days (or more) Maintenance Renewals" columns="1">
                                <apex:PageBlockTable value="{!OverSixty}" var="records" rowClasses="green1,green2">
                                    <apex:column value="{!records.Name}" headerValue="Manufacturer Name" />
                                    <apex:column value="{!records.Contract_Owner__c}" headerValue="Contract Owner" />
                                    <apex:column value="{!records.Amount}" headerValue=" Amount" />
                                    <apex:column value="{!records.CloseDate}" headerValue="Renwal Due By" />
                                </apex:pageBlockTable>
                            </apex:pageBlockSection>     
                        </apex:tab>
                    </apex:tabPanel>
                  </apex:pageBlock>
    </body>   
</html>
</apex:page>

APEX CLASS:

public class getAllRecords {
    public getAllRecords(ApexPages.StandardController Controller) {
    } 
    public Opportunity[] getRecordDetail(){
    Opportunity[]recordList = new List<Opportunity>();
        recordList = [SELECT Name,
                             Contract_Owner__c,
                             Amount,
                             CloseDate
                        FROM Opportunity
                       WHERE AccountId IN 
                            (SELECT AccountId 
                             FROM User 
                             WHERE username=:UserInfo.getUsername())
                        ORDER BY CloseDate];
       return recordList;
    }
    public Opportunity[] getZeroThirty(){
    List<Opportunity> recordList = getRecordDetail();
    List<Opportunity> zeroThirtyList = new List<Opportunity>();
        for(Opportunity obj:recordList) {
            if(obj.CloseDate < (system.today() + 30)) {
                zeroThirtyList.add(obj);
            }
        }
    return zeroThirtyList;
    }
    public Opportunity[] getOverSixty(){
        List<Opportunity> recordList = getRecordDetail();
        List<Opportunity> overSixtyList = new List<Opportunity>();
            for(Opportunity obj2:recordList) {
                if(obj2.CloseDate > (system.today() + 60)) {
                    overSixtyList.add(obj2);
                }
            }
    return overSixtyList;
    }
    public Opportunity[] getThirtySixty(){
    List<Opportunity> recordList = getRecordDetail();
    List<Opportunity> thirtySixtyList = new List<Opportunity>();
        for(Opportunity obj3:recordList) {
            if((obj3.CloseDate < (system.today() + 60)) && (obj3.CloseDate > (system.today() + 30))) {
                thirtySixtyList.add(obj3);
            }
        }
    return thirtySixtyList;
    }
    public String getImageName() {
        Opportunity fileName = new Opportunity();
            fileName = [SELECT Name FROM Opportunity WHERE AccountId IN (SELECT AccountId From User WHERE username=:UserInfo.getUsername())];
            string image = '';
            image = fileName + '.jpg';
        return image;
        }

I have started working with a clip of code from a different post to work in an image to a visual force page that is based on the credentials of the current user.

 

I have stored the image in the "Notes and Attachements" section of the contact object, the title of the file is "Contact.jpg" ...

Here is the javascript &colon;

 

 

<script src="/soap/ajax/15.0/connection.js"  type="text/javascript">
        function doit() {
            var ids = sforce.connection.query("SELECT id FROM Attachment WHERE ParentId = '{!Contact.Id}' AND Name='Contact.jpg' limit 1");
            if(ids == NULL) {   
                document.getElementById('displayDiv').innerHTML = '<br />No Image Found.<br />';
            } else {
                var srv = ("{!Scontrol.URL}".split(/salesforce.com/))[0] + 'salesforce.com/services/SRedirect?u=';
                var url = '/servlet/servlet.FileDownload?file=' + ids.records.Id + '&retURL=/' + '{!Contact.Id}';
                document.getElementById('displayDiv').innerHTML = '<img src=' + srv + url + ' alt="Unable to Display Picture/>';
            }    
        }

 

 

Here is my call :

   <body onload="doit()">

 

Here is my error:

ERROR: index line 10, column 92 The reference to entity “retURL” must end with the ‘;’ delimiter

ERROR: The reference to entity “retURL” must end with the ‘;’ delimiter

 

(LINE 10 =)

                var url = '/servlet/servlet.FileDownload?file=' + ids.records.Id + '&retURL=/' + '{!Contact.Id}';

 

I think the error lies in the URL itself that I am trying to assemble, but I have gone around this issue so much today, I think my eyeballs are going to fall out soon.   Can anyone spot the error and help me out?  Thank you!!!

 


First, thank you all for your help.  I am learning quite quickly.  But now:

 

On to the next hurdle:

   My recordList returns four values to my apex page.  I need to split the recordList into three parts based on the Close_Date__c field.

  I then need to return the new list (or 3 new lists?) to my VF page based on the date sort.

 

So, if the "Close_Date__c" is less than 30 days from today, it goes in one section of the VF page.  If it is over 60 days, it goes in another, and anything that is between 30 and 60 goes to the third section. 

 

My question is this:  how / where do I sort the list, and how do I return it to the VF page?

 

 

My Apex Class:

public class getAllRecords {

    public getAllRecords(ApexPages.StandardController Controller) {
    }
    
    public Opportunity__c[]getRecordDetail(){
        Opportunity__c[]recordList;
        recordList = [SELECT Opportunity_Name__c,
                                                Owner__c,
                                                Amount__c,
                                               Close_Date__c
                               FROM Opportunity__c
                               WHERE Account__c IN
                                      (SELECT AccountId
                                       FROM User
                                       WHERE username=:UserInfo.getUsername())
                               ORDER BY Close_Date__c];
        return recordList;
    }
}

 

my current setup in VF is like this(I have three identical, but only put in one to keep it short):

 

                          <apex:pageBlockSection id="zero30" title="0-30 Days" columns="1">
                                <apex:PageBlockTable value="{!RecordDetail}" var="records" rowClasses="red1,red2">
                                    <apex:column value="{!records.Opportunity_Name__c}" headerValue="Name" />
                                    <apex:column value="{!records.Owner__c}" headerValue="Owner" />
                                    <apex:column value="{!records.Amount__c}" headerValue="Amount" />
                                    <apex:column value="{!records.Close_Date__c}" headerValue="Due By" />
                                </apex:pageBlockTable>      
                            </apex:pageBlockSection>

 

Thanks again in advance.

This is getting pretty thick on my end.  But here goes:

 I have an org that allows multiple partner portal users.  Some are executive level, some are manager level.  I want to allow the visual force page to display opportunity records based on the user log in.  I cannot figure out how to connect them in my SOQL statement.   I have pasted in the applicable code, and when I run it on my end (with some fiddling, I can get the records to display based on the user ID, BUT, if a different user from the same company logs in, they cannot see the records that they should be able to since the Owner ID is tied to someone else.

How do i connect them?  Is there some field I can add to an opportunity to make it easier (well, not easier, then i would have to change ALL my opportunity records).

 

Visualforce Page:VF PAGE:
<apex:pageBlock >
    <apex:tabPanel id="theTabPanel" tabClass="activeTab" inactiveTabClass="inactiveTab" switchType="server" width="100%">
        <apex:tab label="Opportunity" labelWidth="250px" >                                      
            <apex:pageBlockSection id="zero30" title="0-30 Days Opportunity" columns="1">
                <apex:PageBlockTable value="{!RecordDetail}" var="records" rowClasses="red1,red2">
                    <apex:column value="{!records.Opportunity_Name}" headerValue="Opportunity Name" />
                    <apex:column value="{!records.Opportunity_Owner}" headerValue="Opportunity Owner" />
                    <apex:column value="{!records.Amount}" headerValue="Amount" />
                    <apex:column value="{!records.Close_Date}" headerValue="Close Date Due By" />
                </apex:pageBlockTable>      
            </apex:pageBlockSection>
            <apex:pageBlockSection title="31-60 Days Opportunity" columns="1">
               <apex:PageBlockTable value="{!RecordDetail}" var="records" rowClasses="yellow1,yellow2">
                    <apex:column value="{!records.Opportunity_Name}" headerValue="Opportunity Name" />
                    <apex:column value="{!records.Opportunity_Owner}" headerValue="Opportunity Owner" />
                    <apex:column value="{!records.Amount}" headerValue="Amount" />
                    <apex:column value="{!records.Close_Date}" headerValue="Close Date Due By" />
                </apex:pageBlockTable>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="61 Days (or more) Opportunity" columns="1">
                <apex:PageBlockTable value="{!RecordDetail}" var="records" rowClasses="green1,green2">
                    <apex:column value="{!records.Opportunity_Name}" headerValue="Opportunity Name" />
                    <apex:column value="{!records.Opportunity_Owner}" headerValue="Opportunity Owner" />
                    <apex:column value="{!records.Amount}" headerValue="Amount" />
                    <apex:column value="{!records.Close_Date}" headerValue="Close Date Due By" />
                </apex:pageBlockTable>
            </apex:pageBlockSection>     
        </apex:tab>
    </apex:tabPanel>
</apex:pageBlock>

CLASS:
public class getAllRecords {
    public getAllRecords(ApexPages.StandardController Controller) {
    }   
    public Opportunity[]getRecordDetail(){
        Opportunity[]recordList;
        recordList = [SELECT Opportunity.Opportunity_Name,
                             Opportunity.Opportunity_Owner,
                             Opportunity.Amount,
                             Opportunity.Close_Date
                        FROM Opportunity
                       WHERE OwnerId= :UserInfo.getUserID()];
        return recordList;
    }
}

 

 

 

 

 

Thank you in advance for looking and helping.