• jucuzoglu
  • NEWBIE
  • 175 Points
  • Member since 2010

  • Chatter
    Feed
  • 7
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 79
    Questions
  • 78
    Replies

When logging into a Community as a User via the Contact record the {!$User.Id} token contained within a Visualforce page contained withinan a Home Page Component displayed via an iFrame it shows my ID rather than the ID of the person I am masquerading as.

Example of the Component code

<iframe src="https://c.na6.visual.force.com/apex/TBR_App_Reviewer_Portal_HP?core.apexpages.devmode.url=1" width="98%" frameborder="0" height="400"></iframe>
When accessing a legacy portal the ID shows as the user I am masquerading as..
When accessomg a community the ID shows my user ID

Is this a bug?

Can the Community User credentials be used to login via the Salesforce1 mobile app or is that only available to users who have the full Salesforce license?

I started using Salesforce1, downloaded the app, logged in. Seeing stuff. Thats cool. But our organization has several Apps, one of which we utilize primarily.

 

How can I tell which App I am connected to when I log into Salesforce1?

 

 

I am using this tag but the profile (portal user) does not seem able to see the tag. They can see other text on the VF page but the embedded chatter does not seem to be visible.

 

here is the tag. Any ideas?

 

<chatter:feed entityId="0F9800000004HqT"/> 

 

I want to grab the Contact Records associated with CampaignMember records that meet a particular criteria.

 

If APEX/SOQL supported DISTINCT I would run the following query:

 

Select Id,Name from Contact Where ID IN
(Select DISTINCT ContactID from CampaignMember where SomeCondition = true)

 I would not be too concerned with needing Distinct except the secondary query is too large without it.

 

I tried the statement above and using the Group By statement which (when run by itself) returns unique results however the IN clause does not seem to support grouped results and throws an error.

 

Perhaps there is a better way for me to go about this? I anticipate that the number of CampaignMember records that meet the criteria is aproximatly 75000 but they only repersent around 15,000 unique Contact records. 

I found a great bit of code in the Code Exchange

 

//Fetching all account in map
Map<id,account> aMap = new Map<id,account>([Select Id,Name from Account limit 50000]);

//Creating list of accounts
List<account> accList = aMap.values() ;

//Creating set of ids
Set<id> accIds = aMap.keySet() ;

If I knew that I wanted to change the Account with a particular ID's Email field to 'someone@someemail.com' is there a way to do so without looping through the results or worse executing a SOQL query for that specific record.?

I would like to pass a string with the Object API name and build a list of that object type. For example how I wished it worked.

 

string myObjectAPIName = 'Account';
List<sObject> myGenericObjectList = new List<myObjectAPIName>();

 Thank you in advance for the assistance.

I have a pageblocktable with results that require scrolling. I would like to fix the header (have it scroll) so the user can always see the matching header to the appropriate column.

 

Is there a setting to fix the header or another way to achieve this goal?

My controller has a method that returns a list.

Based on certain criteria I would like to hide the results from the DataBlockTable. For example if Revenue__c < 300.

 

I know this could be done by changing the SOQL query to filter the results so the list just does not contain the unwanted values. However I would prefer to keep the list as is and filter on the VisualForce side. Is there a syntax to use render  within a DataBlockTable so it will conditionally show the rows?

I want to grab an Image, accessed via a URL (or it could be a StaticResource) turn it into a Base64Encoded Blob so that I can attach it to a Chatter FeedItem (post).

 

Here is my (incorrect) attempt trying to accomplish this (using a PDF instead of an image) which happens to be timing out.

 

//Adding a Content post
PageReference p = new PageReference('http://www.stluciadance.com/prospectus_file/sample.pdf');
Blob body = p.getContent();
FeedItem post = new FeedItem();
post.ParentId = '0F9800000004FIF';
post.Body = 'This is sample text #3 with attachment';
post.CreatedById = '00580000003frfk';
post.ContentData = body;
post.ContentFileName = 'SomeFile.pdf';
insert post;

 

I have VP/Apex Class that updates a record.When the page first loads it grabs the first record that meets a particular criteria.

 

Here is the code that runs when the record is submitted. What should happen is upon submission it should update a checkbox (and some other fields) and then set the PageReference to the same page and then reload that page.

 

One of the criteria for the selected record is that the Resume Review Completed field should be false therefore after a submission the current record should drop out. (which it does if I reload manually)

 

 

public pageReference doSubmitReview()
	{
        
        if (ResumeStatus != '' && ResumeStatus != null)
        {
        	cRC.Status__c = ResumeStatus;	
        }
        cRC.Resume_Review_Completed__c = true;
        Update cRC;

        nextlink = '/apex/TBR_Resume_Review';
        PageReference nextPage = new PageReference(nextlink);
        return nextPage;
			
	}

What I notice is the bottom part (not url) seems to reload, it almost appears as if its reloading cache of the prior page load. If I manually choose to click reload I get the results I expect.

 

Is there something else I should be doing to force a proper reload.

 

 

I want to create a list of sObjects that were modified 7 days ago.

 

I am using code similar to this, but when I get to the SOQL query it appears that something is not quite working.

 

Date myDate = date.today()-7;
List<Recruitment_Cycle__c> RCs = [Select ID, Name, LastModifiedDate from Recruitment_Cycle__c where LastModifiedDate =: myDate ]; 

In this case I am getting 0 rows, however there are a number of records that I would expect to meet the criteria when looking at the data. I suspect something is wrong with my comparison etc...

 

When I check the debug for myDate it is assigning what looks like the proper date.

For example. Say I have the following iFrame tag on my page.

 

<apex:iframe src="http://www.salesforce.com" scrolling="true" height="600" width="100%" id="docframe"/>  

 

How would I change the value of the source to another page?

 

I tried using code similar to whats presented in the iFrame Target example on here: http://www.w3schools.com/html/html_iframe.asp but on my browser (Firefox) it opens a new tab. Even when I copy and paste the example from the preceding link into my visualForce page it insists on opening a new tab in my browser.

 

How should I be doing this? (having a link open the iFrame as a target is an exceptable solution for me)

When constructing an sObject for example:

 

Account a = new Account(Name = 'Test Account ', Description = 'Some Description');

How do I know if a field's value should be encapsulated in quotes? (is this documented in the APEX or Metadata guides by chance?)

 

I believe an sObject can be of the following types, but not sure which ones would require quotes and which ones would not require quotes for the values when constructing the sObject:

 

  • base64
  • boolean
  • combobox
  • currency
  • date
  • datetime
  • double
  • email
  • encryptedstring
  • id
  • integer
  • multipicklist
  • percent
  • phone
  • picklist
  • string
  • reference
  • textarea
  • time
  • url

I have a formula which concatenates two text fields.

 

I have run queries against it and can see records which contain non-null values and fields listed as null values in Real Force Explorer Query Tool.

 

I have been using the syntax myfield__c != null but that does not filter out any of the values which appear to be empty. I also tried syntax myfield__c != '' for kicks but neither seems to filter out the records.

 

My next step is to reach out to the community to see if perhaps I need to be doing something different to evaluate null formula values in SOQL or if there is a function to check the length of a text field (so I can check for a length greater than 1 for example)

 

 

I may want to grab and combine information from multiple sources into a wrapper object. Can I use the JSON methods such as Serialize with a wrapper class?

I installed the Force.com IDE and everything seems to work ok excpet the menu buttons are missing. Anyone know how to enable and display the menu buttons?

Imagine that I have 2 columns and a very large field that stretches quite a bit vertically. Instead of having lots of dead space on the right I would like to be able to place several columns of information.

 

I have a pretty good idea how I would solve this if I was using straight HTML, but I do like the ease and styling afforded when using Visualforce tags. What is your reccomendation for providing displaying a 2 column display of information similar to what I described above?

 

If this were straight HTML I could create 2 divs side by side populate the left with the large field and the right side with a table with several rows. (is there a way to accomplish this easily and still continue to use Visualforce tags and VisualForce styling? I suspect if I add Divs and put VF elements in a smaller space then intended it will result in some messed up formatting.

Is there a way via APEX or VisualForce to select (override) the detail layout when displaying a detail tag in Visualforce?

 

I want to create a specific detail page layout just for this particular page, however I would prefer to build it declaratively rather than having to build it field (or fieldset) by field in Visualforce.

 

 

I have the following Class

 

    public class linkListItem {
        public string title {get;set;}
        public url value {get;set;}
        
        public linkListItem(string gsTitle, url gsValue)
        {
            title = gsTitle;
            value = gsValue;
        } 
        
    }   

 And I want to create a list of this new linkListItem and add elements to the list. Passing the string in the constructor is easy, but I can't figure out how to pass the URL.

 

I'm using code similar to:

 

mylinkListItemList.add(new linkListItem('My Link Title','/apex/somepage?id=' + myObj.Id);

The problem is it sees the constructor as (String),(String) rather than (String), (Url).

 

How do I pass the second part as a URL?

I would like to display a different set of elements from an object depending on picklist value. If this were PHP and I could not use Case statements I might do something like:

 

If (myPicklistValue=='Value1')

{

// My webform fields to display if the value is 1

}

If (myPicklistValue=='Value2')

{

// My webform fields to display if the value is 2

}



If (myPicklistValue=='Value3')

{

// My webform fields to display if the value is 3

}

 I'd like to do something similar on a Visualforce page. Check the value of the picklist. If its equal to value1 then display a set of page and block elements etc...

 



I am using a custom object which is a child of the account object.

 

If I run this query:

 

Select a.Name, (Select Partner_Research_Name__c, Partner_Research_URL__c From Partner_Research_Records__r) From Account a

 

I get a list of all accounts some of which contain a record Partner_Research_Records__r that is blank, and others (when the object is present in the parent object) a set of values.

 

I want to add something to the where clause that will filter out any responses where the Partner_Research_Records__r recordset is null, however I can't seem to figure out the proper syntax.

As a company with over 100 tabs in total we use the traditional concept of "Apps" extensively to control the list of tabs by business process and application.  Am I missing something, or is the Salesforce1 product currently lacking the same basic kind of strcuture functionality.  How do I create a structured Nav menu in Salesforce1?  

 

Recent tabs is not a solution to my needs, and the Mobile Navigation customization is not designed to easily support basic tabs and is only globally customizable.

 

I don't get it, what's the thought process Salesforce?

Ivano

Has anybody implemented RichText Editor with full CKEditor toolbar with fileupload?

 

Has anybody used "/_ui/common/request/servlet/RtaImageUploadServlet" as URL for file upload?

 

 

When I access URL "https://cs11.salesforce.com/_ui/common/request/servlet/RtaImageUploadServlet" , I get below error.

 

while(1); {"errMsg":["\u003Cb\u003EError:\u003C/b\u003E Invalid parameters.","\u003Cb\u003EError:\u003C/b\u003E Invalid parameters."]}

 

When I use below code , it shows full toolbar . But Image upload does not work.

 

---

 

CKEDITOR.on('instanceReady', function(e) {
if (e.editor.config.magic) return;
var target = e.editor.config.bodyId;
var name = e.editor.name;

e.editor.destroy();

CKEDITOR.editorConfig = function( config ) { config.magic = true; }
CKEDITOR.replace(name, {
height : 600,
bodyId : target ,
sharedSpaces : { top : 'cke_topSpace', bottom : ' cke_bottomSpace' },
filebrowserImageUploadUrl : '/_ui/common/request/servlet/RtaImageUploadServlet',
contentsCss : ['/sCSS/29.0/sprites/1377821920000/Theme3/default/gc/HtmlDetailElem.css', '/sCSS/29.0/sprites/1377821920000/Theme3/default/gc/CKEditor.css'],
language : 'en-us',
sfdcLabels : {
CkeMediaEmbed : {
title : 'Embed Multimedia Content',
description : 'Use &lt;iframe&gt; code from DailyMotion, Vimeo, and Youtube.',
subtitle : 'Paste &amp;lt;iframe&amp;gt; code here:',
exampleTitle : 'Example:',
example : '\n \n &lt;iframe width=\&quot;560\&quot; height=\&quot;315\&quot; src=\&quot;https://www.youtube.com/embed/KcOm0TNvKBA\&quot; frameborder=\&quot;0\&quot; allowfullscreen&gt;&lt;/iframe&gt;\n \n ',
iframeMissing : 'Invalid &lt;iframe&gt; element. Please use valid code from the approved sites.'
},
sfdcSwitchToText : { sfdcSwitchToTextAlt : 'Use plain text'},
CkeImageDialog : {
uploadTab : 'Upload Image',
infoTab_url : 'URL',
error : 'Error:',
uploadTab_desc_info : 'Enter a description of the image for visually impaired users',
uploadTab_desc : 'Description',
infoTab_url_info : 'Example: http://www.mysite.com/myimage.jpg',
btn_insert : 'Insert',
missingUrlError : 'You must enter a URL',
uploadTab_file : 'Select Image',
infoTab_desc : 'Description',
btn_upadte : 'Update',
wrongFileTypeError : 'You can insert only .gif .jpeg and .png files.',
infoTab : 'Web Address',
title : 'Insert Image',
infoTab_desc_info : 'Enter a description of the image for visually impaired users',
imageUploadLimit_info : 'Max number of upload images exceeded',
uploadTab_file_info : 'Maximum size 1 MB. Only png, gif or jpeg'
} ,
CkeImagePaste : { CkeImagePasteWarning : 'Pasting an image is not working properly with Firefox, please use [Copy Image location] instead.' }
}
});
});

-----

 

Any ideas on how to use full toolbar with Salesforce OOB image upload functionality?

I would like to pass a string with the Object API name and build a list of that object type. For example how I wished it worked.

 

string myObjectAPIName = 'Account';
List<sObject> myGenericObjectList = new List<myObjectAPIName>();

 Thank you in advance for the assistance.

My controller has a method that returns a list.

Based on certain criteria I would like to hide the results from the DataBlockTable. For example if Revenue__c < 300.

 

I know this could be done by changing the SOQL query to filter the results so the list just does not contain the unwanted values. However I would prefer to keep the list as is and filter on the VisualForce side. Is there a syntax to use render  within a DataBlockTable so it will conditionally show the rows?

I have VP/Apex Class that updates a record.When the page first loads it grabs the first record that meets a particular criteria.

 

Here is the code that runs when the record is submitted. What should happen is upon submission it should update a checkbox (and some other fields) and then set the PageReference to the same page and then reload that page.

 

One of the criteria for the selected record is that the Resume Review Completed field should be false therefore after a submission the current record should drop out. (which it does if I reload manually)

 

 

public pageReference doSubmitReview()
	{
        
        if (ResumeStatus != '' && ResumeStatus != null)
        {
        	cRC.Status__c = ResumeStatus;	
        }
        cRC.Resume_Review_Completed__c = true;
        Update cRC;

        nextlink = '/apex/TBR_Resume_Review';
        PageReference nextPage = new PageReference(nextlink);
        return nextPage;
			
	}

What I notice is the bottom part (not url) seems to reload, it almost appears as if its reloading cache of the prior page load. If I manually choose to click reload I get the results I expect.

 

Is there something else I should be doing to force a proper reload.

 

 

For example. Say I have the following iFrame tag on my page.

 

<apex:iframe src="http://www.salesforce.com" scrolling="true" height="600" width="100%" id="docframe"/>  

 

How would I change the value of the source to another page?

 

I tried using code similar to whats presented in the iFrame Target example on here: http://www.w3schools.com/html/html_iframe.asp but on my browser (Firefox) it opens a new tab. Even when I copy and paste the example from the preceding link into my visualForce page it insists on opening a new tab in my browser.

 

How should I be doing this? (having a link open the iFrame as a target is an exceptable solution for me)

I have a formula which concatenates two text fields.

 

I have run queries against it and can see records which contain non-null values and fields listed as null values in Real Force Explorer Query Tool.

 

I have been using the syntax myfield__c != null but that does not filter out any of the values which appear to be empty. I also tried syntax myfield__c != '' for kicks but neither seems to filter out the records.

 

My next step is to reach out to the community to see if perhaps I need to be doing something different to evaluate null formula values in SOQL or if there is a function to check the length of a text field (so I can check for a length greater than 1 for example)

 

 

I may want to grab and combine information from multiple sources into a wrapper object. Can I use the JSON methods such as Serialize with a wrapper class?

Imagine that I have 2 columns and a very large field that stretches quite a bit vertically. Instead of having lots of dead space on the right I would like to be able to place several columns of information.

 

I have a pretty good idea how I would solve this if I was using straight HTML, but I do like the ease and styling afforded when using Visualforce tags. What is your reccomendation for providing displaying a 2 column display of information similar to what I described above?

 

If this were straight HTML I could create 2 divs side by side populate the left with the large field and the right side with a table with several rows. (is there a way to accomplish this easily and still continue to use Visualforce tags and VisualForce styling? I suspect if I add Divs and put VF elements in a smaller space then intended it will result in some messed up formatting.

I have an object with a dependent picklist.

 

//Dummy record used for the picklist fields on the VF page.
public Recruitment_Cycle__c cycle {
	get {
		if(cycle == null) cycle = new Recruitment_Cycle__c();
			return cycle;
	     }
	set;
	}

 Its called in this code on the VisualForce page

 

<apex:inputField value="{!cycle.Stage__c}" required="true" />
<apex:inputField value="{!cycle.Status__c}" required="true"/>
<apex:inputField value="{!cycle.Second_Rd_City__c}" required="true"/>

 The problem is the Stage variable only shows 10 of the values however there should be 21 available options. The Status is dependent on the Stage and so far as I can see the statuses show up properly based on the currently selected Stage.

 

Any idea on what might be causing 11 of the values not to display?

Below is the code for my Visual Force page and APEX controller. I run a TRY block and intentionaly throw an exception.

 

I used similar code in another VisualForce/APEX Controller page combination and it works for me however on this page when I click the button and the exception is thrown the error message is not displaying.

 

VisualForce Page

<apex:page controller="PlacementPreferenceFormController" sidebar="false" showHeader="false" cache="false">
    <apex:pageMessages id="errorMessage"/>
    <apex:outputPanel >
            <apex:form >
            <apex:pageBlock title="Placement Preference Form">
            
                <apex:pageBlockSection columns="2">
                      <apex:InputField value="{!RecruitmentCycle.Allocated_Points__c}"/>
                      <apex:InputField value="{!RecruitmentCycle.Remaining_Points__c}"/>
                </apex:pageBlockSection>
            </apex:pageBlock>
            
            <apex:pageBlock title="Add Placement Preference" mode="edit" id="PPAdd">
                <apex:pageBlockSection columns="2">
                    <apex:outputLabel value="Partner Organization " for="pl"><apex:selectList id="pl" value="{!ppn.Partner_Research__c}" size="1" title="Partner Organization">
                        <apex:selectOptions value="{!PRs}"></apex:selectOptions>
                    </apex:selectList></apex:outputLabel>
                                    
                    <apex:InputField value="{!ppn.Points__c}"/>
                    <apex:commandButton value="Add Placement" action="{!newPlacementPreference}" rerender="all">
                    </apex:commandButton>
                </apex:pageBlockSection>    
            </apex:pageBlock>
            
            <apex:pageBlock title="Placement Preferences" mode="edit" id="PPList">
                <apex:pageBlockTable value="{!PlacementPreferenceList}" var="pp">
                    <apex:column value="{!pp.Partner_Research_Organization__c}"/>
                    <apex:column value="{!pp.Organization_Type__c}"/>
                    <apex:column value="{!pp.City__c}"/>
                    <apex:column value="{!pp.State__c}"/>
                    <apex:column value="{!pp.Points__c}"/>
                    <apex:column headerValue="Action">    
                        <apex:commandButton value="Del" action="{!deletePlacementPreference}" rerender="all">
                            <apex:param name="ppParam" value="{!pp.Id}" assignTo="{!ppid}"/>
                        </apex:commandButton>
                    </apex:column>                            
                </apex:pageBlockTable>
            </apex:pageBlock>
        </apex:form>
    </apex:outputPanel>
</apex:page>

 

APEX Controller

public class PlacementPreferenceFormController {

	// Declare Recruitment Cycle and Placement Preference List
	public Recruitment_Cycle__c rc;
	public LIST<Placement_Preference__c> ppl;
	public Placement_Preference__c ppn {get; set;}
	public String pl {get; set;}
	public decimal ppnPoints {get;set;}
	public string ppnPR {get;set;}	
	public string ppid {get;set;}
	
	public PlacementPreferenceFormController(){
		// Select Recruitment Cycle Record pulling ID parameter
		rc = [select id, allocated_points__c, remaining_points__c from Recruitment_Cycle__c
		where id =:ApexPages.currentPage().getParameters().get('id')]; 
		  
		// Select Placement Preference List from parent record
		ppl = [select id, Partner_Research_Organization__c, City__c, Organization_Type__c, Partner_Research__c, Points__c, Recruitment_Cycle__c, State__c
		from Placement_Preference__c Where Recruitment_Cycle__c = :ApexPages.currentPage().getParameters().get('id')];
		
		ppn = new Placement_Preference__c();		
	}
	
	// Picklist Select Option Values for Partner Research
	public List<selectOption> getPRs() {
			List<selectOption> options = new List<selectOption>(); //new list for holding all of the picklist options
			options.add(new selectOption('', '- None -')); //add the first option of '- None -' in case the user doesn't want to select a value or in case no values are returned from query below
			for (Partner_Research__c PRoption : [select id, Organization_Name__r.name from Partner_Research__c 
		Where (TBR_Partner_Year__c = '2012' AND Research_Stage__c = 'Recruiting' AND Status__c = 'Invite to submit proposal')
		  OR (TBR_Partner_Year__c = '2012' AND Research_Stage__c = 'Position Proposal') 
		  OR (TBR_Partner_Year__c = '2012' AND Research_Stage__c = 'Placement') 
		ORDER BY Organization_Name__r.name]) { //query for User records with System Admin profile
				options.add(new selectOption(PRoption.Id, PRoption.Organization_Name__r.name)); //for all records found - add them to the picklist options
			}
			return options; //return the picklist options
		}	
	
	public void refreshPlacementPreferences()
	{
		ppl = [select id, City__c, Organization_Type__c, Partner_Research__c, Points__c, Recruitment_Cycle__c, State__c
		from Placement_Preference__c Where Recruitment_Cycle__c = :ApexPages.currentPage().getParameters().get('id')];				
	}
	
    public PageReference deletePlacementPreference() {
        Placement_Preference__c pptd = [Select id from Placement_Preference__c where Id = :ppid];
		delete pptd;
		string url = 'http://broadcenter.force.com/page/PlacementPreferences?id=' + rc.Id;
		PageReference p = new PageReference(url);
    	p.setRedirect(true); 
        return p;
    }	
    
    public PageReference newPlacementPreference() {
	try{
			
			throw new cException('Residency Requirement is a required field.');
	    	Placement_Preference__c ppta = new Placement_Preference__c(Recruitment_Cycle__c = rc.id);			
			if (ppn.Points__c > 0)
			{
				ppta.Points__c = ppn.Points__c;
				ppta.Partner_Research__c = ppn.Partner_Research__c;
				insert ppta;
			}
			
			
			string url = 'http://broadcenter.force.com/page/PlacementPreferences?id=' + rc.Id;
			PageReference p = new PageReference(url);
	    	p.setRedirect(true); 
	        return p;
    }
    catch(Exception e){ApexPages.addMessages(e);return null;}          
    } 	    
	
	public Recruitment_Cycle__c getRecruitmentCycle(){
		return rc;
	}
	
	public LIST<Placement_Preference__c> getPlacementPreferenceList(){
		return ppl;
	}
	
}

 

I have a Visualforce page that displays a number of records in a data table with a checkbox in each row. As can be seen in the code below

 

<apex:page controller="ProgramSupportList">
    <apex:pageBlock >
      <apex:form >  
        <apex:pageBlockTable value="{!ProgramSupportItems}" var="psi">
            <apex:column >
                <apex:facet name="header">
                    Select
                </apex:facet>
                <apex:inputCheckbox value="{!psi.id}" />
            </apex:column>        
            <apex:column value="{!psi.id}"/>
            <apex:column value="{!psi.Status__c}"/>
            <apex:column value="{!psi.Date__c}"/>
            <apex:column value="{!psi.Hours__c}"/>
            <apex:column value="{!psi.Program__r.Executive_Coach__c}"/>            
        </apex:pageBlockTable>
        <apex:commandButton action="{!ProcessSupportItems}" value="Invoice Selected Items" />
      </apex:form> 
    </apex:pageBlock>
</apex:page>

 

What I don't know is how to set up the ProcessSupportItems method to grab those values and pass them to a static method.

 

Here is my controller code 

 

public class ProgramSupportList {

    public PageReference ProcessSupportItems() {
         List<Program_Support__c> ml = setCon.getSelected();
         System.Debug('************1');
         System.Debug(ml);
         System.Debug('************2');       
        return null;
    }

    
  // ApexPages.StandardSetController must be instantiated 
    
  // for standard list controllers 
    
    public ApexPages.StandardSetController setCon {
        get {            
            if(setCon == null) {                
                setCon = new ApexPages.StandardSetController(Database.getQueryLocator(
                       [Select Id,Status__c,Program__r.Executive_Coach__c,Date__c, Hours__c From Program_Support__c
                        where Program__r.Executive_Coach__c = '003V0000001y6nC' 
                        AND Status__c != 'Invoiced'
                       ]));
            }
            return setCon;
        }
        set;
    }

    // Initialize setCon and return a list of records 
    
    public List<Program_Support__c> getProgramSupportItems() {
         return (List<Program_Support__c>) setCon.getRecords();
    }
}

 

I have noticed that the button does not seem to be calling the method as I don't see any of my debug statements. So that may be the issue.

 

NOTE: I eventually did resolve the problem using the wrapper based solution. One thing that was causing a problem for me was also this line of code:

 

<apex:inputCheckbox value="{!psi.id}" />

While it did not generate an error it would not allow any command buttons to properly call the APEX methods. Turns out its not a good idea to bind a checkbox to a read only field as I did in this case :) .I fixed this using code similar to what was presented below in the solution by incorporating the wrapper and binding the checkbox to a boolean field.

I have a sites page that is not part of the navigation that I would like to preview in Admin mode. How do I preview that specifc page in Admin mode.

 

Right now I am getting an Authorization Required message which is not very useful for debugging purposes. I have tried logging the public user but even then the logs don't tell me which field or script etc... that the public user does not have access to that is generating the run time error.

 

 

I have a controller extension which has a function similar to

 

public String getMyvar()
{
// a bunch of code
// returns a string
}

 I have a test class, but not sure how I can access the variable to force the function to run in my test code.

 

I have tried something similar to String testVariable = getMyvar(); but that does not work, it says the method does not exist or incorrect signature.

 

How should I be attempting this?

I use a try/catch block with code similar to the following to display a variety of exceptions including validation errors. Shown below is the catch poriton:

 

        catch(Exception e)
        {
        	ApexPages.addMessages(e);
        }

 Now I would like to THROW a standard exception. i.e.

 

Try {

(Validate some condition)

}

catch (DMLException DMLe){

[How do I place code here that will provide a specific static message that i want to show as the particular exception message]

}

I have a page reference that returns me to the object the user started on. It works great, except the URL is still the Visualforce page. It was my understanding that setRedirect(true) accomplished this. I know it used to work like this, but at some point this functionliaty changed and it no longer updates the url.

 

Anyone know how I can accomplish the URL to be updated with my page reference? It's causing some minor confusion when people "refresh" and end up going to the VF page they just left.

 

public PageReference SaveProducts() { PageReference ReturnPage = new PageReference('/' + Master.id); ReturnPage.setRedirect(true); return ReturnPage; }