You need to sign in to do that
Don't have an account?
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
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!
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.
Check the URL of the page. URL cannot have a id when the page tag has a recordSetVar attribute.