• neil_edwards_fcca1.389781386123482E12
  • NEWBIE
  • 44 Points
  • Member since 2014

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 9
    Replies
Does anyone know why I am getting the error "Didn't understand relationship 'dispatch__c' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names."

Here is the line of the code with the error.

List<Charter__c> Dispatch = [select id,(Select Id from dispatch__c WHERE Date_Scheduled__c != null)
                                 from Charter__c where ID IN: Trigger.NewMap.KeySet() ORDER BY Date_Scheduled__c];

Thanks.
I'm trying to embed a very simple Visualforce page inside a standard page layout of custom object.
When the visualforce is run on its own there are no problems.
When it is embedded in the standard page layout I get the message ' Content cannot be displayed: unrecognized Base64 character: *'

The field on the visualforce page is a decrypted field. The field only contains plain text. Any ideas??
Visualforce page:-

<apex:page standardController="Term__c" cache="true" showheader="false" standardstylesheets="true" extensions="ExtVirtualEncryptedTable" > 

<apex:pageblock > 

 <apex:pageblocksection columns="1" title="Tables">
<apex:outputtext value="{!tables}" escape="false" />
</apex:pageblocksection>     

</apex:pageblock> 
     
      
</apex:page>

Extension Controller:-

Public with sharing class ExtVirtualEncryptedTable {

private ApexPages.StandardController controller;

Public string Tables {get;set;}

private final Term__c term;
 
Public  ExtVirtualEncryptedTable(ApexPages.StandardController controller) {
Controller.addFields(new List<String>{'Encryptionkey__c','TableInfo__c','Other_Information__c','Example__c','Unlock_record__c'});


this.controller = controller;
        this.term=(Term__c)controller.getrecord();
        
              
            // Unencrypt data upon loading
           
   if(term.TableInfo__c!=null) {
    Blob cryptoKey = EncodingUtil.Base64Decode(term.Encryptionkey__c);
        Blob string2open2 = EncodingUtil.Base64Decode(term.TableInfo__c);
          Blob decryptedData2 = Crypto.decryptWithManagedIV('AES256', cryptoKey, string2open2);
           Tables = decryptedData2.toString();
           }
           
      }   
    }

 
I have a query which nests the related tasks with a contract.  E.g. [Select Id, name , (select Id , subject from tasks ) from contracts].

i know how to create a wrapper class for a query that is not nested but how do I create the constructor class for a query above?

e.g. I would normally have something like

public class wrapper 
public contract con {get;set}
public boolean selected {get;set}
public wrapper (contract c)
 con=c

i cant seem to use this as the query also includes tasks?

any ideas? Thanks 
The Pagemessages should rerender when the inLineEdit is saved on the <apex:detail> tag . It isnt.  When its manually refreshed all Pagemessages render correctly. Any ideas??

Thanks in advance

<apex:page standardcontroller="Fees__c" tabstyle="Fees__c" showheader="true" standardstylesheets="true" extensions="FeeSaveAndReturnController">

    <chatter:feedwithfollowers entityID="{!Fees__c.id}" />

<apex:stylesheet value="/sCSS/21.0/sprites/1297816277000/Theme3/def​ault/gc/versioning.css" />  

<apex:pageblock >

<apex:pageblocksection columns="1" title="Messages & Warnings" >


<apex:pagemessages rendered="true" id="msg2" />

<apex:outputPanel id="warnings" layout="block">

  <apex:PageMessage summary="The Deal is an approval process and cannot be edited until this has completed."
            severity="error"
            strength="2"
            rendered="{!Fees__c.Deal_Protocol_Ref__r.In_Approval__c}"         
            />
 
   <apex:PageMessage summary="The required {!Fees__c.Variables__c} x Variable(s) below have not been entered. This term cannot be approved."
            severity="error"
            strength="2"
            rendered="{!Fees__c.Incomplete__c}"         
            />
      
      <apex:PageMessage summary="This term has been APPROVED. "
            severity="confirm"
            strength="1"
            rendered="{!Fees__c.Term_Sheet_Approved__c && Fees__c.Deleted__c =false}"
            />
           
      
      <apex:PageMessage summary="This term has been marked as Deleted. To 'undelete' this term use the Clone button. "
            severity="error"
            strength="3"
            rendered="{!Fees__c.Deleted__c}"
            />     
     <apex:PageMessage summary="{!Fees__c.Key_Considerations__c}"
            severity="info"
            strength="3"
            rendered="{!Fees__c.Key_Considerations__c !=null}"
            />
     </apex:outputPanel>
              
           <apex:form >
   <apex:commandButton value="Delete this Term"  onclick="return confirm('You have chosen to delete this item. \nPlease confirm this is what you want to do.');"  action="{!DeleteTerm}" />
   <apex:commandButton value="Make Changes"  onclick="return confirm('You have chosen to unlock this approved term. Once unlocked it will need re-approving. \nPlease confirm this is what you want to do.');"  action="{!unlock}" rendered="{!Fees__c.Term_Sheet_Approved__c}"/>
 
     <apex:outputText value="{!Fees__c.deal_protocol_ref__r.id}" rendered="false" /> 

   </apex:form>
          
   </apex:pageblocksection>
    </apex:pageblock>      
     
         <apex:detail relatedList="false" title="true" inlineedit="true" id="mydetail" rerender="warnings"/>  
    
</apex:page>
HI - I have this short Javascript in a visualforce page to extend the functionality of the Rich Text field.  This works fine in Sandbox (v30) but not in Production (v29). 

Any ideas?  Any likely settings in production environment that may be preventing this from running??
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"/>
 
<script> 
 
  $(document).ready(function(){

        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 : 400, 
                       bodyId : target
            });
        });
    });
 
</script>


HI - Im using a visualforce page and wrapper classes to create three data tables. Table1 allows you to select a record(s) from a custom object. This then feeds into table 2 which filters based on the records selected in Table 2.   Table 3 is a list of records selected from records checked in Table2.  This table will form the basis of an Insert process into the custom object.

Tables 1 & 2 work fine, however I cannot for the life of me get table to rerender properly. I'm not sure of the problem is in the controller or the visualforce page but I'm suspecting a simple error I'm overlooking somewhere.

Any ideas??

Thanks in advance
public with sharing class Incentive_Checkbox_Class {

    public Incentive_Checkbox_Class(ApexPages.StandardController controller) {

    }

 List<string> Sections = new List<string>{'Fees','ATM','Penalties'};

 
 List<wrapper1> List1 = new List<wrapper1>();
 List<wrapper2> List2 = new List<wrapper2>();
 List<wrapper3> List3 = new List<wrapper3>();
 
Set<id> List3UniqueId = new Set<id>();
 
 List<Playbook_Category__c> SelectedList1 = new List<Playbook_Category__c>();
 List<Playbook__c> SelectedList2 = new List<Playbook__c>();

     
            
    public List<wrapper1> getList1()
    {
        list1.clear();
        for(Playbook_Category__c aList1 : [select Id, Name from Playbook_Category__c where Type__c not in:sections order by name ASC])
        List1.add(new wrapper1(aList1));
        return List1;
    }
    
    public List<wrapper2> getList2()
    {
       list2.clear();
       for(Playbook__c aList2: [select id,name,Desirability__c,Playbook_language__c,Category__c from Playbook__c where Category__c in :SelectedList1 order by category__r.name,Desirability__c,name ASC ])
        List2.add(new wrapper2(aList2));
        return List2;
    }
    
    public List<wrapper3> getList3()
    {
      List3.clear();
      for(Playbook__c aList3: [select id,name,Desirability__c,Playbook_language__c,Category__c from Playbook__c where id in :List3UniqueId order by category__r.name,Desirability__c,name ASC ])
                 
        List3.add(new wrapper3(aList3));
        return List3;
    }
    
    
    public PageReference getSelected()
    {
        SelectedList1.clear();
        
        for(wrapper1 ctwrapper :List1) {
        if(ctwrapper.selected1 == true) {
        SelectedList1.add(ctwrapper.acc1);
        }
        }
        list2.clear();
        return null;
    }
    
     public PageReference getSelected2()
    {
   
        for(wrapper2 ctwrapper2 :List2){
        if(ctwrapper2.selected2 == true){
        List3UniqueId.add(ctwrapper2.acc2.id);
        
           }
        }
       
        return null;
    }
    
     public PageReference getSelected3()
    {
        List3UniqueId.clear();
        for(wrapper3 ctwrapper3 :List3){
        if(ctwrapper3.selected3 == true){
        List3UniqueId.add(ctwrapper3.acc3.id);
           }
        }
        
        return null;
    }
    
          
    public class wrapper1
    {
        public Playbook_Category__c acc1{get; set;}
        public Boolean selected1 {get; set;}
        public wrapper1(Playbook_Category__c a1)
        {
            acc1 = a1;
         
        }
    }
    
     public class wrapper2
    {
        public Playbook__c acc2{get; set;}
        public Boolean selected2 {get; set;}
        public wrapper2(Playbook__c a2)
        {
            acc2 = a2;
           
        }
    }
    
    public class wrapper3
    {
        public Playbook__c acc3{get; set;}
        public Boolean selected3 {get; set;}
        public wrapper3(Playbook__c a3)
        {
            acc3 = a3;
        
        }
    }
}

======================================================

<apex:page standardcontroller="Payments__c" tabstyle="Payments__c" showheader="true" standardstylesheets="true" extensions="Incentive_Checkbox_Class"> 

<apex:form >


<apex:pageBlock Title="New Playbook Compliant Incentives and Marketing Contractual terms">

<table><tr><td>

<apex:dataTable value="{!List1}" var="a" columnswidth="50px,50px" cellpadding="4" border="1">
<apex:column >

<apex:inputCheckbox value="{!a.selected1}" id="checked1">
<apex:actionSupport event="onclick" action="{!GetSelected}" rerender="Selected_PBS"/>
</apex:inputCheckbox>
</apex:column>
<apex:column headervalue="Category Name" value="{!a.acc1.Name}" />

</apex:dataTable>
</td><td>
<apex:dataTable value="{!List2}" var="s" columnswidth="50px,50px" cellpadding="4" border="1" id="Selected_PBS">
<apex:column >
<apex:facet name="header"></apex:facet>
<apex:inputCheckbox value="{!s.selected2}" id="checked2">
<apex:actionSupport event="onclick" action="{!GetSelected2}" rerender="test"/>
</apex:inputCheckbox>
</apex:column>
<apex:column headervalue="Category" value="{!s.acc2.Category__c}" />
<apex:column headervalue="Type" value="{!s.acc2.Desirability__c}" />
<apex:column headervalue="Playbook Term" value="{!s.acc2.Name}" />
<apex:column headervalue="Contractual Language" value="{!s.acc2.Playbook_language__c}" />

</apex:dataTable>

</td></tr></table>


<apex:pageblocksection title="Playbook Terms to Insert" columns="1" >

<apex:dataTable value="{!List3}" var="s3" columnswidth="50px,50px" cellpadding="4" border="1" id="test">
<apex:column >
<apex:facet name="header"></apex:facet>
<apex:inputCheckbox value="{!s3.selected3}" id="checked3">
<apex:actionSupport event="onchange" action="{!GetSelected3}" rerender="test"/>
</apex:inputCheckbox>
</apex:column>
<apex:column headervalue="Category" value="{!s3.acc3.Category__c}" />
<apex:column headervalue="Type" value="{!s3.acc3.Desirability__c}" />
<apex:column headervalue="Playbook Term" value="{!s3.acc3.Name}" />
<apex:column headervalue="Contractual Language" value="{!s3.acc3.Playbook_language__c}" />

</apex:dataTable>


</apex:pageblocksection>

</apex:pageBlock>
</apex:form>

</apex:page>

Hi - I'm trying to copy a file in a Content library into an attachment of a Contract record as I can't give the Account Owner access to a group folder in Content. 
The document in Content is encypted.  I've used the attached code to do the migration. If I have an unecrypted file it works fine. The encrypted files are now corrupted when they are copied into attachments. If I manually download from content and upload the encrypted files into attachments they are fine.

Any ideas on what may be changing the file structure that corrupts the encrypted files? I assume that the transfer would copy a byte for byte copy of the document?

Thanks
Public Pagereference Migrate() {

List<contentVersion> ContentDocs = [select id,VersionData,GNS_Partner__c,Implementation_Ref__c,MFR_Ref__c,Migrated__c,Title,description,pathonclient,ownerid,contentsize from contentversion where islatest=true and Migrated__c=false and contentsize <5000001 and GNS_partner__c=:system.currentPageReference().getparameters().get('id')];

List<attachment> NewAtt = new list<attachment> ();

If(ContentDocs.size()>0){
String Descrpt;


    For(ContentVersion c: ContentDocs){

            
    if(c.description !=null){Descrpt = c.description;}
      else {descrpt = 'Executed Contract = Voltage Encrypted';}
      String VerData = encodingUtil.base64Encode(c.versiondata);
              NewAtt.add(new Attachment(ParentId=c.Implementation_Ref__c,body=EncodingUtil.base64Decode(VerData),name=c.title,description=c.description, ownerid=c.ownerid,contenttype='application/pdf'));
    c.Migrated__c=true;
    
    }


// Update content as migrated and insert new Attachments to IMP

update ContentDocs;
insert NewAtt;
return null;
  }
  
return null;


I'm trying to change the ownership of files in Content to the new owner of an Account when it changes.  I have changed the ownerId field in both ContentDocument and ContentVersion to the new account ownerId.  If I open up the documents in Content and check the File sharing settings I can see that the new Account owner is showing as being shared on all the documents. 

However if I log in as the Account owner and go to 'Files' tab and select 'Files I own' these documents do not show up.  

The files are in Library folders which the Account owners do not have access to.  If however I open a document in the folder and manually share the document in the folder with the new Account Owner (even though it already shows it being shared) then the account owner can then see it.

From this I assume there must be another object that I need to update with the changed ownerId , maybe a FeedItem?? so that the new Account owner can see the document that it is the owner for.

Any ideas?
Hi, I'm struggling to find a way to replicate selecting a record in a visualforce page. Without somehow making the record in the test class selected nothing is being checked against the test code, Any help greatly appreciated! 
Extract from Test Class


// Set-up of Test Records here

// Set up visualforce parameters

PageReference pageRef = Page.CloneDeal;
PageRef.getParameters().put('id',Deal.id);

Test.setCurrentPage(pageRef);

// create an instance of the controller
Checkbox_class myPageCon = new Checkbox_class();



test.starttest();

mypageCon.getselected();
mypageCon.getselectedfee();
mypageCon.getselectedpay();
mypageCon.getselectediss();
mypageCon.getselectedtar();
mypageCon.getselectedaq();
myPageCon.getPayments();
myPageCon.getFees();
myPageCon.getPayments();
myPageCon.getIssuer();
myPageCon.getTargets();
myPageCon.getaq();
myPageCon.getex();
myPageCon.getDeals();



myPageCon.doClone();

test.stoptest();

e in the test class. 
Extract from Visualforce page

<apex:page controller="Checkbox_Class" Tabstyle="Deal_Protocol__c">
 <apex:stylesheet value="/sCSS/21.0/sprites/1297816277000/Theme3/def​ault/gc/versioning.css" /> 
  <apex:sectionHeader title="Clone Deal: "/>

  <apex:form id="theform" >
  <apex:PageBlock >
   <apex:PageBlockButtons >
   
      <apex:commandButton action="{!doClone}" value="Clone this Deal" /> 
      <apex:commandButton action="{!CloseFrm}" value="Cancel & Return" />
    </apex:PageBlockButtons>
 
            <apex:pageBlockSection Title="Transaction to be Cloned - Check box to select item(s) to clone">
                <apex:dataTable value="{!deals}" var="a" columnswidth="50px,50px" cellpadding="4" border="1">
                    <apex:column >
                        <apex:facet name="header"> <apex:inputCheckbox >
                            <apex:actionSupport event="onclick" action="{!GetSelected}" onsubmit="checkAll(this)" rerender="Selected_PBS"/>
                            </apex:inputCheckbox>
                        </apex:facet>
                        <apex:inputCheckbox value="{!a.selected}" id="checkedone">
                        <apex:actionSupport event="onclick" action="{!GetSelected}" rerender="Selected_PBS"/></apex:inputCheckbox>
                    </apex:column>
                    <apex:column headervalue="Deal Name" value="{!a.acc.Name}" />
                    <apex:column headervalue="Deal Type" value="{!a.acc.Agreement_Type__c}" />
                  
                </apex:dataTable>
            </apex:pageBlockSection>

<apex:pageBlockSection Title="List of Fees that can be cloned (does not include deleted fees)">
                <apex:dataTable value="{!fees}" var="f" columnswidth="50px,50px" cellpadding="4" border="1">
                    <apex:column >
                    
                        <apex:inputCheckbox value="{!f.selectedf}" id="checkedone">
                        <apex:actionSupport event="onclick" action="{!GetSelectedfee}" rerender="Selected_PBS"/></apex:inputCheckbox>
                    </apex:column>
                    <apex:column headervalue="Fee Name" value="{!f.fee.Name}" />
                    <apex:column headervalue="Playbook Category" value="{!f.fee.Playbook_Category__c}" />
                    <apex:column headervalue="Playbook Ref" value="{!f.fee.Playbook_Ref__c}" /> 
                                     
                </apex:dataTable>
            </apex:pageBlockSection>


Extract from Apex class

public class Checkbox_Class
{

    String DealID = ApexPages.currentPage().getParameters().get('id');

    List<DealWrapper> DealList = new List<DealWrapper>();
    List<FeeWrapper> FeeList = new List<FeeWrapper>();
    
     
    List<Deal_protocol__c> selectedDeal = new List<Deal_protocol__c>();
    List<Fees__c> selectedFee = new List<Fees__c>();
    
     
  
    public List<DealWrapper> getDeals()
    {
        for(Deal_protocol__c a : [select Id, Name,Agreement_Type__c from  Deal_protocol__c where id=:dealid limit 1])
        DealList.add(new DealWrapper(a));
        return DealList;
    }

  public List<FeeWrapper> getFees()
    {
        for(Fees__c f : [select Id, Name,Playbook_Category__c,Playbook_Ref__c from Fees__c where Deal_protocol_ref__c =:dealid and deleted__c=false order by playbook_category__c ASC])
        FeeList.add(new FeeWrapper(f));
        return FeeList;
    }

 public PageReference getSelected()
    {
        selectedDeal.clear();
        for(DealWrapper accwrapper : DealList)
        if(accwrapper.selected == true)
        selectedDeal.add(accwrapper.acc);
        return null;
    }
    
      public PageReference getSelectedFee()
    {
        selectedfee.clear();
        for(FeeWrapper fwrapper : FeeList)
        if(fwrapper.selectedf == true)
        selectedfee.add(fwrapper.fee);
        return null;
    }

    public class DealWrapper
    {
        public Deal_protocol__c acc{get; set;}
        public Boolean selected {get; set;}
        public DealWrapper(Deal_protocol__c a)
        {
            acc = a;
            selected = false;
        }
    }
    
     public class FeeWrapper
    {
        public Fees__c fee{get; set;}
        public Boolean selectedf {get; set;}
        public FeeWrapper(fees__c f)
        {
            fee = f;
            selectedf = false;
        }
     }


I have a query which nests the related tasks with a contract.  E.g. [Select Id, name , (select Id , subject from tasks ) from contracts].

i know how to create a wrapper class for a query that is not nested but how do I create the constructor class for a query above?

e.g. I would normally have something like

public class wrapper 
public contract con {get;set}
public boolean selected {get;set}
public wrapper (contract c)
 con=c

i cant seem to use this as the query also includes tasks?

any ideas? Thanks 
The Pagemessages should rerender when the inLineEdit is saved on the <apex:detail> tag . It isnt.  When its manually refreshed all Pagemessages render correctly. Any ideas??

Thanks in advance

<apex:page standardcontroller="Fees__c" tabstyle="Fees__c" showheader="true" standardstylesheets="true" extensions="FeeSaveAndReturnController">

    <chatter:feedwithfollowers entityID="{!Fees__c.id}" />

<apex:stylesheet value="/sCSS/21.0/sprites/1297816277000/Theme3/def​ault/gc/versioning.css" />  

<apex:pageblock >

<apex:pageblocksection columns="1" title="Messages & Warnings" >


<apex:pagemessages rendered="true" id="msg2" />

<apex:outputPanel id="warnings" layout="block">

  <apex:PageMessage summary="The Deal is an approval process and cannot be edited until this has completed."
            severity="error"
            strength="2"
            rendered="{!Fees__c.Deal_Protocol_Ref__r.In_Approval__c}"         
            />
 
   <apex:PageMessage summary="The required {!Fees__c.Variables__c} x Variable(s) below have not been entered. This term cannot be approved."
            severity="error"
            strength="2"
            rendered="{!Fees__c.Incomplete__c}"         
            />
      
      <apex:PageMessage summary="This term has been APPROVED. "
            severity="confirm"
            strength="1"
            rendered="{!Fees__c.Term_Sheet_Approved__c && Fees__c.Deleted__c =false}"
            />
           
      
      <apex:PageMessage summary="This term has been marked as Deleted. To 'undelete' this term use the Clone button. "
            severity="error"
            strength="3"
            rendered="{!Fees__c.Deleted__c}"
            />     
     <apex:PageMessage summary="{!Fees__c.Key_Considerations__c}"
            severity="info"
            strength="3"
            rendered="{!Fees__c.Key_Considerations__c !=null}"
            />
     </apex:outputPanel>
              
           <apex:form >
   <apex:commandButton value="Delete this Term"  onclick="return confirm('You have chosen to delete this item. \nPlease confirm this is what you want to do.');"  action="{!DeleteTerm}" />
   <apex:commandButton value="Make Changes"  onclick="return confirm('You have chosen to unlock this approved term. Once unlocked it will need re-approving. \nPlease confirm this is what you want to do.');"  action="{!unlock}" rendered="{!Fees__c.Term_Sheet_Approved__c}"/>
 
     <apex:outputText value="{!Fees__c.deal_protocol_ref__r.id}" rendered="false" /> 

   </apex:form>
          
   </apex:pageblocksection>
    </apex:pageblock>      
     
         <apex:detail relatedList="false" title="true" inlineedit="true" id="mydetail" rerender="warnings"/>  
    
</apex:page>
HI - I have this short Javascript in a visualforce page to extend the functionality of the Rich Text field.  This works fine in Sandbox (v30) but not in Production (v29). 

Any ideas?  Any likely settings in production environment that may be preventing this from running??
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"/>
 
<script> 
 
  $(document).ready(function(){

        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 : 400, 
                       bodyId : target
            });
        });
    });
 
</script>


HI - Im using a visualforce page and wrapper classes to create three data tables. Table1 allows you to select a record(s) from a custom object. This then feeds into table 2 which filters based on the records selected in Table 2.   Table 3 is a list of records selected from records checked in Table2.  This table will form the basis of an Insert process into the custom object.

Tables 1 & 2 work fine, however I cannot for the life of me get table to rerender properly. I'm not sure of the problem is in the controller or the visualforce page but I'm suspecting a simple error I'm overlooking somewhere.

Any ideas??

Thanks in advance
public with sharing class Incentive_Checkbox_Class {

    public Incentive_Checkbox_Class(ApexPages.StandardController controller) {

    }

 List<string> Sections = new List<string>{'Fees','ATM','Penalties'};

 
 List<wrapper1> List1 = new List<wrapper1>();
 List<wrapper2> List2 = new List<wrapper2>();
 List<wrapper3> List3 = new List<wrapper3>();
 
Set<id> List3UniqueId = new Set<id>();
 
 List<Playbook_Category__c> SelectedList1 = new List<Playbook_Category__c>();
 List<Playbook__c> SelectedList2 = new List<Playbook__c>();

     
            
    public List<wrapper1> getList1()
    {
        list1.clear();
        for(Playbook_Category__c aList1 : [select Id, Name from Playbook_Category__c where Type__c not in:sections order by name ASC])
        List1.add(new wrapper1(aList1));
        return List1;
    }
    
    public List<wrapper2> getList2()
    {
       list2.clear();
       for(Playbook__c aList2: [select id,name,Desirability__c,Playbook_language__c,Category__c from Playbook__c where Category__c in :SelectedList1 order by category__r.name,Desirability__c,name ASC ])
        List2.add(new wrapper2(aList2));
        return List2;
    }
    
    public List<wrapper3> getList3()
    {
      List3.clear();
      for(Playbook__c aList3: [select id,name,Desirability__c,Playbook_language__c,Category__c from Playbook__c where id in :List3UniqueId order by category__r.name,Desirability__c,name ASC ])
                 
        List3.add(new wrapper3(aList3));
        return List3;
    }
    
    
    public PageReference getSelected()
    {
        SelectedList1.clear();
        
        for(wrapper1 ctwrapper :List1) {
        if(ctwrapper.selected1 == true) {
        SelectedList1.add(ctwrapper.acc1);
        }
        }
        list2.clear();
        return null;
    }
    
     public PageReference getSelected2()
    {
   
        for(wrapper2 ctwrapper2 :List2){
        if(ctwrapper2.selected2 == true){
        List3UniqueId.add(ctwrapper2.acc2.id);
        
           }
        }
       
        return null;
    }
    
     public PageReference getSelected3()
    {
        List3UniqueId.clear();
        for(wrapper3 ctwrapper3 :List3){
        if(ctwrapper3.selected3 == true){
        List3UniqueId.add(ctwrapper3.acc3.id);
           }
        }
        
        return null;
    }
    
          
    public class wrapper1
    {
        public Playbook_Category__c acc1{get; set;}
        public Boolean selected1 {get; set;}
        public wrapper1(Playbook_Category__c a1)
        {
            acc1 = a1;
         
        }
    }
    
     public class wrapper2
    {
        public Playbook__c acc2{get; set;}
        public Boolean selected2 {get; set;}
        public wrapper2(Playbook__c a2)
        {
            acc2 = a2;
           
        }
    }
    
    public class wrapper3
    {
        public Playbook__c acc3{get; set;}
        public Boolean selected3 {get; set;}
        public wrapper3(Playbook__c a3)
        {
            acc3 = a3;
        
        }
    }
}

======================================================

<apex:page standardcontroller="Payments__c" tabstyle="Payments__c" showheader="true" standardstylesheets="true" extensions="Incentive_Checkbox_Class"> 

<apex:form >


<apex:pageBlock Title="New Playbook Compliant Incentives and Marketing Contractual terms">

<table><tr><td>

<apex:dataTable value="{!List1}" var="a" columnswidth="50px,50px" cellpadding="4" border="1">
<apex:column >

<apex:inputCheckbox value="{!a.selected1}" id="checked1">
<apex:actionSupport event="onclick" action="{!GetSelected}" rerender="Selected_PBS"/>
</apex:inputCheckbox>
</apex:column>
<apex:column headervalue="Category Name" value="{!a.acc1.Name}" />

</apex:dataTable>
</td><td>
<apex:dataTable value="{!List2}" var="s" columnswidth="50px,50px" cellpadding="4" border="1" id="Selected_PBS">
<apex:column >
<apex:facet name="header"></apex:facet>
<apex:inputCheckbox value="{!s.selected2}" id="checked2">
<apex:actionSupport event="onclick" action="{!GetSelected2}" rerender="test"/>
</apex:inputCheckbox>
</apex:column>
<apex:column headervalue="Category" value="{!s.acc2.Category__c}" />
<apex:column headervalue="Type" value="{!s.acc2.Desirability__c}" />
<apex:column headervalue="Playbook Term" value="{!s.acc2.Name}" />
<apex:column headervalue="Contractual Language" value="{!s.acc2.Playbook_language__c}" />

</apex:dataTable>

</td></tr></table>


<apex:pageblocksection title="Playbook Terms to Insert" columns="1" >

<apex:dataTable value="{!List3}" var="s3" columnswidth="50px,50px" cellpadding="4" border="1" id="test">
<apex:column >
<apex:facet name="header"></apex:facet>
<apex:inputCheckbox value="{!s3.selected3}" id="checked3">
<apex:actionSupport event="onchange" action="{!GetSelected3}" rerender="test"/>
</apex:inputCheckbox>
</apex:column>
<apex:column headervalue="Category" value="{!s3.acc3.Category__c}" />
<apex:column headervalue="Type" value="{!s3.acc3.Desirability__c}" />
<apex:column headervalue="Playbook Term" value="{!s3.acc3.Name}" />
<apex:column headervalue="Contractual Language" value="{!s3.acc3.Playbook_language__c}" />

</apex:dataTable>


</apex:pageblocksection>

</apex:pageBlock>
</apex:form>

</apex:page>

Does anyone know why I am getting the error "Didn't understand relationship 'dispatch__c' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names."

Here is the line of the code with the error.

List<Charter__c> Dispatch = [select id,(Select Id from dispatch__c WHERE Date_Scheduled__c != null)
                                 from Charter__c where ID IN: Trigger.NewMap.KeySet() ORDER BY Date_Scheduled__c];

Thanks.
Hi - I'm trying to copy a file in a Content library into an attachment of a Contract record as I can't give the Account Owner access to a group folder in Content. 
The document in Content is encypted.  I've used the attached code to do the migration. If I have an unecrypted file it works fine. The encrypted files are now corrupted when they are copied into attachments. If I manually download from content and upload the encrypted files into attachments they are fine.

Any ideas on what may be changing the file structure that corrupts the encrypted files? I assume that the transfer would copy a byte for byte copy of the document?

Thanks
Public Pagereference Migrate() {

List<contentVersion> ContentDocs = [select id,VersionData,GNS_Partner__c,Implementation_Ref__c,MFR_Ref__c,Migrated__c,Title,description,pathonclient,ownerid,contentsize from contentversion where islatest=true and Migrated__c=false and contentsize <5000001 and GNS_partner__c=:system.currentPageReference().getparameters().get('id')];

List<attachment> NewAtt = new list<attachment> ();

If(ContentDocs.size()>0){
String Descrpt;


    For(ContentVersion c: ContentDocs){

            
    if(c.description !=null){Descrpt = c.description;}
      else {descrpt = 'Executed Contract = Voltage Encrypted';}
      String VerData = encodingUtil.base64Encode(c.versiondata);
              NewAtt.add(new Attachment(ParentId=c.Implementation_Ref__c,body=EncodingUtil.base64Decode(VerData),name=c.title,description=c.description, ownerid=c.ownerid,contenttype='application/pdf'));
    c.Migrated__c=true;
    
    }


// Update content as migrated and insert new Attachments to IMP

update ContentDocs;
insert NewAtt;
return null;
  }
  
return null;


Hi, I'm struggling to find a way to replicate selecting a record in a visualforce page. Without somehow making the record in the test class selected nothing is being checked against the test code, Any help greatly appreciated! 
Extract from Test Class


// Set-up of Test Records here

// Set up visualforce parameters

PageReference pageRef = Page.CloneDeal;
PageRef.getParameters().put('id',Deal.id);

Test.setCurrentPage(pageRef);

// create an instance of the controller
Checkbox_class myPageCon = new Checkbox_class();



test.starttest();

mypageCon.getselected();
mypageCon.getselectedfee();
mypageCon.getselectedpay();
mypageCon.getselectediss();
mypageCon.getselectedtar();
mypageCon.getselectedaq();
myPageCon.getPayments();
myPageCon.getFees();
myPageCon.getPayments();
myPageCon.getIssuer();
myPageCon.getTargets();
myPageCon.getaq();
myPageCon.getex();
myPageCon.getDeals();



myPageCon.doClone();

test.stoptest();

e in the test class. 
Extract from Visualforce page

<apex:page controller="Checkbox_Class" Tabstyle="Deal_Protocol__c">
 <apex:stylesheet value="/sCSS/21.0/sprites/1297816277000/Theme3/def​ault/gc/versioning.css" /> 
  <apex:sectionHeader title="Clone Deal: "/>

  <apex:form id="theform" >
  <apex:PageBlock >
   <apex:PageBlockButtons >
   
      <apex:commandButton action="{!doClone}" value="Clone this Deal" /> 
      <apex:commandButton action="{!CloseFrm}" value="Cancel & Return" />
    </apex:PageBlockButtons>
 
            <apex:pageBlockSection Title="Transaction to be Cloned - Check box to select item(s) to clone">
                <apex:dataTable value="{!deals}" var="a" columnswidth="50px,50px" cellpadding="4" border="1">
                    <apex:column >
                        <apex:facet name="header"> <apex:inputCheckbox >
                            <apex:actionSupport event="onclick" action="{!GetSelected}" onsubmit="checkAll(this)" rerender="Selected_PBS"/>
                            </apex:inputCheckbox>
                        </apex:facet>
                        <apex:inputCheckbox value="{!a.selected}" id="checkedone">
                        <apex:actionSupport event="onclick" action="{!GetSelected}" rerender="Selected_PBS"/></apex:inputCheckbox>
                    </apex:column>
                    <apex:column headervalue="Deal Name" value="{!a.acc.Name}" />
                    <apex:column headervalue="Deal Type" value="{!a.acc.Agreement_Type__c}" />
                  
                </apex:dataTable>
            </apex:pageBlockSection>

<apex:pageBlockSection Title="List of Fees that can be cloned (does not include deleted fees)">
                <apex:dataTable value="{!fees}" var="f" columnswidth="50px,50px" cellpadding="4" border="1">
                    <apex:column >
                    
                        <apex:inputCheckbox value="{!f.selectedf}" id="checkedone">
                        <apex:actionSupport event="onclick" action="{!GetSelectedfee}" rerender="Selected_PBS"/></apex:inputCheckbox>
                    </apex:column>
                    <apex:column headervalue="Fee Name" value="{!f.fee.Name}" />
                    <apex:column headervalue="Playbook Category" value="{!f.fee.Playbook_Category__c}" />
                    <apex:column headervalue="Playbook Ref" value="{!f.fee.Playbook_Ref__c}" /> 
                                     
                </apex:dataTable>
            </apex:pageBlockSection>


Extract from Apex class

public class Checkbox_Class
{

    String DealID = ApexPages.currentPage().getParameters().get('id');

    List<DealWrapper> DealList = new List<DealWrapper>();
    List<FeeWrapper> FeeList = new List<FeeWrapper>();
    
     
    List<Deal_protocol__c> selectedDeal = new List<Deal_protocol__c>();
    List<Fees__c> selectedFee = new List<Fees__c>();
    
     
  
    public List<DealWrapper> getDeals()
    {
        for(Deal_protocol__c a : [select Id, Name,Agreement_Type__c from  Deal_protocol__c where id=:dealid limit 1])
        DealList.add(new DealWrapper(a));
        return DealList;
    }

  public List<FeeWrapper> getFees()
    {
        for(Fees__c f : [select Id, Name,Playbook_Category__c,Playbook_Ref__c from Fees__c where Deal_protocol_ref__c =:dealid and deleted__c=false order by playbook_category__c ASC])
        FeeList.add(new FeeWrapper(f));
        return FeeList;
    }

 public PageReference getSelected()
    {
        selectedDeal.clear();
        for(DealWrapper accwrapper : DealList)
        if(accwrapper.selected == true)
        selectedDeal.add(accwrapper.acc);
        return null;
    }
    
      public PageReference getSelectedFee()
    {
        selectedfee.clear();
        for(FeeWrapper fwrapper : FeeList)
        if(fwrapper.selectedf == true)
        selectedfee.add(fwrapper.fee);
        return null;
    }

    public class DealWrapper
    {
        public Deal_protocol__c acc{get; set;}
        public Boolean selected {get; set;}
        public DealWrapper(Deal_protocol__c a)
        {
            acc = a;
            selected = false;
        }
    }
    
     public class FeeWrapper
    {
        public Fees__c fee{get; set;}
        public Boolean selectedf {get; set;}
        public FeeWrapper(fees__c f)
        {
            fee = f;
            selectedf = false;
        }
     }