• Rejeesh Raghavan 2
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
VF page:

<apex:page standardController="Account" extensions="LH_PartnerOnCompanyExtsn" title="New BillTo" showHeader="false" >
  <html xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">  
   <head>
       <apex:stylesheet value="{!URLFOR($Resource.SLDS0122, 'assets/styles/salesforce-lightning-design-system-vf.css')}" />
       <!--<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"/>
        <script type="text/javascript" >
            $j = jQuery.noConflict();
            $j(document).ready(function() 
            {
                $j('a').attr("target","_blank");
            });

              </script>-->
        </head>  
       <div class="slds slds-scrollable"> 
           <apex:form id="form">
            <!--<div class="slds-button" id="saveAction1">
                
            </div>-->
             <!-- PAGE HEADER -->
            <div class="" style="margin-bottom:10px; !important;" role="banner">
                <!-- LAYOUT GRID -->
                <div class="slds-grid">
                    <!-- GRID COL -->
                    <div class="slds-col--padded slds-size--1-of-4">
                             
                     </div>
                     <div class="slds-col--padded slds-size--3-of-4">  
                        <!-- HEADING AREA -->
                              <apex:commandButton value="New Bill-To" onclick="window.open('{!billtoredirect}','_parent');" style="margin-right:5px; !important;"  styleclass="slds-button--neutral"/>
                              <apex:commandButton value="Add" onclick="window.open('{!Addbillto}','_parent');" styleclass="slds-button--neutral" />
                     </div>     
                </div>
                <!-- / LAYOUT GRID -->
             </div>
            <!-- / PAGE HEADER --> 
            <div class="myapp">
             <table class="slds-table slds-table--bordered slds-table--cell-buffer">
              <thead>
                <tr class="slds-text-heading--label">
                   <th scope="col" title="Opportunity Name">
                    <div class="slds-truncate">Bill-To Name</div>
                  </th>
                    
                  <th scope="col" title="CRM Company Number">
                    <div class="slds-truncate">CRM Company Number</div>
                  </th>
                  <th scope="col" title="Address">
                     <div class="slds-truncate">SAP No</div>
                  </th>
               
                </tr>
              </thead>
              <tbody> 
                  <apex:repeat value="{!BillToList}" var="p">
                  <tr>
                      <!--<td data-label="Account Name" title="Account Name">
                            <div class="slds-truncate">{!p.Business_Partner__r.Name}</div>
                      </td>-->
                       <td data-label="Account Name" title="Company__c">
                             <div class="slds-truncate">
                                 <!--<apex:outputLink value="/{!p.Company__c}">{!p.Business_Partner__r.Name}</apex:outputLink>-->
                                 <a href="/{!p.business_partner__c}" target="__blank">{!p.Business_Partner__r.Name}</a>
                             </div>
                       </td>
                              
                       <td data-label="Account Name" title="Company__c">
                            <div class="slds-truncate">{!p.Business_Partner__r.CRM_Company_No__c}</div>
                      </td>
                      
                       <td data-label="Account Name" title="Id">
                            <div class="slds-truncate">{!p.Business_Partner__r.SAP_No__c} </div>
                      </td>
                      
                      </tr>
                    </apex:repeat>
                  </tbody>
                  </table>
                </div>
              
       </apex:form>
       </div> 
    </html>
</apex:page>

Controller class:


/*
Change Log
1/8/206 : - Added by Suresh to displaying Business Partner(Ship-to, Bill-To and Payer) on Company Level
*/
public class LH_PartnerOnCompanyExtsn {
   
    public List<business_partner__c> BillToList{get;set;}
    public List<business_partner__c> ShipToList{get;set;}
    public List<business_partner__c> PayerToList{get;set;}
   // public List<business_partner__c> customerofshiptoList{get;set;}
    public PageReference shiptoredirect{get;set;}
    public PageReference billtoredirect{get;set;}
    public PageReference payertoredirect{get;set;}
    public PageReference Addbillto{get;set;}
    public PageReference Addshipto{get;set;}
    public PageReference Addpayerto{get;set;}
    //public PageReference AddcustomertoshipTo{get;set;}
   // public PageReference Addcustomeronbillto{get;set;}
//public PageReference Addcustomeronpayer{get;set;}
    Public Account Acc{get;set;}
    Public Id recTypeId_ship_to;
    Public Id recTypeId_bill_to;
    Public Id recTypeId_Payer;
    Public Id recTypeId_Customer;
    Public Id businessPartnerShipToRecType;
    Public Id businessPartnerBillToRecType;
    Public Id businessPartnerPayerRecType; 
    Public Id businessPartnerAccountRecType;
    
   
    public LH_PartnerOnCompanyExtsn(ApexPages.StandardController controller) {
        Acc = (Account)controller.getRecord();
        
        recTypeId_ship_to = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Ship-to').getRecordTypeId();
        recTypeId_bill_to = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Bill-To Only').getRecordTypeId();
        recTypeId_Payer = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Payer Only').getRecordTypeId();
        recTypeId_Customer= Schema.SObjectType.Account.getRecordTypeInfosByName().get('Customer').getRecordTypeId();
        
        businessPartnerShipToRecType  =Schema.SObjectType.Business_Partner__c.getRecordTypeInfosByName().get('Ship-To').getRecordTypeId();
        businessPartnerBillToRecType  =Schema.SObjectType.Business_Partner__c.getRecordTypeInfosByName().get('Bill-To').getRecordTypeId();
        businessPartnerPayerRecType  =Schema.SObjectType.Business_Partner__c.getRecordTypeInfosByName().get('Payer Only').getRecordTypeId();
        
        ShipToList=[SELECT Id,name,company__c,Business_Partner__r.SAP_No__c,Business_Partner__r.CRM_Company_No__c,Business_Partner__r.Name,business_partner__c,Company__r.Name,Company__r.CRM_Company_No__c,Company__r.SAP_No__c,Company__r.Company_Type__c,business_partner__r.Address__r.Name FROM Business_Partner__c WHERE Company__c =: Acc.Id and recordtypeid =:businessPartnerShipToRecType];
        BillToList=[SELECT Id,name,company__c,Business_Partner__r.SAP_No__c,Business_Partner__r.CRM_Company_No__c,Business_Partner__r.Name,business_partner__c,Company__r.Name,Company__r.CRM_Company_No__c,Company__r.SAP_No__c,Company__r.Company_Type__c ,business_partner__r.Address__r.Name FROM Business_Partner__c WHERE Company__c =: Acc.Id and recordtypeid =:businessPartnerBillToRecType];
        PayerToList=[SELECT Id,name,company__c,Business_Partner__r.SAP_No__c,Business_Partner__r.CRM_Company_No__c,Business_Partner__r.Name,business_partner__c,Company__r.Name,Company__r.CRM_Company_No__c,Company__r.SAP_No__c,Company__r.Company_Type__c ,business_partner__r.Address__r.Name FROM Business_Partner__c WHERE Company__c =: Acc.Id and recordtypeid =:businessPartnerPayerRecType];
        //customerofshiptoList=[SELECT Id,name,Business_Partner__r.Name,business_partner__c,Company__r.Name,Company__r.CRM_Company_No__c,Company__r.SAP_No__c,Company__r.Company_Type__c,Company__r.Address__r.Name FROM Business_Partner__c WHERE Business_Partner__c =: Acc.Id and recordtypeid =:businessPartnerShipToRecType];
        redirect();
    }
    
    public void  redirect(){
        PageReference BillToPage = new PageReference('/apex/LH_CreateNewBillTo_LightningNew?rectypeid='+recTypeId_bill_to+'&billAccId='+Acc.id+'&type=newbilltofromcompany').setRedirect(true);
        billtoredirect = BillToPage;
        
        PageReference shipToPage = new PageReference('/apex/LH_CreateShipTo_Lightning_New?rectypeid='+recTypeId_ship_to+'&shipAccId='+Acc.id+'&type=newshiptofromcompany').setRedirect(true);
        shiptoredirect = shipToPage;
        
        PageReference payerPage = new PageReference('/apex/LH_CreateNewPayer_LightningNew?rectypeid='+recTypeId_Payer+'&payerAccId='+Acc.id+'&type=newpayertofromcompany').setRedirect(true);
        payertoredirect = payerPage;
        
        PageReference AddbilltoPage = new PageReference('/apex/LH_AddPartnerToCompany?recid='+recTypeId_bill_to+'&AccId='+Acc.id).setRedirect(true);
        Addbillto = AddbilltoPage ;
        
        PageReference AddshiptoPage = new PageReference('/apex/LH_AddPartnerToCompany?recid='+recTypeId_ship_to+'&AccId='+Acc.id).setRedirect(true);
        Addshipto = AddshiptoPage ;
        
        PageReference AddpayertoPage = new PageReference('/apex/LH_AddPartnerToCompany?recid='+recTypeId_Payer+'&AccId='+Acc.id).setRedirect(true);
        Addpayerto = AddpayertoPage ;
        
       // PageReference AddcustomertoshipToPage = new PageReference('/apex/LH_AddPartnerToCompany?recid='+recTypeId_ship_to+'&AccId='+Acc.id+'&type=addcompanytopartner').setRedirect(true);
       // AddcustomertoshipTo = AddcustomertoshipToPage ;
    }



}

please write a test class for this class....

Hi - 
I have a probelm where I need to query back all content documents in my system to then run a scheduled job to clean up old documents. I am finding certian docuemtns I can only query if I explicitly set the Id in the WHERE clause, for example: 

SELECT Id
FROM ContentDocument
WHERE Title LIKE 'Some Document'

This query returns no results. But if I do a search in Salesforce of "Some Document", document results come back with this title. I can grab one of those documents Ids and run a query like this: 

SELECT Id
FROM ContentDocument
WHERE Id = '069...."

And the query would return a result with a title of "Some Document" 

I have tried adding the "USING SCOPE Team" qualifier in the "FROM" clause, and had some success with this, but I am still not able to query all documents in Salesforce. Does anyone have any suggestions on how I can query back ALL docuemnts? I have a system admin profile. 

Thanks, 

Mikayla