• Rick MacGuigan
  • NEWBIE
  • 410 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 123
    Questions
  • 193
    Replies
I have (5) Visual Force components on a main Visual Force page. How can I best save all component data and main page using a save button on the main page? Would appreciate guidance with code examples that others may have done. Many thanks.
To avoid an object from getting too big I'm building seperate objects with their own Visualforce component pages. The main Visualforce page uses tabs where I am calling each componenet page.

By doing this will the viewstate on the main page be kept under the limit ? Or do called component Visualforce pages add to the main page view state ? 

Also, how can I relate all of the Visualforce components to the main Visualforce page for reporting ? 

Unfortunately I'm dealing with many fields and don't want to run into view state errors forcing me to write more HTML along with any transient property definitions in the controller (which is very light.) 
I cannot get records to show from a Junction Object. I have an 'Evaluation' object and an 'Audit' object both created directly from the Account object.I need to see the list of Audit records related to an account within the Exaluation object. So I've created a junction object with two Master Detail fields:
  • Audit
  • Evaluation
However, when I open the Evaluation object I see the Audit related list but there are no audit records. There are 25 audit records under the Account object. Creating an Evaluation object under the same Account. 

What could I be doing wrong ? 
I have acustom object (Audit) that should have a customer task record type called Scheduled Audit. Normally the Scheduled Audit task is created before the Audit and is used to pre schedule the actual audit. However, in the event the Scheduled Audit task does not exist and the Audit is created and saved I need to iterate over the activity related list to see if a Scheduled Audit exist. If this particular Schedueld Task record type is not found in the related list then create one. 

Is it possible to use process builder to iterate over the activities of the Audit object looking for a Scheduled Audit record ? If it does not find it then create a Scheduled Audit task 'related to ' the Audit object. 
I am tracking changes to a custom field called AMBest on the account record. This value is updated from Informatica cloud via AMBest feed data in Oracle. If this value changes I need to report on the change in a chatter post via process builder. Field history tracking is enabled for the AMBest field. There doesn't seem to be a way to use a merge field to pick the most recent value for account history for ths value. Any ideas ? 
I started to build out a simple trigger from the  to prevent a File record from being deleted from SalesForce Files | Triggers. These file records can be deleted from a related list on a visualforce page. The trigger is active but I can still delete an uploaded File . Any ideas ? 
 
trigger CREContentDocVersion on ContentVersion (before delete) {
for(ContentVersion cv : trigger.old){
        cv.adderror('Document Cannot be deleted');
    }
}

 
I have a custom object using a Visualforce page with a related list for 'Files.' The File related list can contain a PDF version of the Visualforce page that is generated by the controller to memorialize content. If an executive reviews and comments on the Visualforce page and creates the PDF how can I prevent a File from being deleted by the owner of the custom object if certain fields are populated/updated by an executive reviewer ?
<apex:relatedList list="AttachedContentDocuments"  id="FilesList" />

 
How can I format a date field from a query do that it does not cause a break as a new table row? Below is a table and the respective code.

User-added image
 
<apex:actionRegion >
<apex:outputPanel layout="block" styleClass="header1" >
<apex:pageBlockSection columns="1" id="section2aa" title="Submission Summary Information" showHeader="true" >
<html>
<body>   
<br></br>
<table> 
<tr class="alldatatables">
<th> Contracts </th>
<th> Key Contact </th>
<th> Effective Date </th>
<th> N/R </th>
<th> Type </th>
<th> Coverage </th>
<th> Subject Prem </th>
<th> QS Part of % </th>
<th> Cession Limit </th>
<th> Treaty Limit </th>
<th> Event Limit </th>
<th> Att Type </th>
<th> LAE Type </th>
<th> ECO% </th>
<th> XPL% </th>
<th> Req Brok% </th>
<th> Req Reinstatements </th>

</tr>
<apex:repeat value="{!submissionList}" var="s" >
<tr class="alldatatables"> 
<td>{!s.SPD_REF_PS__c}</td> 
<td>{!s.Key_Broker_Contact_LU_PS__c}</td>
<td>
<apex:outputText value="{0,date,MM/dd/yy}"> <apex:param value="{!s.Est_CERT_Incept_Date_PS__c}"></apex:param> </apex:outputText>
</td>
<td>{!s.Submission_New_Renew_PS__c}</td> 
<td>{!s.Submission_Type_PS__c}</td>
<td>{!s.Coverage_PS__c}</td>
<td>{!s.Subject_Premium__c}</td>
<td>{!s.QUOTA_SHARE_PART_OF__c}</td>
<td>{!s.PRO_RATA_LIMIT__c}</td>
<td>{!s.Limit__c}</td>
<td>{!s.Event_Limit__c}</td>
<td>{!s.Attachment_Type__c}</td>
<td>{!s.RSO_LAE_TYPE__c}</td>
<td>{!s.RSO_ECO_PCNT__c}</td>
<td>{!s.RSO_XPL_PCNT__c}</td>
<td>{!s.BROKERAGE_PCT__c}</td>
<td>{!"--"}</td>
</tr> 
</apex:repeat>
</table> 
</body>
</html>

</apex:pageBlockSection>
</apex:outputPanel>
</apex:actionRegion>

 
I would like to query the chatter REST API to get the chatter group a person belongs to. How can I query the chatter REST API for chatter groups that a user belongs to where the JSON contains  "myRole" = "StandardMember?" Need to then pass that SalesForce chatter group ID into a subsequent  GET command: /services/data/v39.0/chatter/feeds/record/<SF Group ID>/feed-elements
Recently my CSS to format a VisualForce Page renders as PDF is not showing in landscape nor are page numbers showing. Both the preview from SalesForce and download show the PDF in portrait with no page numbers. The CSS has not changed and is at the bottom of the CSS file. CSS is used as a static resource.

Even if I wrap this CSS as a STYLE on the VisualForce page it still shows as portrait with no page numbers. 

Anyone know of recent changes that would impact this?
 
@page {
/* Landscape orientation */
size: ledger landscape;

/* Put page numbers in the top right corner of each
   page in the pdf document. */
@bottom-right {
 content: "Page " counter(page) "of " counter(pages);
}
   margin-top:3cm;
   margin-left:2.54cm;
   margin-right:2.54cm;
   margin-bottom:3cm;

   margin-top:1cm;
   margin-left:1cm;
   margin-right:1cm;
   margin-bottom:1cm;

}

The complete CSS: 
 

tr:hover {background-color: #f5f5f5}

.inputFieldStyle1 {
  color:blue;
  width: 360px;
  }

.rich-tabhdr-side-cell {border-top:none;}   
.rich-tabhdr-side-border {background-image:none;}

.tabPanel {
   border: none !important;
   }

.activeTab {
    background-color: lightblue;    
    background-image:none; 
    font-size: 18px;
    border-radius: 50px 20px;
    border: none !important; 
    }
.inactiveTab {
    background-color: lightgrey;    
    background-image:none;
    font-size: 12px;
    color:blue; 
    border-radius: 50px 20px;
    border: none !important;
}
    

.panelCol1 {width:20%; text-align:left;font-size:75%;}
.panelCol2 {width:50%; text-align:left;font-size:75%;color:blue}
.panelCol3 {width:30%; text-align:left;font-size:75%;color:blue}

    


.allPDFpanelGrid {
    text-align: left;
    font-family: 'Arial'; 
    font-size: 100%;   
    vertical-align: top;
    border-collapse: collapse; 
    border: 0px solid black;
    padding: 1px 1px 1px 1px;    
    -fs-table-paginate: paginate;
    border-spacing: 0;
    cellspacing 0;	
}

.allPDFpanelGridrows {
    /*text-align: right;*/
    font-family: 'Arial'; 
    font-size: 100%;   
    vertical-align: top;
    border-collapse: collapse; 
    border: 0px solid black;
    padding: 1px 1px 1px 1px;   
    cellspacing 0;
}

.allPDFpanelGridValue {
    /*text-align: left;*/
    font-family: 'Arial'; 
    /*font-size: 100%;*/   
    vertical-align: top;
    border-collapse: collapse; 
    border: 0px solid black;
    padding: 1px 1px 1px 1px;    
    -fs-table-paginate: paginate;
    border-spacing: 0;
    cellspacing 0;	
}

.allPDFdatatables {
    text-align: right;
    font-family: 'Arial'; 
    font-size: 75%;   
    vertical-align: middle;
    border-collapse: collapse; 
    border: 1px solid black;
    padding: 1px 1px 1px 1px;
    color: blue;
    -fs-table-paginate: paginate;
    border-spacing: 0;
    cellspacing 0;	
}

.allPDFdatarows {
    text-align: right;
    font-family: 'Arial'; 
    font-size: 75%;   
    vertical-align: middle;
    border-collapse: collapse; 
    border: 1px solid black;
    padding: 1px 1px 1px 1px;
    color: black;    
    cellspacing 0;
}

.allPDFdatacols {
    border-collapse: collapse; 
    border: 1px solid black;
	cellspacing 0;
    }

.alldatatables {
    text-align: right;
    font-family: 'Arial'; 
    font-size: 90%;   
    vertical-align: middle;
    border-collapse: collapse; 
    border: 1px solid black;
    padding: 5px 5px 5px 5px;
    color: blue;
    border-bottom: 1px solid #ddd;
	cellspacing 0;	
}

.alldatarows {
    text-align: right;
    font-family: 'Arial'; 
    font-size: 90%;   
    vertical-align: middle;
    border-collapse: collapse; 
    border: 1px solid black;
    padding: 5px 5px 5px 5px;
    color: black;    
    border-bottom: 1px solid #ddd;

}

.alldatacols {
    border-collapse: collapse; 
    border: 1px solid black;
    }



.odd {
 border-bottom: 1px solid #000;
 padding: 1px 1px 2px 2px;
 background-color: #ccf2ff;
}

.even {
 border-bottom: 1px solid #000;
 padding: 1px 1px 2px 2px;
 background-color: white;
}

.col{
height: auto;
float: left;
text-align: left;

.col1{
width:40%;
height: auto;
float: left;
text-align: left;
color:black;

.col2{
width:auto;
height: auto;
float: left;
text-align: left;
color:green;

.col3{
width:200px;
height: auto;
float: left;
text-align: left;
color:purple;
}


.button {
   background: blue;
   border-radius: 15px;
   color: white;
   font-size: 12px;
   vertical-align: middle;
    -webkit-transition-duration: 0.4s; /* Safari */
    transition-duration: 0.4s;
   }
.button:hover {
   border-top-color: black;
   background: yellow;
   color: blue;
    background-color: #4CAF50; /* Green */
    color: white;
   }
.button:active {
   border-top-color: yellow;
   background: yellow;
   }


.headerstyle1 .bPageBlock .pbHeader .pbSubheader {
    background-color: green !important;   
}
.headerstyle2 body .bPageBlock .pbBody .headerstyle2 .pbSubheader{
    background-color:yellow;
}



@page {
/* Landscape orientation */
size: ledger landscape;

/* Put page numbers in the top right corner of each
   page in the pdf document. */
@bottom-right {
 content: "Page " counter(page) "of " counter(pages);
}
   margin-top:3cm;
   margin-left:2.54cm;
   margin-right:2.54cm;
   margin-bottom:3cm;

   margin-top:1cm;
   margin-left:1cm;
   margin-right:1cm;
   margin-bottom:1cm;
 
}

 
For 2017 what is the recommended solution to rerendering visualforce pages with rich text fields ? Below is a sample tab panel where the second tab (TEST2) contains a rich text field. This results in the VF error:
Visualforce Error
Rerender is not currently supported with rich text editing enabled 

 
<apex:page standardStylesheets="true" standardController="Account_Summary__c" readOnly="false"  showHeader="true"  >

<apex:form id="form1">
<apex:pageBlock id="block1"  >
<apex:actionRegion > 

<apex:pageBlockSection columns="1" id="section1" title="General Information" showHeader="true" >

    <apex:inputField value="{!Account_Summary__c.Lines_of_Business__c}" style="color:blue;" >
        <apex:actionSupport event="onchange" reRender="taboutputpanel,theTabPanel,tab1a,tab1b,tab1c" /> 
        
        </apex:inputField>          
    
</apex:pageBlockSection>


<apex:actionRegion immediate="true" >   
<apex:outputPanel >
<b><apex:outputText style="font-style:bold;color:blue" value="Line of Business Analysis" /></b>

<apex:tabPanel switchType="client" selectedTab="name2" id="theTabPanel">

<apex:tab label="TEST1" name="tab1a" id="tab1a" rendered="{!IF(CONTAINS(Account_Summary__c.Lines_of_Business__c,'WC'),"true","false")}"  > </apex:tab>
<apex:tab label="TEST2" name="tab1c" id="tab1c" rendered="{!IF(CONTAINS(Account_Summary__c.Lines_of_Business__c,'Personal Auto'),"true","false")}"  > 
    <apex:inputField value="{!Account_Summary__c.WC_Outside_sources_UW_information__c}" />
</apex:tab>

</apex:tabPanel>
</apex:outputPanel>
</apex:actionRegion>


</apex:actionRegion>

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

 
This should be simple but appears difficult. My visual force page displays negative values retrieved from SOQL query in the controller. I need that number to be positive and thought I could simply use ABS to do this on either the VisualdForce page or controller. 

How can I do this ? field is PAID_LOSS__c

VF Page:
<apex:dataTable id="dt2c" styleClass="alldatatables" headerClass="alldatacols" columnClasses="alldatacols" rowClasses="alldatarows"  value="{!PriorYRcontractSectionList}" var="pyr" rules="all" cellpadding="5"  >
...
<apex:column value="{!pyr.PAID_LOSS__c}" headerValue="Ttl Rprd Loss" rendered="{! (allNulls_PAID_LOSS_dt2c || hidecols) }"/>
Controller: 
private List<MR_Contracts__c> queryPriorYRcontractsectionById(List<String> contractIds, string ContractYear) {
   //used to display Contract Section Data based on user selected submissions for the multiselect field.
   //Filter by 
  List<MR_Contracts__c> PriorYRcontractsectionById = [    
    //return [
      SELECT
        Id
        ,Name
        ,ULTIMATE_PREMIUM__c
        ,PAID_LOSS__c
        ,ACR__c
        ,ULTIMATE_LOSS__c
        ,Ultimate_Loss_Ratio__c
        ,F_DETAIL_COMMISSION__c
        ,F_DETAIL_BROKERAGE__c
        ,ULT_OVERHEAD_EXCL_CATS__c
        ,ULT_CR_ACCT_OH__c
        ,ULT_CR_ACCT_EXCL_OH__c
        ,ITD_CR_INCL_ACCT_OH__c
        ,ITD_CR_EXCL_ACCT_OH__c


       FROM
        MR_Contracts__c
      WHERE
        ContractSubmissionRef__c IN :contractIds   
      ORDER BY Name DESC
    ];

      this.allNulls_PAID_LOSS_dt2c= false; 
      this.allNulls_ACR_dt2c= false; 
      this.allNulls_ULTIMATE_LOSS_dt2c= false; 
      this.allNulls_Ultimate_Loss_Ratio_dt2c= false; 
      this.allNulls_F_DETAIL_COMMISSION_dt2c= false; 
      this.allNulls_F_DETAIL_BROKERAGE_dt2c= false; 
      this.allNulls_ULT_OVERHEAD_EXCL_CATS_dt2c= false; 
      this.allNulls_ULT_CR_ACCT_OH_dt2c= false; 
      this.allNulls_ULT_CR_ACCT_EXCL_OH_dt2c= false; 
      this.allNulls_ITD_CR_INCL_ACCT_OH_dt2c= false; 
      this.allNulls_ITD_CR_EXCL_ACCT_OH_dt2c= false; 
      
    for (MR_Contracts__c dt2cResult : PriorYRcontractsectionById) {
    //special considerations: Need to summ up all column values and test if total <- 0 to ensure all columns contain no data. Used to render column in dataTables.
    
      if (dt2cResult.PAID_LOSS__c > 0) {allNulls_PAID_LOSS_dt2c = true;}  
      if (dt2cResult.ACR__c > 0) {allNulls_ACR_dt2c = true;}  
      if (dt2cResult.ULTIMATE_LOSS__c > 0) {allNulls_ULTIMATE_LOSS_dt2c = true;}  
      if (dt2cResult.Ultimate_Loss_Ratio__c > 0) {allNulls_Ultimate_Loss_Ratio_dt2c = true;}  
      if (dt2cResult.F_DETAIL_COMMISSION__c > 0) {allNulls_F_DETAIL_COMMISSION_dt2c = true;}  
      if (dt2cResult.F_DETAIL_BROKERAGE__c > 0) {allNulls_F_DETAIL_BROKERAGE_dt2c = true;}  
      if (dt2cResult.ULT_OVERHEAD_EXCL_CATS__c > 0) {allNulls_ULT_OVERHEAD_EXCL_CATS_dt2c = true;}  
      if (dt2cResult.ULT_CR_ACCT_OH__c > 0) {allNulls_ULT_CR_ACCT_OH_dt2c = true;}  
      if (dt2cResult.ULT_CR_ACCT_EXCL_OH__c > 0) {allNulls_ULT_CR_ACCT_EXCL_OH_dt2c = true;}  
      if (dt2cResult.ITD_CR_INCL_ACCT_OH__c > 0) {allNulls_ITD_CR_INCL_ACCT_OH_dt2c = true;}  
      if (dt2cResult.ITD_CR_EXCL_ACCT_OH__c > 0) {allNulls_ITD_CR_EXCL_ACCT_OH_dt2c = true;}  

    }

  return PriorYRcontractsectionById;   
    
  }



 
Is it possible to render visual force tab data in pdf as tabs or ebook tabs ? 
I added the flying saucer specific CSS to maintain the header of a dataTable when a table continues after a page break but now the table borders show double lines. Below a screen shot along with the visualforce page and static CSS file. Is there a cleaner way to implement continual table dataTable headers and how can I remove the double border to just one line ?

User-added image

 
CSS file; 

.allPDFdatatables {
    text-align: right;
    font-family: 'Arial'; 
    font-size: 75%;   
    vertical-align: middle;
    border-collapse: collapse; 
    border: 1px solid black;
    padding: 5px 5px 5px 5px;
    color: blue;
    border-bottom: 1px solid #ddd;
    -fs-table-paginate: paginate;
    border-spacing: 0;	
}

.allPDFdatarows {
    text-align: right;
    font-family: 'Arial'; 
    font-size: 75%;   
    vertical-align: middle;
    border-collapse: collapse; 
    border: 1px solid black;
    padding: 5px 5px 5px 5px;
    color: black;    
    border-bottom: 1px solid #ddd;
}

.allPDFdatacols {
    border-collapse: collapse; 
    border: 1px solid black;
    }

.alldatatables {
    text-align: right;
    font-family: 'Arial'; 
    font-size: 90%;   
    vertical-align: middle;
    border-collapse: collapse; 
    border: 1px solid black;
    padding: 5px 5px 5px 5px;
    color: blue;
    border-bottom: 1px solid #ddd;	
}

.alldatarows {
    text-align: right;
    font-family: 'Arial'; 
    font-size: 90%;   
    vertical-align: middle;
    border-collapse: collapse; 
    border: 1px solid black;
    padding: 5px 5px 5px 5px;
    color: black;    
    border-bottom: 1px solid #ddd;

}

.alldatacols {
    border-collapse: collapse; 
    border: 1px solid black;
    }




.odd {
 border-bottom: 1px solid #000;
 padding: 1px 1px 2px 2px;
 background-color: #ccf2ff;
}

.even {
 border-bottom: 1px solid #000;
 padding: 1px 1px 2px 2px;
 background-color: white;
}

@page {
/* Landscape orientation */
size: ledger landscape;

/* Put page numbers in the top right corner of each
   page in the pdf document. */
@bottom-right {
 content: "Page " counter(page) "of " counter(pages);
}
   margin-top:1cm;
   margin-left:1cm;
   margin-right:1cm;
   margin-bottom:1cm;
 
}

Visual Force :
  <apex:pageBlockSection columns="1" id="section8" title="Bound Terrorism & Cyber Information" showHeader="true" rendered="{!NOT(TerrorCyberSectionList.size == 0)}" > 
 
             <apex:outputPanel id="out8">
                <apex:actionstatus startText="loading...">
                    <apex:facet name="stop" >
                        <apex:outputPanel >
                         <apex:outputText style="font-style:italic;color:blue" value="Terrorism" />
                            <apex:dataTable id="dt8a"  styleClass="allPDFdatatables" headerClass="allPDFdatacols" columnClasses="allPDFdatacols" rowClasses="allPDFdatarows" value="{!TerrorCyberSectionList}" var="tc" rules="all" cellpadding="5" >
                            
                                <apex:column value="{!tc.Name}" headerValue="Contract"/>
                                <apex:column value="{!tc.Terror_Limit_Amount__c}" headerValue="Additional Limit Maiden Share"/>
                                <apex:column value="{!tc.Terror_Limit_Type__c}" headerValue="Limit Type"/> 
                                <apex:column value="{!tc.Terror_Limit_Description__c}" headerValue="Description (Terrorism)"/>
         
                            </apex:dataTable>  
                         <br></br>                           
                         <apex:outputText style="font-style:italic;color:blue" value="Cyber" /> 
                           <apex:dataTable id="dt8b" styleClass="allPDFdatatables" headerClass="allPDFdatacols" columnClasses="allPDFdatacols" rowClasses="allPDFdatarows" value="{!TerrorCyberSectionList}" var="tc" rules="all" cellpadding="5" >
                                <apex:column value="{!tc.Name}" headerValue="Contract"/>
                                <apex:column value="{!tc.Cyber_Limit_Amount__c}" headerValue="Additional Limit Maiden Share"/>
                                <apex:column value="{!tc.Cyber_limit_Type__c}" headerValue="Limit Type"/> 
                                <apex:column value="{!tc.Cyber_Limit_Description__c}" headerValue="Description (Cyber)"/>
                                                           
                            </apex:dataTable> 

                                                    
                        </apex:outputPanel>
                    </apex:facet>
                </apex:actionstatus>
                
            </apex:outputPanel>

 </apex:pageBlockSection>



 
I can't seem to render a tab label on/off based on the value chosen on a multiselect field called Lines_of_Business__c . The tabs are located on top of the page and the multiselect is towards the bottom. 

Any ideas ? 
 
<apex:pageBlockSection columns="1" id="section11" title="LOB Information" showHeader="true" >
<apex:outputPanel >
<b><apex:outputText style="font-style:bold;color:black" value="Line of Business Analysis" /></b>  
<apex:tabPanel switchType="client" selectedTab="name2" id="theTabPanel">
<apex:tab label="*Work Comp" name="tab1" id="tab1" rendered="{!CONTAINS(Account_Summary__c.Lines_of_Business__c,'WC')}" >
</apex:tabPanel>
</apex:outputPanel>

</apex:pageBlockSection>
.....
 <apex:actionRegion >
 <apex:pageBlockSection columns="1" showHeader="false"  >
 <apex:inputField value="{!Account_Summary__c.Lines_of_Business__c}" >
    <apex:actionSupport event="onchange" reRender="tabOne" />
    </apex:inputField>
 </apex:pageBlockSection> 
 </apex:actionRegion>

 
Having a couple issues with CSS and VisualForce datatable formatting. 

I am rendering a visual force page using a seperate page with renderAs="pdf". This just makes it easier to maintain just what I need to display. The visualForce page saves as a pdf attachment on the main account record. However when I view the stored PDF the datatable formatting is not displaying as it is on the main VF page.

How can I maintain the solid border and font colors on the rendered pdf ? 
Also, how can I control the cell padding using CSS instead of using the cellpadding parameter on the datatable tag. Is there a way to automaically scale the data table width should a table be long ? 

Main Visual Formce Page - PROD_UW_AccountSummary
Main visual force page with proper table rendering.
<apex:page standardStylesheets="true"  standardController="Account_Summary__c" readOnly="false" extensions="AccountSummaryController"  >
<apex:stylesheet value="{!URLFOR($Resource.pdfcssresource, 'CREresource_CRE.css')}"/>
......
 <apex:pageBlockSection columns="1" id="section2b" title="* Expiring Excess of Loss Contract Information" showHeader="true"  >  
    <apex:outputPanel id="out2b" >
       <apex:actionstatus startText="loading...">
           <apex:facet name="stop" >
              <apex:outputPanel >
                  <apex:dataTable styleClass="alldatatables" value="{!contractSectionList}" var="cs" cellpadding="5" rowClasses="alldatarows"  >
                       <apex:column value="{!cs.MR_Contract__c}" headerValue="Contract"  />
                       <apex:column value="{!cs.Name}" headerValue="Section"/>

Saved PDF Page - PROD_UW_AccountSummary_PRT
saved pdf file
 
<apex:page standardStylesheets="false" standardController="Account_Summary__c" readOnly="false" extensions="AccountSummaryController" renderAs="pdf" >
<apex:stylesheet value="{!URLFOR($Resource.pdfcssresource, 'CREresource_CRE.css')}"/>
.....
<apex:pageBlockSection columns="1" id="section2b" title="* Expiring Excess of Loss Contract Information" showHeader="true"  > 
    <apex:outputPanel id="out2b" >
      <apex:actionstatus startText="loading...">
           <apex:facet name="stop" >
              <apex:outputPanel >
                   <apex:dataTable styleClass="alldatatables" value="{!contractSectionList}" var="cs" cellpadding="5" rowClasses="alldatarows"  >
                       <apex:column value="{!cs.MR_Contract__c}" headerValue="Contract"/>
                       <apex:column value="{!cs.Name}" headerValue="Section"/>

CSS file:  CREresource_CRE.zip

 
/*
table, th, td {
    border: 1px solid black;
}

table {
    border-collapse: collapse;
}


th, td {
    padding: 15px;
    order-bottom: 1px solid #ddd;
   }

th {
    text-align: center;
    font-weight: bold;
    /* white-space: nowrap; */
}

td {
    text-align: right;
    font-family: 'Arial'; 
    font-size: 100%;   
    vertical-align: middle; 
}
*/


tr:hover {background-color: #f5f5f5}


.alldatatables {
    text-align: right;
    font-family: 'Arial'; 
    font-size: 100%;   
    vertical-align: middle;
    border-collapse: collapse; 
    border: 1px solid black;
    padding: 5px 5px 5px 5px;
    color: blue;

}

.alldatarows {
    text-align: right;
    font-family: 'Arial'; 
    font-size: 100%;   
    vertical-align: middle;
    border-collapse: collapse; 
    border: 1px solid black;
    padding: 15px 15px 5px 5px;
}

.alldatacols {
    border-collapse: collapse; 
    border: 1px solid black;
    }

@page {
/* Landscape orientation */
size: ledger landscape;

/* Put page numbers in the top right corner of each
   page in the pdf document. */
@bottom-right {
 content: "Page " counter(page) "of " counter(pages);
}
   margin-top:3cm;
   margin-left:2.54cm;
   margin-right:2.54cm;
   margin-bottom:3cm; 
}

Main Visual Formce Page - PROD_UW_AccountSummary







 
I need to save the selected options a user picks on a SelectList tag. On the controller snippet below, how can I save contractNumbers into a SalesForce object field ? Also, when I open the record up I need to load the save contractNumbers as the selected values for !SelectedSubmissions on the visualForce page. 
 
public void getSelectedSubmissions() {
 // called by command button 'Select Submissions'
    try {
      this.submissionList = querySubmissionsById(this.SelectedSubmissions); 
 
      for (Submissions__c sublist : submissionList) {
      string val1 = sublist.Name; //Just an example. Change as needed
      string val2 = sublist.SPD_REF_PS__c; 
      string val3 = sublist.Company_Code__c;      
      string contractNumber = val2 + this.ContractYear + val3;
       contractNumbers.add(contractNumber);
    }
 
<!-- Selection List -->   
       <apex:selectList value="{!SelectedSubmissions}" multiselect="true">
         <apex:selectOptions value="{!SubmissionOptions}"/>
       </apex:selectList><p/>

 
What is the object reference to save a visual force page to the new Files object. It is currently going to the old Notes & Attachments object. 
Also, the pdf that does save to Notes and Attachment is blank. Does not contain the VF page as a pdf. Do I need to create another VF page that renders as a pdf only ? 
<apex:page standardController="Account_Summary__c" readOnly="false" extensions="AccountSummaryController" >
....
<apex:commandButton value="Save PDF and Return to Account" action="{!savePDFAndReturn}" />
 
//save page as PDF to Files and return user back to the account object.

    public PageReference savePDFAndReturn(){
        PageReference pageRef = null;

        try {
             PageReference saveRef = stdController.save();
             if (saveRef != null) { 
            
            // process PDF file attachment
             string pdfFileName = getFileName(System.today(), this.AccountSummary.Name);
 
             PageReference summaryPageRef = Page.AccountSummary;            
             summaryPageRef.getParameters().put('id', this.AccountSummary.Id);   

             Blob pdfSummary = (Test.isRunningTest() ? Blob.valueOf('Test Invoice') : summaryPageRef.getContentAsPDF());            
            
           /*Create the attachment record to save the PDF content.*/
             Attachment pdfDocument = new Attachment();
             pdfDocument.Name = pdfFileName;
             pdfDocument.Name = 'CRE_TestFile';
             pdfDocument.ParentId = this.AccountSummary.Id;  
             //pdfDocument.ParentId = 'a0F2C000000GzKfUAK';                
             pdfDocument.Body = pdfSummary;
             pdfDocument.ContentType = 'application/pdf';

             insert pdfDocument; 
            
            //*************************************
             pageRef = new PageReference('/' + this.ParentAcct.Id);
             pageRef.getParameters().put('inline','0');
             pageRef.setRedirect(true);
            }
        }
        catch (Exception ex) {
            ApexPages.addMessages(ex);
        }

        return pageRef;
    }   
 
 
  public static string getFileName(Date pdfDate, string summaryName) {
    //string formattedDate = getDateFormatted(pdfDate);
    string formattedDate = pdfDate.format();
    string[] values = new string[]{
       formattedDate
      ,summaryName
    };

    return String.format('{0} - {1} - Summary.pdf', values);
  }

 
I can't seem to control rendering a page block section . For result sets that are not empty the pageblock section remains unrendered. 
 
<apex:actionRegion > 
       <apex:selectList value="{!SelectedSubmissions}" multiselect="true">
         <apex:selectOptions value="{!SubmissionOptions}"/>
       </apex:selectList><p/>        
   <apex:commandButton value="Select Submissions" action="{!getSelectedSubmissions}" rerender="section2ba,out2a,out2b,out2ba,out2c,out2d,out3a,out3b,out8,out8h,globalMessages" status="status"/>
   </apex:actionRegion>


<apex:actionRegion >
  <apex:pageBlockSection columns="1" id="section2ba" title="* Expiring Quota Share Contract Information" showHeader="true" rendered="{!NOT(!contractQSSectionList.empty)}" > 
             <apex:outputPanel id="out2ba">
                <apex:actionstatus startText="loading...">
                    <apex:facet name="stop" >
                        <apex:outputPanel >
                            
                            <apex:dataTable style="text-align:right;" value="{!contractQSSectionList}" var="cqs" rules="all" cellpadding="5" >
                            
                                <apex:column value="{!cqs.MR_Contract__c}" headerValue="Contract"/>
                                <apex:column value="{!cqs.Name}" headerValue="Section"/> 
                                <apex:column value="{!cqs.Brokerage__c}" headerValue="Brok%"/>                                                                                               

                                                           
                            </apex:dataTable>                                 
                            
                                                    
                        </apex:outputPanel>
                    </apex:facet>
                </apex:actionstatus>
            </apex:outputPanel>

 
 </apex:pageBlockSection> 
 </apex:actionRegion>






 
I do not want to show a column in a data table if the respective field for all records returned in a query are empty . 
For example, if the field PAID_LOSS__c in the result set is empty how can I render that column false ? 

I render the page block if the entire result set is empty but need to also test each discrete field in order to not render a particular column within the data table. 
<apex:pageBlockSection columns="1" id="section2c" title="* Expiring Contract Experience" showHeader="true" rendered="{!NOT(!PriorYRcontractSectionList.empty)}" >
 
 
             <apex:outputPanel id="out2c">
                <apex:actionstatus startText="loading...">
                    <apex:facet name="stop" >
                        <apex:outputPanel >
                                                                                
                             <apex:dataTable style="text-align:right;" value="{!PriorYRcontractSectionList}" var="pyr" rules="all" cellpadding="5"  >
                                <apex:column value="{!pyr.Name}" headerValue="Contracts"/>
                                <apex:column value="{!pyr.ULTIMATE_PREMIUM__c}" headerValue="Ult Prem"/>                       
                                <apex:column value="{!pyr.PAID_LOSS__c}" headerValue="Ttl Rprd Loss" />  
                                 <apex:column value="{!pyr.ACR__c}" headerValue="Ttl ACR"/>  
                                <apex:column value="{!pyr.ULTIMATE_LOSS__c}" headerValue="Ttl Ult Loss Incl ACR"/>                               
                                <apex:column value="{!pyr.Ultimate_Loss_Ratio__c}" headerValue="Ult LR%"/>  
                                <apex:column value="{!pyr.F_DETAIL_COMMISSION__c}" headerValue="Ult Comm%"/>  
                                <apex:column value="{!pyr.F_DETAIL_BROKERAGE__c}" headerValue="Ult Brok%"/>     
                                <apex:column value="{!pyr.ULT_OVERHEAD_EXCL_CATS__c}" headerValue="Ult OH%"/>
                                <apex:column value="{!pyr.ULT_CR_ACCT_OH__c}" headerValue="Ult CR%"/> 
                                <apex:column value="{!pyr.ULT_CR_ACCT_EXCL_OH__c}" headerValue="Ult CR x OH%"/>                               
                                <apex:column value="{!pyr.ITD_CR_EXCL_ACCT_OH__c}" headerValue="ITD CR x OH%"/>                                                              
                            </apex:dataTable>
                            
                       </apex:outputPanel>
                    </apex:facet>
                </apex:actionstatus>
            </apex:outputPanel>
 
 
 </apex:pageBlockSection>
 
 
 public List<MR_Contracts__c> BoundcontractQSSummaryList {get;set;}
 this.BoundcontractQSSummaryList = queryBoundQScontractsummaryById(contractNumbers, this.ContractYear);   
  
	   
  private List<MR_Contracts__c> queryBoundQScontractsummaryById(List<String> contractIds, string ContractYear) {
      return [
      SELECT
        Id
        ,Name
        ,Renewal_Date__c
        ,Effective_Date__c
        ,SPD_RTC_CODE__c 
        ,SUBJECT_PREMIUM_PS__c
        ,QUOTA_SHARE_PART_OF__c
        ,Limit__c
        ,Event_Limit__c
        ,Participation__c
        ,Estimated_Premium_PS__c
        ,Maiden_Re_Limit__c
        ,Attachment_Type__c
        ,RSO_LAE_TYPE__c
        ,RSO_ECO_PCNT__c
        ,RSO_XPL_PCNT__c
        ,F_DETAIL_COMMISSION__c
        ,PROFIT_COMM_RATE__c
        ,PROFIT_COMM_PNCT__c
        ,Ceding_Comm_Min__c
        ,Ceding_Comm_Prov__c
        ,Ceding_Comm_Max__c    
        ,CEDING_COMM_INT__c
        ,CEDING_COMM_MIN_LR__c
        ,CEDING_COMM_PROV_LR__c
        ,CEDING_COMM_MAX_LR__c
        ,CEDING_COMM_INT_LR__c
        ,BROKERAGE__c
        ,CAT_LOAD_PCT__c
        ,PRICED_ULT_OVERHEAD_EXCL_CATS__c
        ,ROE_COMBINED_TARGET__c
        ,COMBINED_RATIO__c
        ,Priced_C_R_Excl_OH__c
        ,TARGET_ROE__c
        ,ROE__c
  
       FROM
        MR_Contracts__c
      WHERE
        ContractSubmissionRef__c IN :contractIds
      AND
        SPD_RTC_CODE__c LIKE '%QS%'   
      ORDER BY Name DESC
    ];
  }

 
Hello. I'm able to add an account link using a merge field on an email alert. However, I can't locate the same Account merge field when building a post to chatter group from Process builder 'merge field' button.  
I have a unit test that is running successfully however I cannot open the results in the developer console. Getting an error: Failed
to load data Log from Salesforce.com: Other unit test do open up in the devveloper console so I'm not sure why these recent test do not.. Any ideas on what could be casuing this ? 

User-added image

Unit test:
@isTest
private class UnitTest_Driver {
  
  //Test coverage for New Driver Creation (VF page) 
  static testmethod void testNewDriver() {

      
    Account acct = UtilityAudit.getAccount();
    insert acct;
    Audit__c audit = UtilityAudit.getAudit(acct.Id);
    insert audit; 
    Auto_Audit_Sample_Policy__c sample = UtilityAudit.getAuto_Audit_Sample_Policy(audit.Id);
    insert sample;
     Auto_Drivers__c driver = UtilityAudit.getAuto_Drivers(sample.Id);
     //driver.Driver_Birth_Year__c = '9999';
    insert driver;

    //initiate the VF page
    PageReference pageRef = Page.PROD_Audit_Auto_DriverSample_New;
    Test.setcurrentPage(pageref);
       //these parms are passed via custom button ?accId={!Audit__c.Id}&sampleId={!Auto_Audit_Sample_Policy__c.Id}
    Apexpages.currentPage().getParameters().put('AccId', audit.Id);
    Apexpages.currentPage().getParameters().put('sampleId', sample.Id);
 
    //create standard controller and extended controller instance
    ApexPages.StandardController sc = new ApexPages.standardController(driver);
    ParentChildExtensionDRIVERsample_New testDriverPage = new ParentChildExtensionDRIVERsample_New(sc);


    //save the controller to get the URL
    String testPage = sc.save().getUrl();
    System.debug('TestPage result:' + testPage);

    // Verify that page fails without parameters
    // System.assertEquals('/apex/failure?error=noParam', testPage);



    //TODO
    String accID=ApexPages.currentPage().getParameters().get('AccId');
    System.debug('accID: ' + accID);
    String sampleID=ApexPages.currentPage().getParameters().get('sampleId');
    System.debug('sampleID: ' + sampleID);
    
    List< Audit__c> drivers = [ select Id, Driver_Information__c, Age__c, Gender__c, Marital_Status__c, Named_Insured_Add_Driver__c, Occupation__c, Business_Use__c, MVR_Violations__c, Credit_Scoring__c                
         from Audit__c 
         where Id = :ApexPages.currentPage().getParameters().get('accId')]; 
    System.debug('Age : ' + drivers[0].Age__c );
    
  } 
}

 
I have (5) Visual Force components on a main Visual Force page. How can I best save all component data and main page using a save button on the main page? Would appreciate guidance with code examples that others may have done. Many thanks.
I cannot get records to show from a Junction Object. I have an 'Evaluation' object and an 'Audit' object both created directly from the Account object.I need to see the list of Audit records related to an account within the Exaluation object. So I've created a junction object with two Master Detail fields:
  • Audit
  • Evaluation
However, when I open the Evaluation object I see the Audit related list but there are no audit records. There are 25 audit records under the Account object. Creating an Evaluation object under the same Account. 

What could I be doing wrong ? 
I have acustom object (Audit) that should have a customer task record type called Scheduled Audit. Normally the Scheduled Audit task is created before the Audit and is used to pre schedule the actual audit. However, in the event the Scheduled Audit task does not exist and the Audit is created and saved I need to iterate over the activity related list to see if a Scheduled Audit exist. If this particular Schedueld Task record type is not found in the related list then create one. 

Is it possible to use process builder to iterate over the activities of the Audit object looking for a Scheduled Audit record ? If it does not find it then create a Scheduled Audit task 'related to ' the Audit object. 
I started to build out a simple trigger from the  to prevent a File record from being deleted from SalesForce Files | Triggers. These file records can be deleted from a related list on a visualforce page. The trigger is active but I can still delete an uploaded File . Any ideas ? 
 
trigger CREContentDocVersion on ContentVersion (before delete) {
for(ContentVersion cv : trigger.old){
        cv.adderror('Document Cannot be deleted');
    }
}

 
I have a custom object using a Visualforce page with a related list for 'Files.' The File related list can contain a PDF version of the Visualforce page that is generated by the controller to memorialize content. If an executive reviews and comments on the Visualforce page and creates the PDF how can I prevent a File from being deleted by the owner of the custom object if certain fields are populated/updated by an executive reviewer ?
<apex:relatedList list="AttachedContentDocuments"  id="FilesList" />

 
How can I format a date field from a query do that it does not cause a break as a new table row? Below is a table and the respective code.

User-added image
 
<apex:actionRegion >
<apex:outputPanel layout="block" styleClass="header1" >
<apex:pageBlockSection columns="1" id="section2aa" title="Submission Summary Information" showHeader="true" >
<html>
<body>   
<br></br>
<table> 
<tr class="alldatatables">
<th> Contracts </th>
<th> Key Contact </th>
<th> Effective Date </th>
<th> N/R </th>
<th> Type </th>
<th> Coverage </th>
<th> Subject Prem </th>
<th> QS Part of % </th>
<th> Cession Limit </th>
<th> Treaty Limit </th>
<th> Event Limit </th>
<th> Att Type </th>
<th> LAE Type </th>
<th> ECO% </th>
<th> XPL% </th>
<th> Req Brok% </th>
<th> Req Reinstatements </th>

</tr>
<apex:repeat value="{!submissionList}" var="s" >
<tr class="alldatatables"> 
<td>{!s.SPD_REF_PS__c}</td> 
<td>{!s.Key_Broker_Contact_LU_PS__c}</td>
<td>
<apex:outputText value="{0,date,MM/dd/yy}"> <apex:param value="{!s.Est_CERT_Incept_Date_PS__c}"></apex:param> </apex:outputText>
</td>
<td>{!s.Submission_New_Renew_PS__c}</td> 
<td>{!s.Submission_Type_PS__c}</td>
<td>{!s.Coverage_PS__c}</td>
<td>{!s.Subject_Premium__c}</td>
<td>{!s.QUOTA_SHARE_PART_OF__c}</td>
<td>{!s.PRO_RATA_LIMIT__c}</td>
<td>{!s.Limit__c}</td>
<td>{!s.Event_Limit__c}</td>
<td>{!s.Attachment_Type__c}</td>
<td>{!s.RSO_LAE_TYPE__c}</td>
<td>{!s.RSO_ECO_PCNT__c}</td>
<td>{!s.RSO_XPL_PCNT__c}</td>
<td>{!s.BROKERAGE_PCT__c}</td>
<td>{!"--"}</td>
</tr> 
</apex:repeat>
</table> 
</body>
</html>

</apex:pageBlockSection>
</apex:outputPanel>
</apex:actionRegion>

 
I'm using a visual force page with an extended controller. When I click on the 'Save Only' button the page reloads to the top. How can I keep the focus on the field that a user was on prior to saving ? I am using the save action on the standard controller, not the extended controller. 
 
<apex:page id="page" standardController="Comm_Auto_Audit_Sample_Policy__c"  extensions="AuditCommAutoPolicySampleController"  > 
.....
<apex:commandButton styleClass="myClass" value="Save Only" action="{!Save}"/> 
<apex:commandButton styleClass="myClass" value="Save and Return to Template" action="{!saveAndReturn}"/>

 
How do you get the '18' character id for a 'report?' Not the account Id.
I'm trying to look at the source for a report using the following URL but it's failing becase I only have the 15 character id of the report.

/services/data/v29.0/analytics/reports/00OJ0000000e1R1/describe