+ Start a Discussion
sparkysparky 

inscrutable error message: invalid variant 'parent'

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
ESES
Although I was not able to repro your issue, I did see the error using the example provided in the other post your referenced. It seems that if there is a request parameter called 'id' standard set controller treats it specially and may throw an error if the record being referenced by the value of this attribute is not of its liking. I have create a bug for this, and added to our backlog. However, I cannot give you any ETA on the fix. Feel free to create a case with SFDC support (and reference this post) if you want to increase the priority.
sparkysparky

OK, will do.  Thanks, Emad.

 

I do see that SF puts id=foo on the querystring when the list button is accessed from a related list.  But that seems to make sense, so that the set controller knows which Opp record's related records it should pull.  Not sure why that causes the error, but it does seem to be the culprit.  (That element of the URL is missing when accessing the list button from console or list view.)

 

One question, since this so far has happened with every record I've tried it with, and doesn't seem to depend on the particulars of the record: when you tried to repro, did you:

 

* set up your custom objectas detail-master to Opportunity?

* create a list button pointing to the VF pg I posted?

* put that list button on related list on Opp layout?

* activate the button from an Opp record?

 

Thanks much!

RalphCallaway.ax615RalphCallaway.ax615

Please log a case with saleforce support if you encounter similar issues.

 

In the case comments reference this as a possible instance of bug W-672711. 

nsknsk

Check the URL of the page. URL cannot have a id when the page tag has a recordSetVar attribute.