• mnz123
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 4
    Replies
Here I'm trying to display grandchild, child of a parent record. ORDER is the parent, order line is the child and shipment lines is the grandchild. I'm trying to display all of them in a nested table. So far I'm successful in displaying order lines for a single ORDER, but I'm messing up with the related shipment lines.

The controller
 
public class GE_PW_OrderTrackingList{
    public GE_PW_OrderTrackingList(ApexPages.StandardController controller) {

    }

    public list<wrapgroupwise> singlegroup;
  //  Map <String, Invoices__c> uniqueInvoices = new Map <String, Invoices__c>();
    public List<wrapgroupwise> getStartHere(){
    singlegroup= new List<wrapgroupwise>();
    List<order_lines__c> temol= [SELECT Id, name,calculated_estimated_delivery_date__c,order_number__c,status__c,planned_ship_date__c,material_name__c,material_no__c, quantity_ordered__c, material_group__c,(SELECT Id,Name,Order_Number__c,Actual_Delivery_Date__c, estimated_delivery_date__c,Shipment_Number__r.name, Shipment_Number__r.carrrier_name__c, Shipment_Number__r.carrier_website__c,Shipment_Number__r.tracking_number__c,quantity_shipped__c, material_group__c,order_lines__c  From shipment_lines__r ) From order_lines__c where number_of_order_lines__c=:ApexPages.currentPage().getParameters().get('id')];
    
    List<orders__c> tempacc=[SELECT Orders__c,CreatedBy.FirstName,CreatedDate, number_of_line_items__c, CurrencyIsoCode,account__r.name,contract__r.ContractNumber,customer_order_number__c,invoices__c,my_view__c,order_acknowlegment__c,order_date__c,order_value__c, order_no__c, requested_delivery_date__c,shipments__c,Id,Name,
                                 (SELECT Id, name,calculated_estimated_delivery_date__c,order_number__c,status__c,planned_ship_date__c,material_name__c,material_no__c, quantity_ordered__c, material_group__c From Order_Lines__r),
                          
                                 (SELECT invoices__r.invoice_no__c, CurrencyIsoCode,account__c,due_date__c,invoice_date__c,material_group__c,material_name__c,material_number__c,orders__c, order_lines__c, product_family__c,product_type__c,Id,Name,quantity__c, invoices__r.Name, invoices__r.status__c, invoices__r.invoice_value__c , invoices__r.due_date__c, invoices__r.number_of_days_past_due__c, invoices__r.invoice_date__c From Invoice_Lines__r)
                                  FROM orders__c where id=:ApexPages.currentPage().getParameters().get('id')];
     system.debug('-----tempacc-------'+tempacc);
     
     for(Integer i=0; i<tempacc.size() ; i++){
        List <order_lines__c> tempOrderLines = tempacc[i].order_lines__r;
        List <shipment_lines__c> tempShipmentLines = [SELECT Id,Name,Order_Number__c,Actual_Delivery_Date__c, estimated_delivery_date__c,Shipment_Number__r.name, Shipment_Number__r.carrrier_name__c, Shipment_Number__r.carrier_website__c,Shipment_Number__r.tracking_number__c,quantity_shipped__c, material_group__c,order_lines__c  From shipment_lines__c Where order_lines__c IN: tempacc[i].tempOrderLines];
        List <invoice_lines__c> tempInvoiceLines = tempacc[i].Invoice_Lines__r;
        
   //    uniqueInvoices.put(tempacc[i].id, tempInvoiceLines);   
               
         System.debug('temp order '+tempacc.size());
         System.debug('temp order lines'+tempOrderLines.size());
         System.debug('temp shipment lines'+tempShipmentLines.size());
         System.debug('temp invoice lines'+tempInvoiceLines.size());
         
         if(tempOrderLines.size()==0 ){/*&& tempShipmentLines.size()==0 && tempInvoiceLines.size()==0*/
                  singlegroup.add(new wrapgroupwise(tempacc[i],null,null,null)); 
            }
        else{
         
         if(tempShipmentLines.size()==0)
            {
              if(tempOrderLines[i].status__c=='Open')
               {
                   tempOrderLines[i].calculated_estimated_delivery_date__c=tempOrderLines[i].planned_ship_date__c;
               }
                                 
            singlegroup.add(new wrapgroupwise(tempacc[i],tempOrderLines,null,null)); 
                  
            }//if condition for tempShipmentLines size check    
         else
         {
         //Estimated Delivery Date done

           if(tempOrderLines[i].status__c=='Open')
           {
               tempOrderLines[i].calculated_estimated_delivery_date__c=tempOrderLines[i].planned_ship_date__c;
           }
           if(tempOrderLines[i].status__c=='Invoiced')
           {
               tempOrderLines[i].calculated_estimated_delivery_date__c=tempShipmentLines[i].estimated_delivery_date__c;
           }
           if(tempOrderLines[i].status__c=='Shipped but not billed')
           {
               tempOrderLines[i].calculated_estimated_delivery_date__c=tempShipmentLines[i].estimated_delivery_date__c;
           }           
         if(tempShipmentLines.size()==0)
         {
             singlegroup.add( new wrapgroupwise(tempacc[i],tempOrderLines,tempShipmentLines, null));
         }
             else{
                  singlegroup.add( new wrapgroupwise(tempacc[i],tempOrderLines,tempShipmentLines, tempInvoiceLines)); 
             }
          }//size check of temp shipping order  
         }
       }
    return singlegroup; 
   }
     public class wrapgroupwise
     {
        public List<order_lines__c> con {get;set;}
        public orders__c acc {get;set;}
        public List<shipment_lines__c> opp {get;set;}
        public List<invoice_lines__c> inv {get;set;}
    
         public wrapgroupwise( orders__c a , list<order_lines__c> c,list<shipment_lines__c> o, List<invoice_lines__c> i)
         {
            acc = a;
            con = c;
            opp = o;
            inv = i;
          } 
      } 

}
The visualforce:
<apex:page standardcontroller="orders__c" extensions="OrderTrackingList" sidebar="true" title="Order Tracking" showHeader="true">
    <!--Order details-->
    <apex:sectionheader title="Order" subtitle="Detail"/>
    <!--   <apex:form style="align-center:center;"> -->
         <apex:pageBlock >                   
             <apex:repeat value="{!StartHere}" var="gp">                              
                 <apex:pageblocksection title="Order Details" showheader="true" collapsible="true" columns="2">
                      <apex:outputText value="{!gp.acc.Orders__c}" />
                      <apex:outputText value="{!gp.acc.number_of_line_items__c}" label="Total Materials"/>
                      <apex:outputText value="{!gp.acc.customer_order_number__c}"  label="Customer PO Number"/>
                      <apex:outputText value="{!gp.acc.account__r.name}"/>
                      <apex:outputText value="{!gp.acc.CreatedDate}"/>
                 </apex:pageblocksection>     

                 <!--Order Line details-->
                 
                <apex:pageblocksection title="Order Lines" showheader="true" collapsible="true" columns="1">
                <!-- rendered="{!NOT(ISNULL(gp.con))}" -->        
                   
                  <apex:pageBlockTable value="{!gp.con}" var="p" border="9">          
               
                    <apex:column colspan="7" > 
                        <apex:facet name="header">#</apex:facet>
                        <!--<apex:outputLink value="/{!p.id}"><apex:outputText value="{!p.Name}"/></apex:outputLink>-->
                        <apex:outputLink value="/{!p.id}"><apex:outputText value="{!p.Name}"/></apex:outputLink>
                    </apex:column>
                     <apex:column >
                         <apex:facet name="header">Material Name</apex:facet>
                         <apex:outputText value="{!p.material_name__c}"/>
                     </apex:column>                    
                     <apex:column >
                         <apex:facet name="header">Material No.</apex:facet>
                         <apex:outputText value="{!p.material_no__c}"/>
                     </apex:column>
                     <apex:column >
                         <apex:facet name="header">Quantity</apex:facet>
                         <apex:outputText value="{!p.quantity_ordered__c}"/>
                     </apex:column>                                          
                     <apex:column >
                         <apex:facet name="header">Status</apex:facet>
                         <apex:outputText value="{!p.status__c}"/>
                     </apex:column>
                     <apex:column title="Customer Requested Delivery Date">
                         <apex:facet name="header">RDD</apex:facet>              
                          <apex:outputText value="{!IF(OR(p.material_group__c = 'K', p.material_group__c = 'KL', p.material_group__c = 'KC', p.material_group__c = 'E', p.material_group__c = 'E1', p.material_group__c = 'E2', p.material_group__c = 'E3', p.material_group__c = 'W4', p.material_group__c = 'EKC', p.material_group__c = 'EC', p.material_group__c = 'EMC') ,'Week Of {0, date, MM/d/yyyy}','{0, date, MM/d/yyyy}')}" rendered="{!gp.acc.requested_delivery_date__c!=null}">
                         <apex:param value="{!gp.acc.requested_delivery_date__c}" /> 
                        </apex:outputText>     
                     </apex:column>
                     <apex:column title="Estimated Delivery Date at time of Order">
                         <apex:facet name="header">EDD</apex:facet>              
                          <apex:outputText value="{!IF(OR(p.material_group__c = 'K', p.material_group__c = 'KL', p.material_group__c = 'KC', p.material_group__c = 'E', p.material_group__c = 'E1', p.material_group__c = 'E2', p.material_group__c = 'E3', p.material_group__c = 'W4', p.material_group__c = 'EKC', p.material_group__c = 'EC', p.material_group__c = 'EMC') ,'Week Of {0, date, MM/d/yyyy}','{0, date, MM/d/yyyy}')}" rendered="{!p.planned_ship_date__c!=null}">
                          <apex:param value="{!p.planned_ship_date__c}" />                            
                        </apex:outputText>    
                     </apex:column>  
                    
                                       
                     <apex:column breakBefore="true" colspan="12">
                  
                 <!--Shipment Line details-->                    
                     <apex:pageblocksection title="Shipment Informations" collapsible="true" columns="1" rendered="{!NOT(ISNULL(gp.opp))}" >
                        <apex:pageBlockTable value="{!gp.opp}" var="q" >
                       
                              <apex:column> 
                                     <apex:facet name="header">Shipment Lines</apex:facet>
                                     <apex:outputLink value="/{!q.id}"><apex:outputText value="{!q.Name}"/></apex:outputLink>
                              </apex:column> 
                              <apex:column>
                                     <apex:facet name="header">Quantity Shipped</apex:facet>
                                     <apex:outputText value="{!q.quantity_shipped__c}"/>
                              </apex:column>  
                              <apex:column >
                                   <apex:facet name="header">Carrier Name</apex:facet>
                                   <apex:outputText value="{!q.Shipment_Number__r.carrrier_name__c}"/>
                              </apex:column>   
                              <apex:column >
                                  <apex:facet name="header">Carrier Website</apex:facet>
                                  <apex:outputLink value="{!q.Shipment_Number__r.carrier_website__c}" ><apex:outputText value="{!q.Shipment_Number__r.carrier_website__c}"/></apex:outputLink>
                              </apex:column>    
                              <apex:column >
                                  <apex:facet name="header">Tracking Number</apex:facet>
                                  <apex:outputText value="{!q.Shipment_Number__r.tracking_number__c}"/>
                              </apex:column>
                                                                               
                             <apex:column title="Estimated Delivery Date at the time of Shipment">
                                  <apex:facet name="header">Est Deliv Date</apex:facet>              
                                  <apex:outputText value="{!IF(OR(p.material_group__c = 'K', p.material_group__c = 'KL', p.material_group__c = 'KC', p.material_group__c = 'E', p.material_group__c = 'E1', p.material_group__c = 'E2', p.material_group__c = 'E3', p.material_group__c = 'W4', p.material_group__c = 'EKC', p.material_group__c = 'EC', p.material_group__c = 'EMC') ,'Week Of {0, date, MM/d/yyyy}','{0, date, MM/d/yyyy}')}" rendered="{!q.estimated_delivery_date__c!=null}">
                                  <apex:param value="{!q.estimated_delivery_date__c}" /> 
                                  </apex:outputText> 
                             </apex:column>     
                             <apex:column >
                                  <apex:facet name="header" >Actual Delivery Date</apex:facet>              
                                  <apex:outputText value="{!IF(OR(p.material_group__c = 'K', p.material_group__c = 'KL', p.material_group__c = 'KC', p.material_group__c = 'E', p.material_group__c = 'E1', p.material_group__c = 'E2', p.material_group__c = 'E3', p.material_group__c = 'W4', p.material_group__c = 'EKC', p.material_group__c = 'EC', p.material_group__c = 'EMC') ,'Week Of {0, date, MM/d/yyyy}','{0, date, MM/d/yyyy}')}"  rendered="{!q.Actual_Delivery_Date__c!=null}">
                                  <apex:param value="{!q.Actual_Delivery_Date__c}"/> 
                                  </apex:outputText> 
                             </apex:column>  
                       </apex:pageBlockTable>
                       </apex:pageblocksection>   
                       </apex:column>     
                     
                    </apex:pageBlockTable>
 
                 </apex:pageblocksection>
           <!--Invoice Line details -->

                <apex:pageblocksection title="Invoice Details" showheader="true" collapsible="true" columns="1" >
                    <apex:pageBlockTable value="{!gp.inv}" var="i">   
                    <apex:column colspan="7"> 
                        <apex:facet name="header">Invoice No.</apex:facet>
                        <apex:outputLink value="/apex/InvoiceList?id={!i.invoices__r.id}"><apex:outputText value="{!i.invoices__r.invoice_no__c}"/></apex:outputLink>
                    </apex:column>  
                    <apex:column >
                        <apex:facet name="header">Status</apex:facet>
                        <apex:outputText value="{!i.invoices__r.status__c}"/>
                    </apex:column>        
                    <apex:column >
                        <apex:facet name="header">Invoice Value</apex:facet>
                        <apex:outputText value="{!i.invoices__r.invoice_value__c}"/>
                    </apex:column>  
                    <apex:column >
                        <apex:facet name="header">Due Date</apex:facet>
                        <apex:outputText value="{0, date, MM/d/yyyy}"> 
                        <apex:param value="{!i.invoices__r.due_date__c}"/>
                        </apex:outputText>  
                    </apex:column>     
                    <apex:column >
                     <apex:facet name="header">Invoice Date</apex:facet>   
                        <apex:outputText value="{0, date, MM/d/yyyy}"> 
                        <apex:param value="{!i.invoices__r.invoice_date__c}"/>
                        </apex:outputText>  
                    </apex:column>  
                    </apex:pageBlockTable>                 
                 </apex:pageblocksection>
                 
             </apex:repeat>             
             </apex:pageBlock>

    <!-- </apex:form>  -->
 </apex:page>

 Any help would be great. Thanks

 
  • December 03, 2014
  • Like
  • 0
public without sharing class vf_OpptyClone extends vc_ControllerBase
{
    public Opportunity oppor{get;set;}
    {oppor=new Opportunity();}
    public List<String> filters{get;set;}
    public static boolean isOpptyClone = false;
    public Boolean flag{get;set;}
    public String pgeMsg{get;set;}
    public Boolean display{get;set;}
    public Boolean selected{get;set;}
    public Boolean interim{get;set;}
    private static Savepoint sp;
    private static Savepoint spoppty;
    public list<ChildRecordSelection> childRecords{get;set;}
    private Set<String> selectedRecords;
    public Map<String,String> records;
    private static list<OpportunityTeamMember> opporTeam= new list<OpportunityTeamMember>();
    Map<String,String> oppTeam = new Map<String,String>();//added mnz
    private set<string> users = new set<string>();
    private Boolean rolledBack;
    public vf_OpptyClone(ApexPages.StandardController controller)
    {
        oppor = (Opportunity)controller.getRecord();
        oppor.RecordTypeId=System.Label.myversion13SLS16;
        oppor.OpportunitySource__c=System.Label.myversion13SLS04;             
        system.debug('opportunity'+oppor);
        filters = new List<String>();
        display=true;
        interim=false;
        if(oppor.OpptyType__c!=null)
        {
            filters.add(oppor.OpptyType__c);
        }
    }
    //Establish component controller communication
    // public VCC05_DisplaySearchFields searchController
    // {
    //     set;
    //     get
    //     {
    //         if(getcomponentControllerMap()!=null)
    //         {
    //             VCC05_DisplaySearchFields displaySearchFields;
    //             displaySearchFields = (VCC05_DisplaySearchFields)getcomponentControllerMap().get('searchComponent');
    //             system.debug('--------displaySearchFields-------'+displaySearchFields );
    //             if(displaySearchFields!= null)
    //             return displaySearchFields;
    //         }
    //         return new VCC05_DisplaySearchFields();
    //     }
    // }
    //checks if the logged in user has access to clone the record
    public pageReference cloneOpportunity()
    {
         flag = true; // Boolean to flag if the current user can create an opportunity
         System.debug('>>>>>cloneOpportunity got called');
         // Retrieve the Describe sObject Result for Opportunity
         Schema.DescribeSObjectResult opportunitySobject = Opportunity.SObjectType.getDescribe();
         
         // If the current user cannot create opportunities
         if(!opportunitySobject.isCreateable())
         {
              flag = false;

             ApexPages.addMessage(new ApexPages.message(ApexPages.severity.Error,label.CL00563));
             //End Of Update
         }
        
         else{ 
         
         ApexPages.addMessage(new ApexPages.message(ApexPages.severity.info,'Only Active users, if any, will be cloned .'));
         }
         //Map<String, Schema.SObjectField> M = Schema.SObjectType.Opportunity.fields.getMap();
         
         // Map<String, Schema.SObjectField> M = Schema.SObjectType.Opportunity.fields.getMap();        
        if(flag)
        {
            sp = Database.setSavepoint(); //created a savepoint for roll back
            if(oppor.CloseDate<system.today())
            oppor.CloseDate = system.today();            
            Database.saveResult sv = Database.update(oppor,false); //updating the existing opportunity
            Database.rollback(sp); //rolling back in case of any exception
            if(!sv.issuccess())
            {
                ApexPages.addMessage(new ApexPages.message(ApexPages.severity.Error,sv.getErrors()[0].getMessage()));
                flag= false;
            }
        }
         System.debug('cloneOpportunity Method Ends');
         return null;
    }
    //queries the share Object for Opprtunity Team members
    public list<OpportunityTeamMember> oppShare()
    {
        system.debug('oppShare Method Begins');
        String opportunityTeamQuery = CS005_Queries__c.getValues('CS005_12').StaticQuery__c+' '+ 'where (OpportunityAccessLevel =\''+ label.CL00203 +'\' or UserId =\''+oppor.ownerID+'\')and opportunityID=\''+oppor.id+'\''+ 'and User.IsActive=true'; //Querying OpportunityTeam fields.
        System.debug('mylogs_team query string>>>'+opportunityTeamQuery);
        list<OpportunityTeamMember> oppteam = Database.Query(opportunityTeamQuery);
         
         System.debug('mylogs_team list>>>'+oppteam);
        if(oppteam!=null && !oppteam.isEmpty())
           return oppteam;
        else
           return new list<OpportunityTeamMember>();
      
    }
      
    //checks if the user has selected an appropriate stage and type.
    Public pagereference proceedChildSelection()
    {
        system.debug('proceedChildSelection Method Begins');
            // if((searchController.level1.equalsIgnoreCase(Label.CL00355))||(searchController.level2.equalsIgnoreCase(Label.CL00355)))
            // {
            //    ApexPages.addMessage(new ApexPages.message(ApexPages.severity.Error,Label.CL00650));
            // }
            // else
            // {
                display=false;
                getchildRecords();
            // }
        System.debug('proceedChildSelection Method Ends');
        return null;
    }
    //selection of child records to clone
    public pageReference proceedClone()
    {
        system.debug('proceedClone Method Begins');
        interim=true;
        ApexPages.addMessage(new ApexPages.message(ApexPages.severity.info,Label.CL00648));
        selectedRecords = new Set<String>();
        if(!childRecords.isEmpty() && childRecords!=null)
        {
            for(ChildRecordSelection childSelected:childRecords)
            {
                if(childSelected.selected==true)
                {
                    selectedRecords.add(childSelected.records);
                }
            }
        }
                System.debug('mylogs_child selected'+selectedRecords);
        System.debug('proceedClone Method Ends');
        return null;
    }
    //cloning the opportunity record with selected child records.
    public pageReference continueClone()
    {
        spoppty = Database.setSavepoint();
        rolledBack=false;
        system.debug('continueClone Method Begins');                    
        String query1 = Utils_Methods.generateSelectAllQuery(oppor);
        String query2 = ' '+'where id =\''+oppor.id+'\'';
        String query = query1 + query2;
                        system.debug('mylogs_continue has query>>>'+query);  
        List<opportunity> currentRecords = Database.Query(query);
                system.debug('mylogs_continue has currentRecords>>>'+currentRecords);  
        Opportunity clonedOpportunity = new Opportunity();
        list<Id> insertRecordId = new List<Id>();
        if(currentRecords!=null && !currentRecords.isEmpty())
        {
            //JFA: test modif ".clone"
            clonedOpportunity = currentRecords[0].clone();
            //clonedOpportunity = currentRecords[0];
            // End modif
            clonedOpportunity.OpptyType__c=oppor.OpptyType__c;
            clonedOpportunity.StageName=oppor.StageName;
            clonedOpportunity.OpportunitySource__c=oppor.OpportunitySource__c;
            clonedOpportunity.TECH_TriggerVR__c = false;
            clonedOpportunity.OpportunityScope__c= NULL;                    
            clonedOpportunity.ActualQualification__c=NULL;
            clonedOpportunity.ActualQuoteInvestDecision__c=NULL;
            clonedOpportunity.ActualQuoteSubmitDecision__c=NULL;
            clonedOpportunity.PlannedQualification__c=NULL;
            clonedOpportunity.PlannedQuoteInvestDecision__c=NULL;
            clonedOpportunity.PlannedQuoteSubmitDecision__c=NULL;
            clonedOpportunity.QuoteIssuanceDateToCustomer__c=NULL;
            clonedOpportunity.QuoteSubmissionDate__c=NULL;
            clonedOpportunity.Status__c = NULL;
            clonedOpportunity.Reason__c = NULL;                    
            //clonedOpportunity.BusinessMix__c=NULL;
            clonedOpportunity.CloseDate = system.today();
            clonedOpportunity.TECH_CreatedFromLead__c = False;
            system.debug('#### NewOpp Old OwnnerID '+clonedOpportunity.OwnerId);
            clonedOpportunity.OwnerId = UserInfo.getUserId();
            system.debug('#### NewOpp New OwnnerID '+clonedOpportunity.OwnerId);
            clonedOpportunity.OpportunityDetector__c = UserInfo.getUserId();
            clonedOpportunity.TECH_CrossProcessConversionAmount__c= null;
            clonedOpportunity.Amount=0;
            clonedOpportunity.ProjectCategoryP0__c = NULL;
            clonedOpportunity.ProjectCategoryS0__c = NULL;
            clonedOpportunity.ProjectCategoryS1__c = NULL;
            //modif JFA proba
            clonedOpportunity.probability = null;
            //end of modif    
            if(((currentRecords[0].name).length()+label.CL00651.length())<120)
                clonedOpportunity.name=currentRecords[0].name+label.CL00651;
            else
            {
                clonedOpportunity.name=currentRecords[0].name.substring(0,((currentRecords[0].name).length()-(((currentRecords[0].name).length()+label.CL00651.length())-120)))+label.CL00651;
            }

            if(oppor.OpptyType__c!=clonedOpportunity.OpptyType__c)
                clonedOpportunity.OpportunityScope__c=null;            //Blank out the Opportunity Scope if the user selected Opportunity type(during cloning) is not same as the Master Opportunity Type 
                    //End of Modification
            clonedOpportunity.TECH_SendEmailOnLeadConv__c=false;
        }
        if(clonedOpportunity!=null)
        {
            System.debug('#### Inserting new Opp');
            isOpptyClone = true;
            Database.saveResult sv = Database.insert(clonedOpportunity,false); //inserting the cloned opportunity
            System.debug('#### New Opp inserted: '+clonedOpportunity.id);
            if(!sv.issuccess())
            {
                System.debug('#### Error');
                rolledBack=true;
                pgeMsg = sv.getErrors()[0].getMessage();
                System.debug('### Error:'+ pgeMsg);
                pgeMsg += 'Case 1';
            }                    
        }
        if(!rolledBack)
        {
            System.debug('#### Continue - next is SalesContributor');
            System.debug('#### Selected records: '+selectedRecords);
            // SalesContributor was not checked by the user, so adding the current user to Sales Contributor with 100% contribution
        
            System.debug('#### Selected records: '+selectedRecords);
            if(!rolledBack && selectedRecords!=null && !selectedRecords.isEmpty() && selectedRecords.contains(sObjectType.OPP_SalesContributor__c.label))
            {
                System.debug('#### SalesContributor was checked by the user, so adding the Sales Contributors list as on the original opportunity');
                String querySales1 = Utils_Methods.generateSelectAllQuery(new OPP_SalesContributor__c());
                String querySales2 = ' '+'where Opportunity__c =\''+oppor.id+'\'';
                String querySales = querySales1 + querySales2;
                System.debug('#### SalesContributor query: '+querySales);
                List<OPP_SalesContributor__c> currentContributors = Database.Query(querySales);
                list<OPP_SalesContributor__c> salescontributors =  new list<OPP_SalesContributor__c>();
                for(OPP_SalesContributor__c contributors : currentContributors)
                {
                    OPP_SalesContributor__c contribut = new  OPP_SalesContributor__c();
                    contribut = contributors.clone(false);
                    contribut.Opportunity__c = clonedOpportunity.id;
                    contribut.TECH_IsCloned__c=true;
                    salescontributors.add(contribut);
                }
                if(salescontributors!=null && !salescontributors.isEmpty())
                {
                    //inserting records in OpportunityShare
                    try
                    {
                        Utils_Methods.insertRecords(salescontributors);
                        selectedRecords.remove(sObjectType.OPP_SalesContributor__c.label);
                    }
                    catch(Exception e)
                    {
                        rolledBack= true;
                        pgeMsg=e.getMessage();
                    }
                }
            }
            System.debug('#### Selected records: '+selectedRecords);
            if(!rolledBack && selectedRecords!=null && !selectedRecords.isEmpty())
            {
                //getting the child relationships
                List<Schema.ChildRelationship> allchildRecords = oppor.getSobjectType().getDescribe().getChildRelationships();
                List<Schema.ChildRelationship> childRecordsToClone = new List<Schema.ChildRelationship>();
                list<OpportunityShare> clonedOpportunityShare = new list<OpportunityShare>();
                Map<string,Schema.ChildRelationship> relations = new Map<string,Schema.ChildRelationship>();
                if(!allchildRecords.isEmpty() && allchildRecords!=null)
                {
                    for(Schema.ChildRelationship child : allchildRecords)
                    {
                        relations.put(String.ValueOf(child.getChildSObject()),child);
                    }
                    System.debug('#### relations: '+relations);
                    Boolean oppLineSel  = false;
                    Boolean vcpSel  = false;
                    for(string selected:selectedRecords)
                    {
                        if(!((selected == sObjectType.OPP_ProductLine__c.label) || (selected == sObjectType.OPP_ValueChainPlayers__c.label)))
                        {
                            childRecordsToClone.add(relations.get(records.get(selected)));
                        }
                        if(selected == sObjectType.OPP_ProductLine__c.label)
                            oppLineSel = true;
                        if(selected == sObjectType.OPP_ValueChainPlayers__c.label)
                            vcpSel = true;
                    }
                    if(vcpSel == true)
                    {
                        system.debug('Cloning of Value chain player begins');
                        OPP_ValueChainPlayers__c vcp=new OPP_ValueChainPlayers__c(); 
                        List<OPP_ValueChainPlayers__c> newParentVCPlist = new List<OPP_ValueChainPlayers__c>();
                        String vcpQuery1 = Utils_Methods.generateSelectAllQuery(vcp);
                        String vcpquery2 = ' '+'where OpportunityName__c =\''+oppor.id+'\' AND ParentValueChainPlayer__c = '+NULL+' AND Tobedeleted__c = '+FALSE;
                        String vcpquery = vcpQuery1 + vcpquery2;
                        System.debug('VCPLinequery>>>>'+vcpquery);
                        List<OPP_ValueChainPlayers__c> existingVCPs = Database.Query(vcpquery);
                        for(OPP_ValueChainPlayers__c oldVCP: existingVCPs)
                        {
                            vcp = oldVCP.clone(false, true);
                            vcp.OpportunityName__c = clonedOpportunity.Id;
                            newParentVCPlist.add(vcp);
                        }
                        try{
                            Database.insert(newParentVCPlist,true);
                       }
                       Catch(Exception e){
                           rolledBack= true;
                           pgeMsg=e.getMessage();
                       }
                    }
                    System.debug('#### childRecordsToClone: '+childRecordsToClone);
                    if(oppLineSel ==true)
                    {
                        system.debug('Cloning of Product Line Begins');
                        Map<Id, Id> oldNewProdLines = new Map<Id, Id>();
                        List<OPP_ProductLine__c> oldParentLines = new List<OPP_ProductLine__c>();
                        List<OPP_ProductLine__c> newParentLines = new List<OPP_ProductLine__c>();
                        Map<Id, Id> childParentLne = new Map<Id, Id>(); 
                        OPP_ProductLine__c pl=new OPP_ProductLine__c(); 
                        String productLineQuery1 = Utils_Methods.generateSelectAllQuery(pl);
                        String productLinequery2 = ' '+'where Opportunity__c =\''+oppor.id+'\''+' AND LineStatus__c!=\'To be deleted\' AND LineType__c=\'Parent Line\'';
                        String productLinequery = productLineQuery1 + productLinequery2;
                        System.debug('productLinequery>>>>'+productLinequery);
                        List<OPP_ProductLine__c> oldProdLines = Database.Query(productLinequery);
                        
                        /* List<OPP_ProductLine__c> oldProdLines = [select Id, IsDeleted, Name, CurrencyIsoCode, RecordTypeId, CreatedDate, CreatedById, LastModifiedDate, LastModifiedById, SystemModstamp, MayEdit, IsLocked, Opportunity__c, Amount__c, DeliveryDate__c, Designation__c, Product__c, Quantity__c, TECH_AmountInNumber__c, Type__c, UnitForQuantity__c, BusbarArrangement__c, BusbarCurrent__c, ControlMonitoring__c, HighestVoltageLevel__c, PLContact__c, ShortRatedCurrent__c, SupplyingPlant__c, TotalMVA__c, UnitaryPowerEachTransformerMVA__c, VoltageLevel__c, CheckedbyGMR__c, CommercialReference__c, Family__c, ProductBU__c, ProductDescription__c, ProductFamily__c, ProductLine__c, TECH_CommercialReference__c, Specified__c, IsASynergy__c, SolutionCenter__c, Commission__c, ConcatenatedID__c, ConfigurationID__c,  CrossSellingLineAmount__c, CrossSellingLineWeighted__c, ITBRevenueLineIdOld__c, ITBRevenueLineNoOld__c, IncludedinForecast__c, IncludeinQuote__c, IsACrossSellingOpptyLine__c, IsALevel2__c, IsAdvancedServices__c, IsaLevel3memberopptyLine__c, LegacyLineId__c,  LineAmount__c, LineClosedate__c, LineStatus__c, LineType__c,  LowestLevelInPyramid__c, Lowestlevelvalue__c, OpportunityLeader__c, OpportunitySEReferenceNumber__c,
                         OverlayRevenueITB__c, ParentLine__c, Probability__c, PurchaseOrderNumber__c, RevenueOverride__c, SalesOrderNumber__c, SmartInfraType__c, TECH_IntouchQuoteLineRowId__c, TECH_IntouchQuoteRowId__c, TECH_IsACrossSellingOpptyLine__c, TECH_LegacyLastUpdateDate__c, TECH_OpportunityClosedDate__c, WeightedAmount__c from OPP_ProductLine__c where Opportunity__c =:oppor.Id ];

                        for(OPP_ProductLine__c prodLine: oldProdLines)
                        {
                            //Inserts all the Parent Lines
                            if(prodLine.ParentLine__c == null)
                            {
                                OPP_ProductLine__c pl = prodLine.clone(false, true);
                                pl.Opportunity__c = clonedOpportunity.Id;
                                insert pl;                           
                                oldNewProdLines.put(prodLine.Id, pl.Id);                                                         
                            }
                            //Collects the Child & Parent Lines
                            if(prodLine.ParentLine__c!=null)
                            {
                                childParentLne.put(prodLine.Id, prodLine.ParentLine__c);
                            }
                                                         
                        }
                        for(OPP_ProductLine__c prodLine: oldProdLines)
                        {
                            //Inserts the Child Line
                            if(prodLine.ParentLine__c != null)
                            {
                                OPP_ProductLine__c pl = prodLine.clone(false, true);
                                pl.ParentLine__c = oldNewProdLines.get(childParentLne.get(prodLine.Id));
                                pl.Opportunity__c = clonedOpportunity.Id;                               
                                insert pl;
                                oldNewProdLines.put(prodLine.Id, pl.Id);                                                         
                            }
                        }*/
                        for(OPP_ProductLine__c prodLine: oldProdLines)
                        {
                            pl = prodLine.clone(false, true);
                            pl.Opportunity__c = clonedOpportunity.Id;
                            pl.Designation__c = NULL;
                            pl.LineStatus__c = System.Label.myversion13PRM20;//Pending Status
                            pl.SolutionCenter__c = NULL;
                            pl.DeliveryDate__c = NULL;
                            pl.LineClosedate__c = clonedOpportunity.CloseDate;
                            pl.PLContact__c = NULL;
                            pl.IsASynergy__c = FALSE;
                            pl.NumberofPoints__c = NULL;
                            pl.PurchaseOrderNumber__c = NULL;
                            pl.SalesOrderNumber__c = NULL;
                            pl.RevenueOverride__c = NULL;
                            pl.Commission__c = NULL;
                            pl.Probability__c = NULL;
                            //pl.IncludeinQuote__c = FALSE; 
                            pl.IncludedinForecast__c =  System.Label.CL00274; //Value "No" is set for cloned Line item 
                            pl.ITBRevenueLineNoOld__c =  NULL;
                            pl.TECH_IntouchQuoteLineRowId__c = NULL;
                            pl.SmartInfraType__c = NULL;
                            pl.OverlayRevenueITB__c = 0;
                            pl.LegacyLineId__c = NULL;
                            pl.TECH_IntouchQuoteRowId__c = NULL;
                            pl.ITBRevenueLineIdOld__c = NULL;
                            pl.TECH_LegacyLastUpdateDate__c = NULL;
                            pl.TECH_2014ReferentialUpdated__c = FALSE;
                            newParentLines.add(pl);
                        }
                        try{
                            insert newParentLines;
                       }
                       Catch(Exception e){
                           Database.rollback(spoppty);//Rollback to the Savepoint
                           rolledBack= true;
                           pgeMsg=e.getMessage();
                       }
                    }
                    if(!childRecordsToClone.isEmpty() && childRecordsToClone!=null)
                    {
                        //inserting child records
                        Map<Sobject, SObject> childmap = new Map<Sobject, SObject>();
                        list<sObject> childobj = new list<sObject>();
                        childmap =  Utils_Methods.cloneChildRecords(oppor.id,clonedOpportunity.id,childRecordsToClone);
                        System.debug('#### childmap: '+childmap);
                        if(childmap.size()>0)
                        {
                            for(sObject obj : childmap.values())
                            {
                                if(obj!=null)
                                {
                                     childobj.add(obj);
                                }
                            }
                        }
                        System.debug('#### childobj: '+childobj);
                        if(childobj!=null && !childobj.isEmpty())
                        {
                            if(insertRecordId!=null)
                            insertRecordId.clear();
                            try
                            {
                                System.debug('#### Going to insert child objects: '+childobj);
                                insertRecordId = Utils_Methods.insertRecords(childobj);
                                System.debug('#### Child objects inserted: '+childobj);
                            }
                            catch(Exception e)
                            {
                                rolledBack= true;
                                pgeMsg=e.getMessage();
                                System.debug('#### Error - Child object insertion failed: '+e.getMessage());
                                System.debug('#### Error - Child object insertion failed: '+e);
                            }
                            if(!rolledBack && selectedRecords.contains(Label.CL00661))
                            {
                                System.debug('#### Processing opp share');
                                for(OpportunityTeamMember share: oppShare())
                                {
                                    if (share.userId != clonedOpportunity.ownerId) 
                                    {
                                        OpportunityShare oppShare = new OpportunityShare();                                     
                                        oppShare.opportunityId = clonedOpportunity.id;
                                        oppShare.userOrGroupId = share.userId;
                                        oppShare.OpportunityAccessLevel = label.CL00203;
                                        clonedOpportunityShare.add(oppShare);
                                        system.debug(clonedOpportunityShare+'ssss');
                                    }
                                    else {
                                         System.debug('#### Do not add the new opp owner . He has been added previously');
                                    }
                                }
                                if(clonedOpportunityShare!=null && !clonedOpportunityShare.isEmpty())
                                {
                                    //inserting records in OpportunityShare
                                    try
                                    {
                                        System.debug('#### Going to insert opp share (clonedOpportunityShare): '+clonedOpportunityShare);
                                        Utils_Methods.insertRecords(clonedOpportunityShare);
                                        System.debug('#### Opp share inserted');
                                    }
                                    catch(Exception e)
                                    {
                                        rolledBack= true;
                                        pgeMsg=e.getMessage();
                                        System.debug('#### Error - Child object insertion failed: '+e.getMessage());
                                        System.debug('#### Error - Child object insertion failed: '+e);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        System.debug('continueClone Method Ends');
        if(rolledBack)
        {                         
            ApexPages.addMessage(new ApexPages.message(ApexPages.severity.Error,pgeMsg));
            flag = false;
            return null;
        }
        else
        {                
            //clonedOpportunity.TECH_TriggerVR__c = true;
            Opportunity newClonedOpportunity=new Opportunity(Id=clonedOpportunity.Id,TECH_TriggerVR__c=true);                    
            Database.saveResult sv = Database.update(newClonedOpportunity,false); //updating the cloned opportunity
            if(!sv.issuccess())
            {                        
                ApexPages.addMessage(new ApexPages.message(ApexPages.severity.Error,sv.getErrors()[0].getMessage()));
                flag= false;
                return null;
            }
        }                
        return new pagereference('/'+clonedOpportunity.id+'/e?'+Label.CL00330+'=%2F'+clonedOpportunity.id);
    }

    public list<ChildRecordSelection> getchildRecords()
    {
        system.debug('getchildRecords Method Begins');
        records =new Map<String,String>();
        records.put(Label.CL00661,'OpportunityTeamMember');
        records.put(sObjectType.OPP_SalesContributor__c.label,'OPP_SalesContributor__c');
        records.put(sObjectType.OPP_ProductLine__c.label,'OPP_ProductLine__c');
        records.put(sObjectType.OPP_ValueChainPlayers__c.label,'OPP_ValueChainPlayers__c');
        records.put(sObjectType.OPP_OpportunityCompetitor__c.label,'OPP_OpportunityCompetitor__c');
        childRecords = new list<ChildRecordSelection>();
        for(String rec:records.Keyset())
        {
            childRecords.add(new ChildRecordSelection(rec));
        }
        System.debug('getchildRecords Method Ends');
        return childRecords;
    }

    Public class ChildRecordSelection
    {
        public string records{get;set;}
        public Boolean selected{get; set;}
        public ChildRecordSelection(String rec)
        {
            system.debug('ChildRecordSelection Class Begins');
            records = rec;
            if(records.equalsIgnoreCase(Label.CL00661)||records.equalsIgnoreCase(sObjectType.OPP_ValueChainPlayers__c.label)||records.equalsIgnoreCase(sObjectType.OPP_ProductLine__c.label))
                 selected = true;
            else
                 selected = false;
            System.debug('ChildRecordSelection Class Ends');
        }
    }
}

ERROR: Error:
Insert failed. First exception on row 2; first error: INACTIVE_OWNER_OR_USER, owner or user is inactive.: []
I'm trying to create an account using actionFunction and display the result in the same page. I have tried successfully the "sayHello" example in http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_actionFunction.htm . But it's not helping me to build this application. Can anyone guide me through this? Any reference would be helpful. Thanks
Following is what I tried...
java -DcompileTarget=1.5 -classpath "C:\Program Files\Java\jdk1.7.0_55\lib\tools.jar;c:\salesforce\force-wsc-29.0.0.jar" com.sforce.ws.tools.wsdlc c:\salesforce\wsdl\enterprise.wsdl c:\salesforce\jar\enterprise.jar

Please guide thanks.
I mean,I know what is a workflow and an approval process. But how do I compare them? Please guide. Thanks!
          Is there any particular syntax I should follow like in stackoverflow? How do i post code in this forum?
  • April 15, 2014
  • Like
  • 0
Here I'm trying to display grandchild, child of a parent record. ORDER is the parent, order line is the child and shipment lines is the grandchild. I'm trying to display all of them in a nested table. So far I'm successful in displaying order lines for a single ORDER, but I'm messing up with the related shipment lines.

The controller
 
public class GE_PW_OrderTrackingList{
    public GE_PW_OrderTrackingList(ApexPages.StandardController controller) {

    }

    public list<wrapgroupwise> singlegroup;
  //  Map <String, Invoices__c> uniqueInvoices = new Map <String, Invoices__c>();
    public List<wrapgroupwise> getStartHere(){
    singlegroup= new List<wrapgroupwise>();
    List<order_lines__c> temol= [SELECT Id, name,calculated_estimated_delivery_date__c,order_number__c,status__c,planned_ship_date__c,material_name__c,material_no__c, quantity_ordered__c, material_group__c,(SELECT Id,Name,Order_Number__c,Actual_Delivery_Date__c, estimated_delivery_date__c,Shipment_Number__r.name, Shipment_Number__r.carrrier_name__c, Shipment_Number__r.carrier_website__c,Shipment_Number__r.tracking_number__c,quantity_shipped__c, material_group__c,order_lines__c  From shipment_lines__r ) From order_lines__c where number_of_order_lines__c=:ApexPages.currentPage().getParameters().get('id')];
    
    List<orders__c> tempacc=[SELECT Orders__c,CreatedBy.FirstName,CreatedDate, number_of_line_items__c, CurrencyIsoCode,account__r.name,contract__r.ContractNumber,customer_order_number__c,invoices__c,my_view__c,order_acknowlegment__c,order_date__c,order_value__c, order_no__c, requested_delivery_date__c,shipments__c,Id,Name,
                                 (SELECT Id, name,calculated_estimated_delivery_date__c,order_number__c,status__c,planned_ship_date__c,material_name__c,material_no__c, quantity_ordered__c, material_group__c From Order_Lines__r),
                          
                                 (SELECT invoices__r.invoice_no__c, CurrencyIsoCode,account__c,due_date__c,invoice_date__c,material_group__c,material_name__c,material_number__c,orders__c, order_lines__c, product_family__c,product_type__c,Id,Name,quantity__c, invoices__r.Name, invoices__r.status__c, invoices__r.invoice_value__c , invoices__r.due_date__c, invoices__r.number_of_days_past_due__c, invoices__r.invoice_date__c From Invoice_Lines__r)
                                  FROM orders__c where id=:ApexPages.currentPage().getParameters().get('id')];
     system.debug('-----tempacc-------'+tempacc);
     
     for(Integer i=0; i<tempacc.size() ; i++){
        List <order_lines__c> tempOrderLines = tempacc[i].order_lines__r;
        List <shipment_lines__c> tempShipmentLines = [SELECT Id,Name,Order_Number__c,Actual_Delivery_Date__c, estimated_delivery_date__c,Shipment_Number__r.name, Shipment_Number__r.carrrier_name__c, Shipment_Number__r.carrier_website__c,Shipment_Number__r.tracking_number__c,quantity_shipped__c, material_group__c,order_lines__c  From shipment_lines__c Where order_lines__c IN: tempacc[i].tempOrderLines];
        List <invoice_lines__c> tempInvoiceLines = tempacc[i].Invoice_Lines__r;
        
   //    uniqueInvoices.put(tempacc[i].id, tempInvoiceLines);   
               
         System.debug('temp order '+tempacc.size());
         System.debug('temp order lines'+tempOrderLines.size());
         System.debug('temp shipment lines'+tempShipmentLines.size());
         System.debug('temp invoice lines'+tempInvoiceLines.size());
         
         if(tempOrderLines.size()==0 ){/*&& tempShipmentLines.size()==0 && tempInvoiceLines.size()==0*/
                  singlegroup.add(new wrapgroupwise(tempacc[i],null,null,null)); 
            }
        else{
         
         if(tempShipmentLines.size()==0)
            {
              if(tempOrderLines[i].status__c=='Open')
               {
                   tempOrderLines[i].calculated_estimated_delivery_date__c=tempOrderLines[i].planned_ship_date__c;
               }
                                 
            singlegroup.add(new wrapgroupwise(tempacc[i],tempOrderLines,null,null)); 
                  
            }//if condition for tempShipmentLines size check    
         else
         {
         //Estimated Delivery Date done

           if(tempOrderLines[i].status__c=='Open')
           {
               tempOrderLines[i].calculated_estimated_delivery_date__c=tempOrderLines[i].planned_ship_date__c;
           }
           if(tempOrderLines[i].status__c=='Invoiced')
           {
               tempOrderLines[i].calculated_estimated_delivery_date__c=tempShipmentLines[i].estimated_delivery_date__c;
           }
           if(tempOrderLines[i].status__c=='Shipped but not billed')
           {
               tempOrderLines[i].calculated_estimated_delivery_date__c=tempShipmentLines[i].estimated_delivery_date__c;
           }           
         if(tempShipmentLines.size()==0)
         {
             singlegroup.add( new wrapgroupwise(tempacc[i],tempOrderLines,tempShipmentLines, null));
         }
             else{
                  singlegroup.add( new wrapgroupwise(tempacc[i],tempOrderLines,tempShipmentLines, tempInvoiceLines)); 
             }
          }//size check of temp shipping order  
         }
       }
    return singlegroup; 
   }
     public class wrapgroupwise
     {
        public List<order_lines__c> con {get;set;}
        public orders__c acc {get;set;}
        public List<shipment_lines__c> opp {get;set;}
        public List<invoice_lines__c> inv {get;set;}
    
         public wrapgroupwise( orders__c a , list<order_lines__c> c,list<shipment_lines__c> o, List<invoice_lines__c> i)
         {
            acc = a;
            con = c;
            opp = o;
            inv = i;
          } 
      } 

}
The visualforce:
<apex:page standardcontroller="orders__c" extensions="OrderTrackingList" sidebar="true" title="Order Tracking" showHeader="true">
    <!--Order details-->
    <apex:sectionheader title="Order" subtitle="Detail"/>
    <!--   <apex:form style="align-center:center;"> -->
         <apex:pageBlock >                   
             <apex:repeat value="{!StartHere}" var="gp">                              
                 <apex:pageblocksection title="Order Details" showheader="true" collapsible="true" columns="2">
                      <apex:outputText value="{!gp.acc.Orders__c}" />
                      <apex:outputText value="{!gp.acc.number_of_line_items__c}" label="Total Materials"/>
                      <apex:outputText value="{!gp.acc.customer_order_number__c}"  label="Customer PO Number"/>
                      <apex:outputText value="{!gp.acc.account__r.name}"/>
                      <apex:outputText value="{!gp.acc.CreatedDate}"/>
                 </apex:pageblocksection>     

                 <!--Order Line details-->
                 
                <apex:pageblocksection title="Order Lines" showheader="true" collapsible="true" columns="1">
                <!-- rendered="{!NOT(ISNULL(gp.con))}" -->        
                   
                  <apex:pageBlockTable value="{!gp.con}" var="p" border="9">          
               
                    <apex:column colspan="7" > 
                        <apex:facet name="header">#</apex:facet>
                        <!--<apex:outputLink value="/{!p.id}"><apex:outputText value="{!p.Name}"/></apex:outputLink>-->
                        <apex:outputLink value="/{!p.id}"><apex:outputText value="{!p.Name}"/></apex:outputLink>
                    </apex:column>
                     <apex:column >
                         <apex:facet name="header">Material Name</apex:facet>
                         <apex:outputText value="{!p.material_name__c}"/>
                     </apex:column>                    
                     <apex:column >
                         <apex:facet name="header">Material No.</apex:facet>
                         <apex:outputText value="{!p.material_no__c}"/>
                     </apex:column>
                     <apex:column >
                         <apex:facet name="header">Quantity</apex:facet>
                         <apex:outputText value="{!p.quantity_ordered__c}"/>
                     </apex:column>                                          
                     <apex:column >
                         <apex:facet name="header">Status</apex:facet>
                         <apex:outputText value="{!p.status__c}"/>
                     </apex:column>
                     <apex:column title="Customer Requested Delivery Date">
                         <apex:facet name="header">RDD</apex:facet>              
                          <apex:outputText value="{!IF(OR(p.material_group__c = 'K', p.material_group__c = 'KL', p.material_group__c = 'KC', p.material_group__c = 'E', p.material_group__c = 'E1', p.material_group__c = 'E2', p.material_group__c = 'E3', p.material_group__c = 'W4', p.material_group__c = 'EKC', p.material_group__c = 'EC', p.material_group__c = 'EMC') ,'Week Of {0, date, MM/d/yyyy}','{0, date, MM/d/yyyy}')}" rendered="{!gp.acc.requested_delivery_date__c!=null}">
                         <apex:param value="{!gp.acc.requested_delivery_date__c}" /> 
                        </apex:outputText>     
                     </apex:column>
                     <apex:column title="Estimated Delivery Date at time of Order">
                         <apex:facet name="header">EDD</apex:facet>              
                          <apex:outputText value="{!IF(OR(p.material_group__c = 'K', p.material_group__c = 'KL', p.material_group__c = 'KC', p.material_group__c = 'E', p.material_group__c = 'E1', p.material_group__c = 'E2', p.material_group__c = 'E3', p.material_group__c = 'W4', p.material_group__c = 'EKC', p.material_group__c = 'EC', p.material_group__c = 'EMC') ,'Week Of {0, date, MM/d/yyyy}','{0, date, MM/d/yyyy}')}" rendered="{!p.planned_ship_date__c!=null}">
                          <apex:param value="{!p.planned_ship_date__c}" />                            
                        </apex:outputText>    
                     </apex:column>  
                    
                                       
                     <apex:column breakBefore="true" colspan="12">
                  
                 <!--Shipment Line details-->                    
                     <apex:pageblocksection title="Shipment Informations" collapsible="true" columns="1" rendered="{!NOT(ISNULL(gp.opp))}" >
                        <apex:pageBlockTable value="{!gp.opp}" var="q" >
                       
                              <apex:column> 
                                     <apex:facet name="header">Shipment Lines</apex:facet>
                                     <apex:outputLink value="/{!q.id}"><apex:outputText value="{!q.Name}"/></apex:outputLink>
                              </apex:column> 
                              <apex:column>
                                     <apex:facet name="header">Quantity Shipped</apex:facet>
                                     <apex:outputText value="{!q.quantity_shipped__c}"/>
                              </apex:column>  
                              <apex:column >
                                   <apex:facet name="header">Carrier Name</apex:facet>
                                   <apex:outputText value="{!q.Shipment_Number__r.carrrier_name__c}"/>
                              </apex:column>   
                              <apex:column >
                                  <apex:facet name="header">Carrier Website</apex:facet>
                                  <apex:outputLink value="{!q.Shipment_Number__r.carrier_website__c}" ><apex:outputText value="{!q.Shipment_Number__r.carrier_website__c}"/></apex:outputLink>
                              </apex:column>    
                              <apex:column >
                                  <apex:facet name="header">Tracking Number</apex:facet>
                                  <apex:outputText value="{!q.Shipment_Number__r.tracking_number__c}"/>
                              </apex:column>
                                                                               
                             <apex:column title="Estimated Delivery Date at the time of Shipment">
                                  <apex:facet name="header">Est Deliv Date</apex:facet>              
                                  <apex:outputText value="{!IF(OR(p.material_group__c = 'K', p.material_group__c = 'KL', p.material_group__c = 'KC', p.material_group__c = 'E', p.material_group__c = 'E1', p.material_group__c = 'E2', p.material_group__c = 'E3', p.material_group__c = 'W4', p.material_group__c = 'EKC', p.material_group__c = 'EC', p.material_group__c = 'EMC') ,'Week Of {0, date, MM/d/yyyy}','{0, date, MM/d/yyyy}')}" rendered="{!q.estimated_delivery_date__c!=null}">
                                  <apex:param value="{!q.estimated_delivery_date__c}" /> 
                                  </apex:outputText> 
                             </apex:column>     
                             <apex:column >
                                  <apex:facet name="header" >Actual Delivery Date</apex:facet>              
                                  <apex:outputText value="{!IF(OR(p.material_group__c = 'K', p.material_group__c = 'KL', p.material_group__c = 'KC', p.material_group__c = 'E', p.material_group__c = 'E1', p.material_group__c = 'E2', p.material_group__c = 'E3', p.material_group__c = 'W4', p.material_group__c = 'EKC', p.material_group__c = 'EC', p.material_group__c = 'EMC') ,'Week Of {0, date, MM/d/yyyy}','{0, date, MM/d/yyyy}')}"  rendered="{!q.Actual_Delivery_Date__c!=null}">
                                  <apex:param value="{!q.Actual_Delivery_Date__c}"/> 
                                  </apex:outputText> 
                             </apex:column>  
                       </apex:pageBlockTable>
                       </apex:pageblocksection>   
                       </apex:column>     
                     
                    </apex:pageBlockTable>
 
                 </apex:pageblocksection>
           <!--Invoice Line details -->

                <apex:pageblocksection title="Invoice Details" showheader="true" collapsible="true" columns="1" >
                    <apex:pageBlockTable value="{!gp.inv}" var="i">   
                    <apex:column colspan="7"> 
                        <apex:facet name="header">Invoice No.</apex:facet>
                        <apex:outputLink value="/apex/InvoiceList?id={!i.invoices__r.id}"><apex:outputText value="{!i.invoices__r.invoice_no__c}"/></apex:outputLink>
                    </apex:column>  
                    <apex:column >
                        <apex:facet name="header">Status</apex:facet>
                        <apex:outputText value="{!i.invoices__r.status__c}"/>
                    </apex:column>        
                    <apex:column >
                        <apex:facet name="header">Invoice Value</apex:facet>
                        <apex:outputText value="{!i.invoices__r.invoice_value__c}"/>
                    </apex:column>  
                    <apex:column >
                        <apex:facet name="header">Due Date</apex:facet>
                        <apex:outputText value="{0, date, MM/d/yyyy}"> 
                        <apex:param value="{!i.invoices__r.due_date__c}"/>
                        </apex:outputText>  
                    </apex:column>     
                    <apex:column >
                     <apex:facet name="header">Invoice Date</apex:facet>   
                        <apex:outputText value="{0, date, MM/d/yyyy}"> 
                        <apex:param value="{!i.invoices__r.invoice_date__c}"/>
                        </apex:outputText>  
                    </apex:column>  
                    </apex:pageBlockTable>                 
                 </apex:pageblocksection>
                 
             </apex:repeat>             
             </apex:pageBlock>

    <!-- </apex:form>  -->
 </apex:page>

 Any help would be great. Thanks

 
  • December 03, 2014
  • Like
  • 0
I'm trying to create an account using actionFunction and display the result in the same page. I have tried successfully the "sayHello" example in http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_actionFunction.htm . But it's not helping me to build this application. Can anyone guide me through this? Any reference would be helpful. Thanks
I have following issue:
when I create a new Account I first would like to fetch the Account data from an external web service
and populate the Account with the result of my web service call. My idea is to add a button (GetAccountData) that would trigger the
web service (with a Controller ?), get the response and display the data on the Account Tab.
is there a way  in Visualforce to add such a functionality ?