You need to sign in to do that
Don't have an account?

VF page to display selected record in list button
Hi, I’ve created custom list button, which when clicked open VF page. That button will be used for viewing existing records only (so user will have to select the record first from the list by checkbox and then clicking new button), but currently it opens up new page, but all fields are blank.
How do I change the apex to display the selected record instead (I've tried different options, e.g. with controller.getSelected, but can't get pass the errors)?
controller:
Thanks
How do I change the apex to display the selected record instead (I've tried different options, e.g. with controller.getSelected, but can't get pass the errors)?
controller:
global with sharing class SalesInvoicePrintReceipt extends SkyEditor2.SkyEditorPageBaseWithSharing { public c2g__codaInvoice__c record {get{return (c2g__codaInvoice__c)mainRecord;}} public with sharing class CanvasException extends Exception {} public SalesInvoicePrintReceipt(ApexPages.StandardController controller) { super(controller); SObjectField f; f = c2g__codaInvoice__c.fields.c2g__Account__c; f = c2g__codaInvoice__c.fields.c2g__Opportunity__c; f = c2g__codaInvoice__c.fields.Name; f = c2g__codaInvoice__c.fields.c2g__InvoiceDate__c; List<RecordTypeInfo> recordTypes; try { mainSObjectType = c2g__codaInvoice__c.SObjectType; setPageReferenceFactory(new PageReferenceFactory()); mainQuery = new SkyEditor2.Query('c2g__codaInvoice__c'); mainQuery.addFieldAsOutput('c2g__Account__c'); mainQuery.addFieldAsOutput('c2g__Opportunity__c'); mainQuery.addFieldAsOutput('Name'); mainQuery.addFieldAsOutput('c2g__InvoiceDate__c'); mainQuery.addWhere('Id', mainRecord.Id, SkyEditor2.WhereOperator.Eq) .limitRecords(1); mode = SkyEditor2.LayoutMode.LayoutSalesforce; queryMap = new Map<String, SkyEditor2.Query>(); SkyEditor2.Query query; p_showHeader = true; p_sidebar = true; init(); if (record.Id == null) { saveOldValues(); } } catch (SkyEditor2.Errors.FieldNotFoundException e) { fieldNotFound(e); } catch (SkyEditor2.Errors.RecordNotFoundException e) { recordNotFound(e); } catch (SkyEditor2.ExtenderException e) { e.setMessagesToPage(); } } @TestVisible private void sObjectNotFound(SkyEditor2.Errors.SObjectNotFoundException e) { SkyEditor2.Messages.addErrorMessage(e.getMessage()); hidePageBody = true; } @TestVisible private void fieldNotFound(SkyEditor2.Errors.FieldNotFoundException e) { SkyEditor2.Messages.addErrorMessage(e.getMessage()); hidePageBody = true; } @TestVisible private void recordNotFound(SkyEditor2.Errors.RecordNotFoundException e) { SkyEditor2.Messages.addErrorMessage(e.getMessage()); hidePageBody = true; } with sharing class PageReferenceFactory implements SkyEditor2.PageReferenceFactory.Implementation { public PageReference newPageReference(String url) { return new PageReference(url); } } }
Thanks
In which object you have created list button ? So the selected records you want from which object ?
object: c2g__codaInvoice__c
VF page:
I got that the object is c2g__codaInvoice__c . So you have created a list button is this object and overridden by this page .You want the selected records from related list right ?
Please check below code and try to implement with your code .Do a POC with this code then implement .
Better you can check in bebug you will get all fields which you have added in your query .Please change teh query by adding your required fields .
Error: Unknown property 'c2g__codaInvoice__cStandardController.p_showHeader'
when I remove it it gives me
Error: Unknown property 'c2g__codaInvoice__cStandardController.p_applyHtmlTag'
and so on
am I doing something wrong?