• RalphCallaway.ax615
  • NEWBIE
  • 0 Points
  • Member since 2009

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

I downloaded the v17 version but when I try and open the application it does nothing.  Has anyone seen this behavior and perhaps has a tip for fixing it?

 

For comparison, the v16 version downloads and works flawlessly.

 

I'm using 10.5.8 with java version 1.5.

We've got a list button that calls a VF pg which uses an extension to the standard controller for a custom object.

 

Unless I'm absolutely crazy, this worked fine very recently.  (Last week?)  Today it doesn't work.  I get the following error:

 

Invalid variant 'parent': value 'Opportunity'

 

Which I don't understand at all.  I've tried it in various instances and it seems to have stopped working everywhere.  SF, did you push a change that caused this to stop working?

 

Here's the code.  First the page:

 

 

<apex:page standardController="OppPayment__c" recordSetVar="installments" extensions="ONEN_EXT_MarkPaymentsPaid" action="{!markInstallmentsWrittenOff}">
<apex:param name="mark" value="writeoff"/>
</apex:page>

 

next the extension:

 

 

public class ONEN_EXT_MarkPaymentsPaid {

private List<OppPayment__c> selectedInstallments;
private String mark;

//have to instantiate with StandardSetController for list buttons
public ONEN_EXT_MarkPaymentsPaid(ApexPages.StandardSetController controller) {
//get the selected ids that were checked
this.selectedInstallments = (List<OppPayment__c>)controller.getSelected();
}

public pageReference markInstallmentsPaid() {
mark='paid';
PageReference p = markInstallments();
return p;
}

public pageReference markInstallmentsWrittenOff() {
mark='writeoff';
PageReference p = markInstallments();
return p;
}

pageReference markInstallments() {
//get all the installments that were selected
List<OppPayment__c> InstallmentsFromSelection = [select Id,paid__c from OppPayment__c where Id IN :selectedInstallments];
if (InstallmentsFromSelection.size()>0) {
for (OppPayment__c thisInstallment : InstallmentsFromSelection) {
//if we're passing in paid on the querystring, mark them paid
if(mark=='paid') {
thisInstallment.paid__c=true;
thisInstallment.Written_Off__c=false;
} else if(mark=='writeoff') {
thisInstallment.Written_Off__c=true;
thisInstallment.paid__c=false;
}
}

update InstallmentsFromSelection;
}
PageReference p = new PageReference(System.currentPageReference().getParameters().get('retURL'));
p.setRedirect(true);
return p;
}
}

 

 BTW, OppPayment__c is a custom object which is detail-master to Opportunity.  The button is being accessed from a related list on an Opportunity layout.

 

edit: I just discovered that this list button works fine when called from the Console or from an OppPayment__c list view.  So the error seems to only occur when it's called from a related list on the Opp layout.  (Hence the reference to Opportunity being the 'parent', I assume.)

 

BTW, we have unit tests, and they all still pass.  So whatever the issue here is, it seems to happen only in the SF UI.   Also, nothing shows up in the System Log.

 

Can anyone help here?  

 

Thanks much!

 

PS: here's another post that may be related that looks like it was never answered: http://community.salesforce.com/sforce/board/message?board.id=Visualforce&thread.id=12980

 

 

 

 

Message Edited by sparky on 07-06-2009 10:54 PM
Message Edited by sparky on 07-06-2009 11:06 PM

I'm seeing some a strange error in a custom visualforce page that has a Standard Set Controller using a QueryLocator.

 

Overview:

The visualforce page shows an error of "Invalid variant 'parent': value 'Contact'"

The main culprit is calling the StandardSetController setPageSize method

 

Code Example:

 

public class BuggedPageController {
public ApexPages.StandardSetController setController { get; set; }
public Contact m_theContact{get;set;}

public BuggedPageController(Apexpages.StandardController asControl){
m_theContact = (Contact) asControl.getRecord();
// There are zero accounts with the name oxxoxo
setController = new ApexPages.StandardSetController(database.getQueryLocator([SELECT name,id,Owner.Name FROM Account WHERE name='oxxoxo']));
//if(this.setController.getResultSize() > 0 ){
this.setController.setPageSize(5);
//}
}

public List<Account> TheAccounts{
get{
return (List<Account>) this.setController.getRecords();
}
}
}

 

<apex:page standardController="Contact" extensions="BuggedPageController">

<apex:dataList value="{!TheAccounts}" var="oAccount">
<apex:outputText value="{!oAccount.name}"></apex:outputText>
</apex:dataList>

</apex:page>

 

 Detail Explanation and Weird Behavior:

  • Depending on the standard controller, the error message differs.  For example, if the standardController is of type "Task" and the appropriate changes are made in the BuggedPagController, the error message reads: Invalid variant 'parent': value 'Task'

  • When you do not specify an ID in the URL the error does not occur.  However, the standardSetController returns a list of all Accounts.
    • That is to say:
    • The URL: https://c.cs1.visual.force.com/apex/demoBuggedTableBinding?id=003S0000002rsfJ throws the error
    • The URL: https://c.cs1.visual.force.com/apex/demoBuggedTableBinding does not throw an error but shows the top 5 Accounts in the list.
  • The root cause lies somewhere in the setController.setPageSize(5) method call
    • If I comment this method call out or only call it when there are records available, the error does not occur when an ID is specified in the URL
    • If I comment this method call out when there is NOT an ID in the url, the Visualforce page does not display the top 5 Accounts.  It appropriately shows zero.
  • Inside a Unit Test, none of these errors occur:  That is to say, I can construct a BuggedPageController and thus call setPageSize when a QueryLocator returns no records without throwing an error.

 

Current Work Around:

  • Always wrap setPageSize in the following if Block:
  •  

    if(this.setController.getResultSize() > 0 ){
    this.setController.setPageSize(5);
    }

     

Related Forum Posts:

 SetPage Size ignored Where Clause

 

 

Message Edited by parkerAPT on 05-15-2009 10:38 AM
Hi fellow developers,

I'm trying to emulate the sample in the vf dev guide (Adding Custom List Buttons using Standard List Controllers), but with a twist: using a detail from a master-detail (Account = Master, detail = Flavor_Request__c).

I have both the Apex Class and controller similar to the example in the dev guide:

Code:
public class OpptyFlavorListButton
{
    public OpptyFlavorListButton(ApexPages.StandardSetController controller) {
            controller.setPageSize(10);
    }
}

<apex:page standardController="Flavor_Request__c" recordSetVar="flavors"
    tabStyle="Flavor_Request__c" extensions="OpptyFlavorListButton">
<apex:form >
    <apex:pageBlock title="Edit Status" mode="edit">
        <apex:pageMessages />
        <apex:pageBlockButtons location="top">
            <apex:commandButton value="Save" action="{!save}"/>
            <apex:commandButton value="Cancel" action="{!cancel}"/>
        </apex:pageBlockButtons>

        <apex:pageBlockTable value="{!selected}" var="f">
            <apex:column value="{!f.name}"/>
            <apex:column value="{!f.Request_Type__c}"/>
            <apex:column value="{!f.Sample_Size__c}"/>
            <apex:column headerValue="Status">
                <apex:inputField value="{!f.Status__c}"/>
            </apex:column>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:form>
</apex:page>

 



The buttons are added to the appropriate layouts, however, I keep getting the following errors:
1. Invalid variant 'parent': value 'Account'
2. Invalid variant 'parent': value 'Opportunity'

I get error #1 when trying this from the Account page (related list of flavors)
I get error #2 when trying this from the Opportunity page (related list of flavors)

I'm hitting these errors as the System Administrator who wrote the code...

Any feedback/suggestions would greatly be appreciated.

Thanks,
Larry


Message Edited by Legerdemain on 12-04-2008 08:38 PM

Message Edited by Legerdemain on 12-04-2008 08:39 PM