• Heather Hanson 18
  • NEWBIE
  • 45 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 24
    Questions
  • 46
    Replies
Hello, I'm working on a visualforce page and I can't seem to get my tables to line up the way I want them to. I've had some success, but am just having trouble finishing it off.

I need it to look like this:
User-added image
But so far I have only managed to make it look like this:
User-added image

Here is the HTML 
<table class="Cx" width="98.7%">
        <tr><td class="tac rPad" colspan="4"><strong>Telco Info</strong></td></tr>
        <tr><td class="tar rPad">Sales Order:</td><td>company name</td></tr>
        <tr><td class="tar rPad">Sales Rep:</td><td>Rebiller Group</td><td>TN:</td><td>1-800-555-5555</td></tr>
        <tr><td class="tar rPad">E-Mail:</td><td>ao@ao.ca</td></tr>
        <tr><td class="tar rPad">Original E-Mail:</td><td>ao@selectcomtelecom.ca</td></tr>
        <tr><td class="tar rPad">Original Fax:</td><td>555-555-5555</td></tr>
    </table>

    <br/>

    <div width="98.7%" class="col-container">
        
    
    <table class="Cx col" >
        <th><strong>Activty</strong></th>
        <tr><td>x</td><td>New</td><td>TF</td></tr>
        <tr><td>Add</td><td>Disc</td></tr>
		<tr><td>Change</td></tr>
        <tr><td>Seasonal Disc</td></tr>        
        <tr><td>Reconnect Date</td></tr>
     </table>

&nbsp;
    
      
    <table class="Cx col" >
		<th><strong>Service Type</strong></th>
        <tr><td>Service</td></tr>
        <tr><td>Cross Border-MCI</td></tr>
        <tr><td>Cross Border-AT&amp;T</td></tr>
        <tr><td>Other</td></tr>
        <tr><td><strong>Mass Calling</strong></td></tr>
        <tr><td>Yes</td><td>x</td><td>No</td></tr>
    </table>
    
    &nbsp;

    <table>
        <tr><td>
        <table width="100%" class="Cx col">

        <tr><td><strong>Dates</strong></td></tr>
        <tr><td>Application Date:</td>
            <td><apex:outputText value="{0,date,yyyy-MM-dd}"><apex:param value="{!Client_Line__c.LASTMODIFIEDDATE}" /></apex:outputText></td>
		</tr>
        <tr><td>Due Date: ??</td><td>what is the merge field?</td></tr>  

        </table>
        &nbsp;
        <table width="100%" class="Cx col">
        <tr><td><strong>Reference of Calls</strong></td></tr>
        <tr><td>Yes</td><td>x</td><td>No</td></tr>
        <tr><td>Refer Calls To</td></tr>
        </table>
            </td>
        </tr>
    </table>
    </div>

And the CSS is
.Cx{
    border: 1px solid #534e43;
}
.tac{
    text-align: center;
}
.tar{
    text-align: right;
}
.tal{
    text-align: left;
}
.rPad{
    padding-right: 10px;
}
.col-container {
  display: table;
  width: 98.7%;
}
.col {
  display: table-cell;
  padding: 16px;
}
Any help would be appreciated!  Been struggling with this for awhile now.
I have a Visualforce page that we render as PDF.  I need to have 14 full page images referenced at the beginning.  I've done some searching and found that the way to avoid the blank first page is to use the css: position: absolute;top:0;

This works at removing the leading blank page, but it also somehow messes with the images.  The first image referenced somes out fine, but you can see on the right that there is some of the second image and then there is no page with the second image.

I have tried a variety of different css and have yet to figure it out.  Is there a way to remove the leading blank page and keep all image tags working properly?
I'm working on a custom classic email template using HTML and when I see the preview and when I test it in my browser, my alignment is good, but when I send a test email, the alignment is off.  

Any suggestions what I can do to resolve this?

Here is what it looks like in preview:
User-added image

Here is the email test:

User-added image
Here is a bit of my code:
<body style="font-family: Montserrat, sans-serif;">
<style>
	.progress{width: 80%; height: auto; margin:0 auto 0 auto; color: #404040; font-size: 14px; }
	.p{font: Montserrat, sans-serif; text-align: left; }
</style>

<table class="progress" cellpadding="2px">
	<tr>
		<td style="vertical-align: bottom; text-align: center;" >
			<img src="https://selectcomtelecom--c.na72.content.force.com/servlet/servlet.ImageServer?id=0151H0000085hCE&oid=00DA0000000gd8G&lastMod=1581343779000" alt="orange-circle" height:20 ></td>
		<td style="">
			<p><strong>Site Survey Scheduled</strong></p>
		</td>
	</tr>

	<tr>
		<td style="vertical-align: top; text-align: center;">
			<img src="https://selectcomtelecom--c.na72.content.force.com/servlet/servlet.ImageServer?id=0151H0000085hCJ&oid=00DA0000000gd8G&lastMod=1581343802000" alt="orange-line" height="120" ></td>
		<td style="vertical-align: top; font-size: 12px;">
			<p>Friday, February 7</p>
		</td>
	</tr>

	<tr>
		<td style="vertical-align: top; text-align: center;">
			<img src="https://selectcomtelecom--c.na72.content.force.com/servlet/servlet.ImageServer?id=0151H0000085hCO&oid=00DA0000000gd8G&lastMod=1581343827000" alt="grey-circles" height="20" ></td>
		<td style="vertical-align: top;">
			<p><strong>Order Received</strong></p>
		</td>
	</tr>

	<tr>
		<td style="vertical-align: top; text-align: center;">
			<img src="https://selectcomtelecom--c.na72.content.force.com/servlet/servlet.ImageServer?id=0151H0000085hCT&oid=00DA0000000gd8G&lastMod=1581343849000" alt="grey-lines" height="20" ></td>
		<td style="vertical-align: top;">
			<p></p>
		</td>
	</tr>

 
I’m having trouble with my test class…not sure what I’m doing wrong, but I’m getting the following errors:
Illegal assignment from Map to List (line 6)
Method does not exist or incorrect signature: void getRecTypeId(String) from the type RecordTypeSelector (line 11)

My test class is for a custom record type selector component on my Asset object for my customer object OrderProject__c.

Any help would be appreciated!!
 
@isTest
public class TestRecordTypeSelector {


static testmethod void testFetchRecordTypes() {
    List<String> value = RecordTypeSelector.fetchRecordTypeValues('Asset');
  }

 static testmethod void testgetRecordTypeId() {
    String recordTypeLabel = 'Avaya';
    ID testId = RecordTypeSelector.getRecTypeId(recordTypeLabel);
    System.assert(testId != null);
  }
}

 
I'm using apex:datatable for my Visualforce page when rendered as PDF.

I want to visually separate the rows based on the value of a specific field.

The datatable provides the opportunitylineitems and I'm trying to organize the results using "render" on the columns, which seems to work, but I also want a break between certain rows.

Here is an image of what I'm TRYING to do:
User-added image

I have tried simply adding the <br/> between columns in the datatable, but that didn't work.

I have also tried creating multiple datatables and wrapping them in an output panel so that I could then add a <br/>, but the PDF generation failed when I tried that.

I also tried using apex:repeat to see if I could solve the problem with that tag, but couldn't figure it out.

Any help would be appreciated!
Trying to make updates to an existing form that we also render as PDF.  The HTML version of the form worked fine with my changes, but as usual, I'm having trouble with rendering as PDF.

I basically want to group products in their own box based on the Product Type. 

An example is below, but when I add the second datatable with the new category, I get the PDF generation error message.  I checked to make sure I didn't make a mistake somewhere by duplicating the first one and that worked (so I had two groups with the same set of products), so it seems just when I try to pull a different batch of products that the error message occurs.  

My product type name is correct and there are values available (as I know if there is no value sometimes this also causes a generation fail).

Does anyone have any suggestions as to how I can fix this?
<apex:dataTable value="{!Opportunity.opportunityLineItems}" var="OP" style="width:98.7%">
                  <apex:column rendered="{!OP.Product_Type__c = 'Mandatory'}" headerValue="Item" value="{!OP.ProductCode}" headerClass="column_ttl tal" styleClass="tbl_bdr tal" style="width:8%;"></apex:column>
                  <apex:column rendered="{!OP.Product_Type__c = 'Mandatory'}" headerValue="{!set}" value="{!OP.Set__c}" headerClass="column_ttl tal" styleClass="tbl_bdr tal" style="width:5%;"></apex:column>
                  <apex:column rendered="{!OP.Product_Type__c = 'Mandatory'}" headerValue="{!lblQty}" headerClass="column_ttl tac" styleClass="tbl_bdr tac" style="width:5%;"><apex:outputText value="{0, number,###,###,##0}"><apex:param value="{!OP.Quantity}" /></apex:outputText></apex:column>
                  <apex:column headerValue="Description" value="{!OP.PriceBookEntry.Name}" headerClass="column_ttl" styleClass="tbl_bdr" rendered="{!OP.Product_Type__c = 'Mandatory' && Opportunity.Language__c = 'ENGLISH'}"></apex:column>
                  <apex:column headerValue="Description" value="{!OP.Product2.Product_name_french__c}" headerClass="column_ttl" styleClass="tbl_bdr" rendered="{!OP.Product_Type__c = 'Mandatory' && Opportunity.Language__c = 'FRENCH'}"></apex:column>
                  <apex:column rendered="{!OP.Product_Type__c = 'Mandatory'}" headerValue="{!lblMonthPrice}" headerClass="column_ttl tac" styleClass="tbl_bdr tar" style="width:15%;">
                	<apex:outputText value="{0, number,###,###,##0.00}" rendered="{!OP.Payment_Description__c = 'Monthly'}">$<apex:param value="{!OP.UnitPrice}" /></apex:outputText>
                	<apex:outputText value="$0.00"  rendered="{!OP.Payment_Description__c != 'Monthly'}"/>
                  </apex:column>
                  <apex:column rendered="{!OP.Product_Type__c = 'Mandatory'}" headerValue="{!lblOneChrg}" headerClass="column_ttl tac" styleClass="tbl_bdr tar" style="width:15%;" >
                    <apex:outputText value="{0, number,###,###,##0.00}" rendered="{!OP.Payment_Description__c = '1X Fee'}">$<apex:param value="{!OP.UnitPrice}" /></apex:outputText>
                	<apex:outputText value="$0.00"  rendered="{!OP.Payment_Description__c != '1X Fee'}"/>
                  </apex:column>
                  <apex:column rendered="{!OP.Product_Type__c = 'Mandatory'}" headerValue="{!lblSubTot}" value="{!OP.TotalPrice}" headerClass="column_ttl tac" styleClass="tbl_bdr tar" style="width:15%;"></apex:column>
                </apex:dataTable>
              <br/>
                <apex:dataTable value="{!Opportunity.opportunityLineItems}" var="OP" style="width:98.7%">
                  <apex:column rendered="{!OP.Product_Type__c = 'Base'}" headerValue="Item" value="{!OP.ProductCode}" headerClass="column_ttl tal" styleClass="tbl_bdr tal" style="width:8%;"></apex:column>
                  <apex:column rendered="{!OP.Product_Type__c = 'Base'}" headerValue="{!set}" value="{!OP.Set__c}" headerClass="column_ttl tal" styleClass="tbl_bdr tal" style="width:5%;"></apex:column>
                  <apex:column rendered="{!OP.Product_Type__c = 'Base'}" headerValue="{!lblQty}" headerClass="column_ttl tac" styleClass="tbl_bdr tac" style="width:5%;"><apex:outputText value="{0, number,###,###,##0}"><apex:param value="{!OP.Quantity}" /></apex:outputText></apex:column>
                  <apex:column headerValue="Description" value="{!OP.PriceBookEntry.Name}" headerClass="column_ttl" styleClass="tbl_bdr" rendered="{!OP.Product_Type__c = 'Base' && Opportunity.Language__c = 'ENGLISH'}"></apex:column>
                  <apex:column headerValue="Description" value="{!OP.Product2.Product_name_french__c}" headerClass="column_ttl" styleClass="tbl_bdr" rendered="{!OP.Product_Type__c = 'Base' && Opportunity.Language__c = 'FRENCH'}"></apex:column>
                  <apex:column rendered="{!OP.Product_Type__c = 'Base'}" headerValue="{!lblMonthPrice}" headerClass="column_ttl tac" styleClass="tbl_bdr tar" style="width:15%;">
                	<apex:outputText value="{0, number,###,###,##0.00}" rendered="{!OP.Payment_Description__c = 'Monthly'}">$<apex:param value="{!OP.UnitPrice}" /></apex:outputText>
                	<apex:outputText value="$0.00"  rendered="{!OP.Payment_Description__c != 'Monthly'}"/>
                  </apex:column>
                  <apex:column rendered="{!OP.Product_Type__c = 'Base'}" headerValue="{!lblOneChrg}" headerClass="column_ttl tac" styleClass="tbl_bdr tar" style="width:15%;" >
                    <apex:outputText value="{0, number,###,###,##0.00}" rendered="{!OP.Payment_Description__c = '1X Fee'}">$<apex:param value="{!OP.UnitPrice}" /></apex:outputText>
                	<apex:outputText value="$0.00"  rendered="{!OP.Payment_Description__c != '1X Fee'}"/>
                  </apex:column>
                  <apex:column rendered="{!OP.Product_Type__c = 'Base'}" headerValue="{!lblSubTot}" value="{!OP.TotalPrice}" headerClass="column_ttl tac" styleClass="tbl_bdr tar" style="width:15%;"></apex:column>
                </apex:dataTable>

 
Hello,

I'm a novice at Apex code and am trying to adjust my extension for SavePDF so that it saves as a file as well.  I get an error message related to the line that says:  file.Origin = 'a';

I am indicating the wrong origin or something?  Or do I need to complete the attachment fully before I can add the file?  Any help would be appreciated!

 
public pageReference savePDF(){
    
        Date dateToday = Date.today();
        String sMonth = String.valueof(dateToday.month());
        String sDay = String.valueof(dateToday.day());
        if(sMonth.length()==1){
          sMonth = '0' + sMonth;
        }
        if(sDay.length()==1){
          sDay = '0' + sDay;
        }
        String sToday = String.valueof(dateToday.year())+ '-' + sMonth +  '-' + sDay ;
        
      PageReference pagePdf = new PageReference('/apex/SalesAgreement_PDF');
          pagePdf.getParameters().put('id', idVal);
          Blob pdfPageBlob;
          pdfPageBlob = pagePdf.getContentAsPDF();
                 
          Attachment a = new Attachment();
          a.Body = pdfPageBlob;
          a.ParentID = idVal;
          a.Name = 'Service_Agreement_' + strOppName + '_' + sToday + '.pdf';
          a.Description = 'Service Agreement_' + sToday;
          insert a;

          ContentVersion file = new ContentVersion();
		  file.Title = 'Service_Agreement_' + strOppName + '_' + sToday + '.pdf';
		  file.PathOnClient = 'Service_Agreement_' + Datetime.now().getTime() + '.txt';
		  file.VersionData = Blob.valueOf('Service_Agreement_' + 
		  Datetime.now().getTime() + '.txt');
		  file.Origin = 'a';
		  insert file;         
    
        
        pop_msg='Successfully saved';
        displayPopup = true;  
       
        
        opp.Signature_Date__c = null;
        opp.Signature_Key__c = '';
        opp.Signature_Name__c = '';
        opp.Signature_URL__c = null;
        opp.Signature__c = null;

        
        update opp;
      return new PageReference('/apex/SalesAgreement_HTML?id=' + idVal);
      
        
    }



 
My PMs want to see which other opportunities have been signed when they receive an approved opportunity.  I created a VF page add an opportunity related list and it works, but I can't figure out how to ONLY show those where StageName = 'SIGNED'.  

Any help would be appreciated...
 
<apex:page standardController="Opportunity" showHeader="false" sidebar="false" readOnly="true">
<style type="text/css">
.actionColumn {display:none; visibility:hidden}
</style>

    <apex:relatedList list="Account.Opportunities">
    <apex:facet name="header"><center><b></b></center></apex:facet>
    </apex:relatedList>

</apex:page>

 
I need to create a popup alert on Account object that is triggered when the related contacts (related list) need to be updated.  So I want to look at a custom date field in Contact "Last_Verified__c" and if it is blank or older than 2 years this should trigger the popup on the Account to recommend updating the contacts.

I can figure out the visualforce page, but I'm still new to Apex (I've only got about 3 triggers so far) and this one feels a little complicated.  Can anyone help get me started on the Apex Class?

Thanks!
My Visualforce page is throwing an error sometimes saying to check the markup. I've made sure of the following:

- No empty fields
- I've removed render PDF and the HTML generates with no problem
- I've removed my code until I found the trouble area and it is my datatable, specifically the IF statement in my columns.
- My last attempt to resolve the issue was to make sure that the field represented in the IF statement appears as a column...still didn't solve the issue.

Here is the data table section of the VF page:
 
<apex:dataTable value="{!Account.Hardware__r}" var="AH" columns="3" cellPadding="0" border="1" width="100%"  headerclass="Mheader_sm" title="Returned Equipment">
            
            <apex:column headerValue="PRODUCT NAME" rendered="{!IF(AH.Client_Returned_Date_VF__c = TODAY(),true,false)}" value="{!AH.Product_Txt__c}" styleClass="tbl_bdr" /> 
            <apex:column headerValue="SERIAL #" rendered="{!IF(AH.Client_Returned_Date_VF__c = TODAY(),true,false)}" value="{!AH.Serial_Number__c}"  styleClass="tbl_bdr"/>
            <apex:column headerValue="RETURNED DATE" rendered="{!IF(AH.Client_Returned_Date_VF__c = TODAY(),true,false)}" value="{!AH.Client_Returned_Date_VF__c}"  styleClass="tbl_bdr"/>

        </apex:dataTable>

The fields Product_Txt__c and Client_Returned_Date_VF__c are both formula fields (text and date respectively)...here's a screenshot of their properties:

User-added image

User-added image

The problem seems to occur if the Account related list have multiple Hardware records and although the formula fields above are populated, if the "Client_Returned_Date__c" mentioned in the Client_Returned_Date_VF__c formula is blank on one of them, it throws the PDF generation failed. Check the page markup is valid. 

So to repeat, there is a value for the 3 fields mentioned in my data table for ALL records, but it is still throwing the error....any suggestions what I could do next to troubleshoot this?

Here is a sample of one that is throwing that error:

User-added image
I think I know WHY I'm getting the error, but still haven't solved it.

I have a visualforce page that renders as PDF.  It is a receipt for returned hardware.  We have a Hardware custom object and my VF page has a conditional rendering to only show the Hardware Product Name and Serial number originally, if the "Client_Returned_Date__c" = TODAY. 

We then got the error message above for one account and I realized it is probably because some records may have nothing populated in the "Client_Returned_Date__c" field so I created a Date Formula field that says: IF(Client_Returned_Date__c = TODAY(), Client_Returned_Date__c, DATE(2000,01,01) ). It means the person would have to update all previous hardware, but there is not many so it isn't that much and going forward the field will always be populated so it won't always be an issue.

So I updated my VF page conditional rendering to use this new formula field instead and tested.  My formula field works as expected, but I still get the error message above (even though there is now a value for each record for this formula field.  I also checked the other fields indicated (Product name and Serial number) and there are values in all.

Any suggestions what I'm overlooking?

Here is the VF page if it helps!:
 
<apex:page standardController="Account" applyHtmlTag="true" showHeader="false" renderAs="PDF">

<apex:stylesheet value="{!$Resource.AssetReceipt_PDF}"/>
<apex:stylesheet value="http://fonts.googleapis.com/css?family=Open+Sans"/>



      
    <table cellspacing="0" border="0" cellpadding="0" width="98%">  
        <tr>
            <td width="80%" valign="top"><apex:image id="logo" url="{!$Resource.logo_bkp}"/> </td>
            <td width="18%">               
                <table id="servicetbl" cellspacing="0" border="0" cellpadding="5">
                    <tr><td colpsan="3"></td></tr>     
                    <tr>
                    <td class="rt" width="20%">Date:&nbsp;<apex:outputText value="{0,date,yyyy-MM-dd 'Time:' hh:mm}"> <apex:param value="{!NOW () - 0.208333}" /></apex:outputText></td>                    
                    </tr>
                </table>
            </td>
        </tr>
    </table>   
    
    <br clear="all" />
    <div class="full_line">{!Account.Name}</div><br clear="all"/>
    <div class="full_line">{!Account.AccountNumber}</div><br clear="all"/>

    <div >
        <br/>
        <br/>
        <h2>ÉQUIPEMENT RETOURNÉ</h2><br clear="all"/>
        <apex:dataTable value="{!Account.Hardware__r}" var="AH" columns="6" cellPadding="0" border="1" width="100%"  headerclass="Mheader_sm" title="Returned Equipment">
            
            <apex:column headerValue="PRODUCT NAME" rendered="{!IF(AH.Client_Returned_Date_VF__c = TODAY(),true,false)}" value="{!AH.Product_Txt__c}" styleClass="tbl_bdr" /> 
            <apex:column headerValue="SERIAL #" rendered="{!IF(AH.Client_Returned_Date_VF__c = TODAY(),true,false)}" value="{!AH.Serial_Number__c}"  styleClass="tbl_bdr"/>

        </apex:dataTable>
    </div>    
   
    <div class="full_line">
        
    <table>
    <tr>
    <td style="border-bottom:1px solid #000000; height:75px; width:40%;"></td>
    </tr>  
    <tr>
    <td>Heather Hanson</td>
    </tr>
    </table>
    </div>
    
        <div class="footerC">
            <div class="cover_footer">My company info</div>    
        </div>
           
 
 </apex:page>

 
I'm still reallly new to triggers.  I have 2 custom objects, "Work_Order__c" and "OrderProject__c", Work Order is a child of Account and Order Project is just related to Account with a look up field.

Order Project and Work Order are also related.  I have a related list for Work Order in the Order Project object. So Work Orders are created from an Order Project.

I created a field in Order Project called "Installatin_WO__c".  I need this field to be populated with the "Name" of the Work Order in the related list found in the Order Project that has the Work_Order_Type__c of "Installation".

I've only ever successfully created one trigger before and it is very similar to what I want to accomplish here, but I'm running into a couple of errors so I think I may be lacking understanding....

Below is what I have and the 2 error messages I have are:


Line: 9 Name, Work_Order_Type__c from Work_Order__c Where Work_Order_Type__c
                              ^
ERROR at Row:1:Column:60
Didn't understand relationship 'Work_Order__c' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.


AND

Line 17: Variable does not exist: WO

Any help correcting this would be greatly appreciated!!
trigger PM_WO_Installation on OrderProject__c (before insert, before update) {

set<Id> AccountIds = new set<Id>();
for (OrderProject__c  pm: trigger.new) {
	AccountIds.add(pm.Account_ID__c);
}
map<Id, Account> AccountWOMap = new map<Id, Account>();
list<Account> AccWOs = new list<Account>();
AccWOs = [Select Id, Name, (Select Id, Name, Work_Order_Type__c from Work_Order__c Where Work_Order_Type__c = 'Installation') from Account where Id IN : AccountIds];
for(Account acc : AccWOs){
    AccountWOMap.put(acc.Id, acc);
}
    for (OrderProject__c  pm: trigger.new) {
       if(pm.Installation_WO__c == null){
			Account Acc = AccountWOMap.get(pm.Account_ID__c);
			if(Acc != null){
				List<Work_Order__c> WO = new list<Work_Order__c>(Acc.WO);
				if(WO.size() == 1){
					pm.Installation_WO__c = WO[0].Id;
				}
			}
		}
	}

}

 
A few months ago, I was asked to add to our existing Visualforce page, two more pages that present the products chosen in a certain way.  Our products got labelled "NQP" if it was equipment and "HPX, HPS, or LIC" if it was a service, and "CNT" if it was an activation fee.

Rendering the page to PDF has been termpermental ever since. Sometimes it works and sometimes I get the error message.  I have checked and ensured that each product has it's label as I know that was the cause of the problem at times.  Sometimes when the problem occurs, I find just removing all the products and picking them all again helps, but right now I'm currently stuck on fixing one and also would like for this problem to just not happen anymore.

I read that empty columns cause problems on the render PDF, so I fixed that, but I'm still having issues.  I think I have narrowed the issue down to one of the two pages that I had to add.  Here is the code for the HTML version (we have a button in the HTML that is linked to the PDF rendered version).
<table class="column_ttl2" style="width:100%;">
                            <tr>
                            <td style="width:10%;" class="tac">TR Code</td>                                
                            <td style="width:5%;">Qty</td>
                            <td class="tal">Description</td>
                            <td style="width:15%;" class="tac">Unit Price</td>
                            <td style="width:15%;" class="tac">Totals</td>
                            </tr>
                        </table>
                 <apex:pageBlock >
                         <apex:pageblocktable value="{!Opportunity.opportunityLineItems}" var="OP" styleClass="items_tbl">
                            <apex:column rendered="{!OP.TR_Service_Group__c = 'NQP'}" headerValue="TR Code" headerClass="column_ttl tac" styleClass="tbl_bdr tac" style="width:10%;"><apex:outputText value="{!OP.TR_Service_Group__c}"/></apex:column>
                            <apex:column rendered="{!OP.TR_Service_Group__c = 'NQP'}" headerValue="{!lblQty}" headerClass="column_ttl tac" styleClass="tbl_bdr tac" style="width:5%;"><apex:outputText value="{0, number,###,###,##0}"><apex:param value="{!OP.Quantity}" /></apex:outputText></apex:column>
                            <apex:column headerValue="Description" value="{!OP.PriceBookEntry.Name}" headerClass="column_ttl" styleClass="tbl_bdr" rendered="{!OP.TR_Service_Group__c = 'NQP' && Opportunity.Language__c = 'ENGLISH'}"></apex:column>
                            <apex:column headerValue="Description" value="{!OP.Product2.Product_name_french__c}" headerClass="column_ttl" styleClass="tbl_bdr" rendered="{!OP.TR_Service_Group__c = 'NQP' && Opportunity.Language__c = 'FRENCH'}"></apex:column>
                            <apex:column rendered="{!OP.TR_Service_Group__c = 'NQP'}" headerValue="{!lblUnitPrice}" value="{!OP.UnitPrice}" headerClass="column_ttl tac" styleClass="tbl_bdr tar" style="width:15%;"></apex:column>
                            <apex:column rendered="{!OP.TR_Service_Group__c = 'NQP'}" headerValue="{!lblSubTot}" value="{!OP.TotalPrice}" headerClass="column_ttl tac" styleClass="tbl_bdr tar" style="width:15%;"></apex:column>
                     </apex:pageblocktable>
                     
                        <apex:outputPanel rendered="{!strServiceType = 'HPBX'}">
                            <apex:pageblocktable value="{!Opportunity}" var="OPP" headerClass="hidden" >
                                <apex:column styleClass="tbl_bdr tac" style="width:10%;"><apex:outputText >HPX+HPS</apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tac" style="width:5%;"><apex:outputText value="{0, number,###,###,##0}"><apex:param value="{!OPP.TR_Prepaid_Unifon_Services_Qty__c}" /></apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tal" ><apex:outputText >Prepaid Unifôn Services</apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tar" style="width:15%;" value="{!OPP.TR_Prepaid_Unifon_Services__c}"/>  
                                <apex:column styleClass="tbl_bdr tar" style="width:15%;" value="{!OPP.TR_Prepaid_Unifon_Services__c}"/>  
                            </apex:pageblocktable>
                        </apex:outputPanel>
                     
                        <apex:outputPanel rendered="{!strServiceType ='Unifôn IP Connect' && CONTAINS(Opportunity.Financing_Term__c, '36')}">
                            <apex:pageblocktable value="{!Opportunity}" var="OPP" headerClass="hidden" >
                                <apex:column styleClass="tbl_bdr tac" style="width:10%;"><apex:outputText >HPX+HPS</apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tac" style="width:5%;"><apex:outputText value="{0, number,###,###,##0}"><apex:param value="{!OPP.TR_Prepaid_Unifon_Services_Qty__c}" /></apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tal" ><apex:outputText >Prepaid Unifôn Services</apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tar" style="width:15%;" value="{!OPP.TR_Prepaid_Unif_n_Service_36__c}"/>  
                                <apex:column styleClass="tbl_bdr tar" style="width:15%;" value="{!OPP.TR_Prepaid_Unif_n_Service_36__c}"/>  
                            </apex:pageblocktable>
                        </apex:outputPanel>   

                        <apex:outputPanel rendered="{!strServiceType ='Unifôn IP Connect' && CONTAINS(Opportunity.Financing_Term__c, '60')}">
                            <apex:pageblocktable value="{!Opportunity}" var="OPP" headerClass="hidden" >
                                <apex:column styleClass="tbl_bdr tac" style="width:10%;"><apex:outputText >HPX+HPS</apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tac" style="width:5%;"><apex:outputText value="{0, number,###,###,##0}"><apex:param value="{!OPP.TR_Prepaid_Unifon_Services_Qty__c}" /></apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tal" ><apex:outputText >Prepaid Unifôn Services</apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tar" style="width:15%;" value="{!OPP.TR_Prepaid_Unif_n_Service_60__c}"/>  
                                <apex:column styleClass="tbl_bdr tar" style="width:15%;" value="{!OPP.TR_Prepaid_Unif_n_Service_60__c}"/>  
                            </apex:pageblocktable>
                        </apex:outputPanel> 
                     
                      <apex:pageblocktable value="{!Opportunity}" var="OPP" headerClass="hidden" >
                                <apex:column styleClass="tbl_bdr tac" style="width:10%;"><apex:outputText >CNT</apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tac" style="width:5%;"><apex:outputText value="{0, number,###,###,##0}"><apex:param value="{!OPP.TR_Interconnection_Installation_Qty__c}" /></apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tal" ><apex:outputText >Interconnection: Installation</apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tar" style="width:15%;" value="{!OPP.TR_Interconnection_Installation__c}"/>
                                <apex:column styleClass="tbl_bdr tar" style="width:15%;" value="{!OPP.TR_Interconnection_Installation__c}"/>
                     </apex:pageblocktable>
Here is the PDF version.  
 
<table class="column_ttl" style="width:98.7%;">
                            <tr>
                            <td style="width:10%;" class="tac">TR Code</td>                                
                            <td style="width:5%;">Qty</td>
                            <td class="tal">Description</td>
                            <td style="width:15%;" class="tac">Unit Price</td>
                            <td style="width:15%;" class="tac">Totals</td>
                            </tr>
                        </table>
                        

                        <apex:dataTable value="{!Opportunity.opportunityLineItems}" var="OP" style="width:98.7%">
                            <apex:column rendered="{!OP.TR_Service_Group__c = 'NQP'}" headerValue="TR Code" headerClass="column_ttl tac" styleClass="tbl_bdr tac" style="width:10%;"><apex:outputText value="{!OP.TR_Service_Group__c}"/></apex:column>
                            <apex:column rendered="{!OP.TR_Service_Group__c = 'NQP'}" headerValue="{!lblQty}" headerClass="column_ttl tac" styleClass="tbl_bdr tac" style="width:5%;"><apex:outputText value="{0, number,###,###,##0}"><apex:param value="{!OP.Quantity}" /></apex:outputText></apex:column>
                            <apex:column headerValue="Description" value="{!OP.PriceBookEntry.Name}" headerClass="column_ttl" styleClass="tbl_bdr" rendered="{!OP.TR_Service_Group__c = 'NQP' && Opportunity.Language__c = 'ENGLISH'}"></apex:column>
                            <apex:column headerValue="Description" value="{!OP.Product2.Product_name_french__c}" headerClass="column_ttl" styleClass="tbl_bdr" rendered="{!OP.TR_Service_Group__c = 'NQP' && Opportunity.Language__c = 'FRENCH'}"></apex:column>
                            <apex:column rendered="{!OP.TR_Service_Group__c = 'NQP'}" headerValue="{!lblUnitPrice}" value="{!OP.UnitPrice}" headerClass="column_ttl tac" styleClass="tbl_bdr tar" style="width:15%;"></apex:column>
                            <apex:column rendered="{!OP.TR_Service_Group__c = 'NQP'}" headerValue="{!lblSubTot}" value="{!OP.TotalPrice}" headerClass="column_ttl tac" styleClass="tbl_bdr tar" style="width:15%;"></apex:column>
                        </apex:dataTable>
                        
                        <apex:outputPanel rendered="{!strServiceType = 'HPBX'}">    
                            <apex:dataTable value="{!Opportunity}" var="OPP" headerClass="hidden"  style="width:98.7%">
                                <apex:column styleClass="tbl_bdr tac" style="width:10%;"><apex:outputText >HPX+HPS</apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tac" style="width:5%;"><apex:outputText value="{0, number,###,###,##0}"><apex:param value="{!OPP.TR_Prepaid_Unifon_Services_Qty__c}" /></apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tal" ><apex:outputText >Prepaid Unifôn Services</apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tar" style="width:15%;" value="{!OPP.TR_Prepaid_Unifon_Services__c}"/>  
                                <apex:column styleClass="tbl_bdr tar" style="width:15%;" value="{!OPP.TR_Prepaid_Unifon_Services__c}"/>  
                            </apex:dataTable>
                        </apex:outputPanel>

                        <apex:outputPanel rendered="{!strServiceType ='Unifôn IP Connect' && CONTAINS(Opportunity.Financing_Term__c, '36')}">    
                            <apex:dataTable value="{!Opportunity}" var="OPP" headerClass="hidden"  style="width:98.7%">
                                <apex:column styleClass="tbl_bdr tac" style="width:10%;"><apex:outputText >HPX+HPS</apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tac" style="width:5%;"><apex:outputText value="{0, number,###,###,##0}"><apex:param value="{!OPP.TR_Prepaid_Unifon_Services_Qty__c}" /></apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tal" ><apex:outputText >Prepaid Unifôn Services</apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tar" style="width:15%;" value="{!OPP.TR_Prepaid_Unif_n_Service_36__c}"/>  
                                <apex:column styleClass="tbl_bdr tar" style="width:15%;" value="{!OPP.TR_Prepaid_Unif_n_Service_36__c}"/>  
                            </apex:dataTable>
                        </apex:outputPanel>

                        <apex:outputPanel rendered="{!strServiceType ='Unifôn IP Connect' && CONTAINS(Opportunity.Financing_Term__c, '60')}">    
                            <apex:dataTable value="{!Opportunity}" var="OPP" headerClass="hidden"  style="width:98.7%">
                                <apex:column styleClass="tbl_bdr tac" style="width:10%;"><apex:outputText >HPX+HPS</apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tac" style="width:5%;"><apex:outputText value="{0, number,###,###,##0}"><apex:param value="{!OPP.TR_Prepaid_Unifon_Services_Qty__c}" /></apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tal" ><apex:outputText >Prepaid Unifôn Services</apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tar" style="width:15%;" value="{!OPP.TR_Prepaid_Unif_n_Service_60__c}"/>  
                                <apex:column styleClass="tbl_bdr tar" style="width:15%;" value="{!OPP.TR_Prepaid_Unif_n_Service_60__c}"/>  
                            </apex:dataTable>
                        </apex:outputPanel>    
    
                            <apex:dataTable value="{!Opportunity}" var="OPP" headerClass="hidden" style="width:98.7%">
                                <apex:column styleClass="tbl_bdr tac" style="width:10%;"><apex:outputText >CNT</apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tac" style="width:5%;"><apex:outputText value="{0, number,###,###,##0}"><apex:param value="{!OPP.TR_Interconnection_Installation_Qty__c}" /></apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tal" ><apex:outputText >Interconnection: Installation</apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tar" style="width:15%;" value="{!OPP.TR_Interconnection_Installation__c}"/>
                                <apex:column styleClass="tbl_bdr tar" style="width:15%;" value="{!OPP.TR_Interconnection_Installation__c}"/>
                            </apex:dataTable>

Any suggestions for improvement or trouble shooting would be greatly appreciated!
I created 1 new Trigger and a Test Class and it is saying that my overall code coverage is now 74%...but the test itself passes.

Maybe I'm missing something in my test?  Although I have a very similar trigger already and it is in production so not sure why this one is causing problems...

Here is the Trigger:
Trigger OppContactResi on Opportunity (before insert, before update) { 

set<Id> AccountIds = new set<Id>();
for (Opportunity  o: trigger.new) {
	AccountIds.add(o.AccountId);
}


map<Id, Account> AccountContactMap = new map<Id, Account>();
list<Account> AccConts = new list<Account>();
AccConts = [Select Id, Name, (Select Id, Name, Contact_Role__c from Contacts Where Contact_Role__c = 'MAIN CONTACT') from Account where Id IN : AccountIds];
for(Account acc : AccConts){
    AccountContactMap.put(acc.Id, acc);
}

for (Opportunity  o: trigger.new) {
       if(o.Contact__c == null && o.RecordTypeID == '0121H0000019Lna'){
			Account Acc = AccountContactMap.get(o.AccountId);
			if(Acc != null){
				List<Contact> conts = new list<Contact>(Acc.Contacts);
				if(conts.size() == 1){
					o.Contact__c = conts[0].Id;
				}
			}
		}
	}
}

Here is the TestClass:
 
@isTest 

public class OppContactResiTEST {
    
    static testMethod void createAccount()
	{

		Account a = new Account();
		a.Name = 'Test';
        a.RecordTypeId = '0121H0000019LnX';
        a.Language__c = 'ENGLISH';
		insert a;
		System.debug('created account');
			
		//Then create a non Main contact
		Contact c = new Contact();
        c.RecordtypeId = '0121H0000019LnZ';
		c.FirstName = 'Paul';
		c.LastName  = 'Test';
		c.AccountId = a.id;
		c.Contact_Role__c = 'BILLING CONTACT';
        c.Phone = '514-722-5656';
		insert c;
		System.debug('created signing contact');
			
		//Then create another Main contact
		Contact ci = new Contact();
		ci.FirstName = 'Bob';
		ci.LastName  = 'Test';
		ci.AccountId = a.id;
		ci.Contact_Role__c = 'MAIN CONTACT';
        ci.Phone = '514-722-5656';
		insert ci;
		System.debug('created non-signing contact');
        
        
        
        //Create Top Shelf Settings
        Scout__TopShelf_Settings__c ts = new Scout__TopShelf_Settings__c();
        ts.Scout__TopShelf_Username__c = 'selectcom';
        ts.Scout__TopShelf_Password__c = 'Fhtmdvp2';
        ts.Scout__My_Account__c = a.id;
        insert ts;
        System.debug('created top shelf settings');
		
       
		//Now create an opportunity
		Opportunity o = new Opportunity();
        o.AccountId = a.id;
        o.Name = 'Test -';
        o.Service_Agreement_Type__c = 'Residential Services';
		o.StageName = 'NEW - CALL IN';
		o.Type = 'SALES';
		o.CloseDate = Date.today();
        o.RecordTypeId = '0121H0000019Lna';
        o.Requested_Install_Time__c = '	In the morning (9:00am-12:00pm)';
        o.Internet_Requested__c = TRUE;
        o.Existing_Internet_Provider__c = 'Bell';
        o.Existing_Internet_Service__c = 'Yes';
        o.If_Bell_is_internet_on_line_or_Dry_Loop__c = 'Line';
        o.Language__c = 'ENGLISH';  
        o.Router_Option__c = 'Customer already has router';
		insert o;
		System.debug('created opportunity');
    		
        

	}
}

​​​​​​​
I've completed the Developer Basic trail and the Apex lessons, but I only have minimal experience using Apex Triggers and Classes and have been struggling all afternoon to figure out the best and most user friendly way to do this.

I need to validate fields on the Opportunity object when someone clicks the "Submit for Approval" button related to an approval process.  Since validation rules do not work with field updates in the approval process, I though I could do an Apex Trigger instead using add.error method.

I have been working on my trigger and listing all the possible things to validate, but I ran into the issue where it only throws one error message at a time.  So I investigated further and now I'm not sure if I need to create a visualforce page or just adjust my trigger to fix it.  I would like to do visualforce as well since I don't like the screen that pops up with the error message.  I'm comfortable with Visual force, but I'm not sure how to tie in my trigger and do I need to write a separate controller for the Visualforce page.

Any guidance would be greatly appreciated!!

Here is my trigger...again I'm new so please excuse me if it is totally the wrong way to go about this...
 
trigger OppResiApprovalVali on Opportunity (before update) {

  for(Opportunity o : trigger.new)
  {  if(o.RecordTypeId=='0121H0000019Lna' && o.StageName=='PRE-PROVISIONING' && o.Internet_Requested__c==TRUE)
   {     
        if(o.Existing_Internet_Service__c==null)      
    {
      o.Existing_Internet_Service__c.addError('Please make a selection for Existing Internet Service.');
    }
       
       if(o.Existing_Internet_Provider__c==null && o.Existing_Internet_Service__c=='Yes')
       {
           o.addError ('Please make a selectcion for Existing Internet Provider.');           
       }     
          if(o.Existing_Internet_Provider__c=='Bell' && o.If_Bell_is_internet_on_line_or_Dry_Loop__c==null)
       {
           o.addError ('Please make a selectcion for If Bell, is internet on line or Dry Loop');           
       }
             if(o.Router_Option__c==null)
       {
           o.addError ('Please make a selectcion for Router Option');           
       }
   }
   
   {if(o.RecordTypeId=='0121H0000019Lna' && o.StageName=='PRE-PROVISIONING' && o.Home_Digital_Line_Requested__c==TRUE)
   {
       if(o.Telephone_to_be_transferred__c==null)      
    {
      o.addError('Please provide a response to Telephone Number to be Transferred.');
    }
       if(o.Current_Provider__c==null)      
    {
      o.addError('Please make a selection for Current Provider');
    }
       if(o.Call_Forward_Not_Reachable__c==null)      
    {
      o.addError('Please provide a response to Call Forward Not Reachable Number');
    }
      
       
   }
       
   }
     
   
   }

}

 
I have a Visualforce page that generates our company's orders.  It is in HTML and they can also render it as PDF. There is a portion of the page that pulls info from an "Opportunity Type" field as well as the "Opportunity Name" field.  Our "Opportunity Name" field is programmed to be auto set as "Account Name - Opportunity Type".  We have several Opportunity Types. 

The glitch that occured was that no matter what the opportunity type was, the Visualforce Page was showing Opportunity Type "MAC"...even in the Opportunity Name as well.

I checked all of my markup and found nothing that would cause this problem so I started looking at the fields themselves.  The account name was quite long, but didn't get cut off in character limits for the field, but I noticed that when I reduced the size of the account name my glitch went away, so it seems like there is some sort of character limit.

I'm not super technical and pretty much self taught so I'm hoping that it is just that I'm not aware of something and hopefully that it is a fixable issue instead of a glitch or limitation.

Any advice?
Looking for suggestions...I have run out of ideas.  I have added 2 sections to my existing Visualforce page (problem code below). When testing in Sandbox, I ran into an issue with the second section...it was preventing me from rendering as PDF.  After breaking my brain for a few hours, I realized that field TR_Service_Group__c was not populated in any of the Opportunity Products that were being called on and once I ensured there was an TR_Service_Group__c with the value of "NQP", it worked fine.

I had to push into production before I could test further to make sure this issue would not come up further and of course, right away it didn't work.  Render as PDF is saying I need to check mark up to make sure it is valid.

I have ensured that both TR_Service_Group__c and Lease_Service_Group__c are populated in all products so that can't be the issue.  I've done some research and so have also checked by removing the "Render as PDF" and it worked fine in HTML.  I played around with API versions, but I was already on 41 and now 43 and all research said above 28 should be fine in posts about this issue.  I've checked security on the fields since they are new and they are visible and editable.

Any troubleshooting suggestions appreciated!!

Here are the sections that are causing the problem (through process of elimination...without these sections of code, the PDF works).  I think the mark up is fine because I had it working in Sandbox...
 
<apex:dataTable value="{!Opportunity.opportunityLineItems}" var="OP" style="width:98.7%">
                            <apex:column rendered="{!OP.Lease_Service_Group__c = 'NQP'}" headerValue="{!lblQty}" headerClass="column_ttl tac" styleClass="tbl_bdr tac" style="width:5%;"><apex:outputText value="{0, number,###,###,##0}"><apex:param value="{!OP.Quantity}" /></apex:outputText></apex:column>
                            <apex:column headerValue="Description" value="{!OP.PriceBookEntry.Name}" headerClass="column_ttl" styleClass="tbl_bdr" rendered="{!OP.Lease_Service_Group__c = 'NQP' && Opportunity.Language__c = 'ENGLISH'}"></apex:column>
                            <apex:column headerValue="Description" value="{!OP.Product2.Product_name_french__c}" headerClass="column_ttl" styleClass="tbl_bdr" rendered="{!OP.Lease_Service_Group__c = 'NQP' && Opportunity.Language__c = 'FRENCH'}"></apex:column>
                            <apex:column rendered="{!OP.Lease_Service_Group__c = 'NQP'}" headerValue="{!lblSubTot}" value="{!OP.Lease_NQP__c}" headerClass="column_ttl tac" styleClass="tbl_bdr tar" style="width:15%;"></apex:column>
                        </apex:dataTable>

<apex:dataTable value="{!Opportunity.opportunityLineItems}" var="OP" style="width:98.7%">
                            <apex:column rendered="{!OP.TR_Service_Group__c = 'NQP'}" headerValue="TR Code" headerClass="column_ttl tac" styleClass="tbl_bdr tac" style="width:10%;"><apex:outputText value="{!OP.TR_Service_Group__c}"/></apex:column>
                            <apex:column rendered="{!OP.TR_Service_Group__c = 'NQP'}" headerValue="{!lblQty}" headerClass="column_ttl tac" styleClass="tbl_bdr tac" style="width:5%;"><apex:outputText value="{0, number,###,###,##0}"><apex:param value="{!OP.Quantity}" /></apex:outputText></apex:column>
                            <apex:column headerValue="Description" value="{!OP.PriceBookEntry.Name}" headerClass="column_ttl" styleClass="tbl_bdr" rendered="{!OP.TR_Service_Group__c = 'NQP' && Opportunity.Language__c = 'ENGLISH'}"></apex:column>
                            <apex:column headerValue="Description" value="{!OP.Product2.Product_name_french__c}" headerClass="column_ttl" styleClass="tbl_bdr" rendered="{!OP.TR_Service_Group__c = 'NQP' && Opportunity.Language__c = 'FRENCH'}"></apex:column>
                            <apex:column rendered="{!OP.TR_Service_Group__c = 'NQP'}" headerValue="{!lblSubTot}" value="{!OP.TotalPrice}" headerClass="column_ttl tac" styleClass="tbl_bdr tar" style="width:15%;"></apex:column>
                        </apex:dataTable>


 
Please let me know if more info is needed, but this is what we had originally:
 
<apex:column 
headerValue="Description" value="{!OP.PriceBookEntry.Name}" headerClass="column_ttl" 
rendered="{!Opportunity.Language__c = 'ENGLISH'}">
</apex:column>

I then changed it by adding another filter to "rendered"...
 
<apex:column 
headerValue="Description" value="{!OP.PriceBookEntry.Name}" headerClass="column_ttl" rendered="{!Opportunity.Language__c = 'ENGLISH' && OP.Lease_Service_Group__c = 'NQP'}">
</apex:column>

It is working in that it is showing me only the Opportunity Products (OP) that have a Lease Service Group of "NQP", and it is showing the English names, but for some reason my headerValue "Description" no longer appears on the page.  The column no longer has a header.

Is there something I don't understand or did wrong to cause this?

Any help would be appreciated! 
We use the "Convert Products to Assets" app from app exchange.  I have emailed them, but got no response so wondering if anyone can help me with my problem.  I have found no other cases where people were trying to do what I'm trying to do and I'm having trouble getting it to work.

We recently decided we need 2 record types for our Assets so when we use the convert products to assets, we need the Visualforce page to include the option to indicate the correct Record Type.  It should be fairly easy since the page is already built so copy and paste the code, put the correct field value and voila, but record type is a special kind of field so it is not working.  I tried RecordType.Id too to see if that would work, but no luck....any suggestions would be appreciated!! 

Sample code below and I included what I tried for the Record Type ID. 
<apex:column >
            <apex:facet name="header">
              <div class="slds-text-title_caps">{!$ObjectType.Asset.Fields.SerialNumber.Label}</div>
            </apex:facet>
            <apex:inputField value="{!val.asset.SerialNumber}" styleClass="{!IF(val.asset.Quantity > 0,'','field-disabled')}"/>
          </apex:column>
          <apex:column headerValue="Record Type">
            <apex:facet name="header">
              <div class="slds-text-title_caps">{!$ObjectType.Asset.Fields.RecordType.Id.Label}</div>
            </apex:facet>
            <apex:inputField value="{!val.asset.RecordType.Id}" styleClass="{!IF(val.asset.Quantity > 0,'','field-disabled')}"/>
          </apex:column>

 
I'm new to Apex and am have trouble gathering the info I need to properly build my trigger.  

We create our contacts from an account and we also create our opportunities from the account.  So account name is a common factor between contact and opportunity.

I need to automatically populate a contact lookup field in the opportunity.  This field is called Signing_Contact__c.  In the Contacts object, we have a field called Contact_Role__c which is a picklist which includes the value "SIGNING CONTACT".

Basically, what I need to happen upon creation of an Opportunity is for it to query the Contacts object, and match up the associated Account IDs and if that is successful, it needs to query the field Contact_Role__c of associated records and locate the one that has "SIGNING CONTACT" as the value.  It then needs to take the Contact.Name and populate the Opportunity.Signing_Contact__c field.

If more than one record with "SIGNING CONTACT" or none at all, the trigger can stop.

I'm really not sure how to put it all together.  I think it is a bit complicated for my first try at triggers.  I'm not even sure if this is possible.  This is what I have so far...help would be greatly appreciated!!
 
Trigger OppSigningContact (before insert, before update) { 

for (Opportunity  o: trigger.new) {
       if(o.Signing_Contact__c = null) 
			List<Account> a = [SELECT Id, Name FROM Account WHERE Id = o.AccountId];

 
Hello, I'm working on a visualforce page and I can't seem to get my tables to line up the way I want them to. I've had some success, but am just having trouble finishing it off.

I need it to look like this:
User-added image
But so far I have only managed to make it look like this:
User-added image

Here is the HTML 
<table class="Cx" width="98.7%">
        <tr><td class="tac rPad" colspan="4"><strong>Telco Info</strong></td></tr>
        <tr><td class="tar rPad">Sales Order:</td><td>company name</td></tr>
        <tr><td class="tar rPad">Sales Rep:</td><td>Rebiller Group</td><td>TN:</td><td>1-800-555-5555</td></tr>
        <tr><td class="tar rPad">E-Mail:</td><td>ao@ao.ca</td></tr>
        <tr><td class="tar rPad">Original E-Mail:</td><td>ao@selectcomtelecom.ca</td></tr>
        <tr><td class="tar rPad">Original Fax:</td><td>555-555-5555</td></tr>
    </table>

    <br/>

    <div width="98.7%" class="col-container">
        
    
    <table class="Cx col" >
        <th><strong>Activty</strong></th>
        <tr><td>x</td><td>New</td><td>TF</td></tr>
        <tr><td>Add</td><td>Disc</td></tr>
		<tr><td>Change</td></tr>
        <tr><td>Seasonal Disc</td></tr>        
        <tr><td>Reconnect Date</td></tr>
     </table>

&nbsp;
    
      
    <table class="Cx col" >
		<th><strong>Service Type</strong></th>
        <tr><td>Service</td></tr>
        <tr><td>Cross Border-MCI</td></tr>
        <tr><td>Cross Border-AT&amp;T</td></tr>
        <tr><td>Other</td></tr>
        <tr><td><strong>Mass Calling</strong></td></tr>
        <tr><td>Yes</td><td>x</td><td>No</td></tr>
    </table>
    
    &nbsp;

    <table>
        <tr><td>
        <table width="100%" class="Cx col">

        <tr><td><strong>Dates</strong></td></tr>
        <tr><td>Application Date:</td>
            <td><apex:outputText value="{0,date,yyyy-MM-dd}"><apex:param value="{!Client_Line__c.LASTMODIFIEDDATE}" /></apex:outputText></td>
		</tr>
        <tr><td>Due Date: ??</td><td>what is the merge field?</td></tr>  

        </table>
        &nbsp;
        <table width="100%" class="Cx col">
        <tr><td><strong>Reference of Calls</strong></td></tr>
        <tr><td>Yes</td><td>x</td><td>No</td></tr>
        <tr><td>Refer Calls To</td></tr>
        </table>
            </td>
        </tr>
    </table>
    </div>

And the CSS is
.Cx{
    border: 1px solid #534e43;
}
.tac{
    text-align: center;
}
.tar{
    text-align: right;
}
.tal{
    text-align: left;
}
.rPad{
    padding-right: 10px;
}
.col-container {
  display: table;
  width: 98.7%;
}
.col {
  display: table-cell;
  padding: 16px;
}
Any help would be appreciated!  Been struggling with this for awhile now.
I'm working on a custom classic email template using HTML and when I see the preview and when I test it in my browser, my alignment is good, but when I send a test email, the alignment is off.  

Any suggestions what I can do to resolve this?

Here is what it looks like in preview:
User-added image

Here is the email test:

User-added image
Here is a bit of my code:
<body style="font-family: Montserrat, sans-serif;">
<style>
	.progress{width: 80%; height: auto; margin:0 auto 0 auto; color: #404040; font-size: 14px; }
	.p{font: Montserrat, sans-serif; text-align: left; }
</style>

<table class="progress" cellpadding="2px">
	<tr>
		<td style="vertical-align: bottom; text-align: center;" >
			<img src="https://selectcomtelecom--c.na72.content.force.com/servlet/servlet.ImageServer?id=0151H0000085hCE&oid=00DA0000000gd8G&lastMod=1581343779000" alt="orange-circle" height:20 ></td>
		<td style="">
			<p><strong>Site Survey Scheduled</strong></p>
		</td>
	</tr>

	<tr>
		<td style="vertical-align: top; text-align: center;">
			<img src="https://selectcomtelecom--c.na72.content.force.com/servlet/servlet.ImageServer?id=0151H0000085hCJ&oid=00DA0000000gd8G&lastMod=1581343802000" alt="orange-line" height="120" ></td>
		<td style="vertical-align: top; font-size: 12px;">
			<p>Friday, February 7</p>
		</td>
	</tr>

	<tr>
		<td style="vertical-align: top; text-align: center;">
			<img src="https://selectcomtelecom--c.na72.content.force.com/servlet/servlet.ImageServer?id=0151H0000085hCO&oid=00DA0000000gd8G&lastMod=1581343827000" alt="grey-circles" height="20" ></td>
		<td style="vertical-align: top;">
			<p><strong>Order Received</strong></p>
		</td>
	</tr>

	<tr>
		<td style="vertical-align: top; text-align: center;">
			<img src="https://selectcomtelecom--c.na72.content.force.com/servlet/servlet.ImageServer?id=0151H0000085hCT&oid=00DA0000000gd8G&lastMod=1581343849000" alt="grey-lines" height="20" ></td>
		<td style="vertical-align: top;">
			<p></p>
		</td>
	</tr>

 
I’m having trouble with my test class…not sure what I’m doing wrong, but I’m getting the following errors:
Illegal assignment from Map to List (line 6)
Method does not exist or incorrect signature: void getRecTypeId(String) from the type RecordTypeSelector (line 11)

My test class is for a custom record type selector component on my Asset object for my customer object OrderProject__c.

Any help would be appreciated!!
 
@isTest
public class TestRecordTypeSelector {


static testmethod void testFetchRecordTypes() {
    List<String> value = RecordTypeSelector.fetchRecordTypeValues('Asset');
  }

 static testmethod void testgetRecordTypeId() {
    String recordTypeLabel = 'Avaya';
    ID testId = RecordTypeSelector.getRecTypeId(recordTypeLabel);
    System.assert(testId != null);
  }
}

 
Hello,

I'm a novice at Apex code and am trying to adjust my extension for SavePDF so that it saves as a file as well.  I get an error message related to the line that says:  file.Origin = 'a';

I am indicating the wrong origin or something?  Or do I need to complete the attachment fully before I can add the file?  Any help would be appreciated!

 
public pageReference savePDF(){
    
        Date dateToday = Date.today();
        String sMonth = String.valueof(dateToday.month());
        String sDay = String.valueof(dateToday.day());
        if(sMonth.length()==1){
          sMonth = '0' + sMonth;
        }
        if(sDay.length()==1){
          sDay = '0' + sDay;
        }
        String sToday = String.valueof(dateToday.year())+ '-' + sMonth +  '-' + sDay ;
        
      PageReference pagePdf = new PageReference('/apex/SalesAgreement_PDF');
          pagePdf.getParameters().put('id', idVal);
          Blob pdfPageBlob;
          pdfPageBlob = pagePdf.getContentAsPDF();
                 
          Attachment a = new Attachment();
          a.Body = pdfPageBlob;
          a.ParentID = idVal;
          a.Name = 'Service_Agreement_' + strOppName + '_' + sToday + '.pdf';
          a.Description = 'Service Agreement_' + sToday;
          insert a;

          ContentVersion file = new ContentVersion();
		  file.Title = 'Service_Agreement_' + strOppName + '_' + sToday + '.pdf';
		  file.PathOnClient = 'Service_Agreement_' + Datetime.now().getTime() + '.txt';
		  file.VersionData = Blob.valueOf('Service_Agreement_' + 
		  Datetime.now().getTime() + '.txt');
		  file.Origin = 'a';
		  insert file;         
    
        
        pop_msg='Successfully saved';
        displayPopup = true;  
       
        
        opp.Signature_Date__c = null;
        opp.Signature_Key__c = '';
        opp.Signature_Name__c = '';
        opp.Signature_URL__c = null;
        opp.Signature__c = null;

        
        update opp;
      return new PageReference('/apex/SalesAgreement_HTML?id=' + idVal);
      
        
    }



 
My PMs want to see which other opportunities have been signed when they receive an approved opportunity.  I created a VF page add an opportunity related list and it works, but I can't figure out how to ONLY show those where StageName = 'SIGNED'.  

Any help would be appreciated...
 
<apex:page standardController="Opportunity" showHeader="false" sidebar="false" readOnly="true">
<style type="text/css">
.actionColumn {display:none; visibility:hidden}
</style>

    <apex:relatedList list="Account.Opportunities">
    <apex:facet name="header"><center><b></b></center></apex:facet>
    </apex:relatedList>

</apex:page>

 
I think I know WHY I'm getting the error, but still haven't solved it.

I have a visualforce page that renders as PDF.  It is a receipt for returned hardware.  We have a Hardware custom object and my VF page has a conditional rendering to only show the Hardware Product Name and Serial number originally, if the "Client_Returned_Date__c" = TODAY. 

We then got the error message above for one account and I realized it is probably because some records may have nothing populated in the "Client_Returned_Date__c" field so I created a Date Formula field that says: IF(Client_Returned_Date__c = TODAY(), Client_Returned_Date__c, DATE(2000,01,01) ). It means the person would have to update all previous hardware, but there is not many so it isn't that much and going forward the field will always be populated so it won't always be an issue.

So I updated my VF page conditional rendering to use this new formula field instead and tested.  My formula field works as expected, but I still get the error message above (even though there is now a value for each record for this formula field.  I also checked the other fields indicated (Product name and Serial number) and there are values in all.

Any suggestions what I'm overlooking?

Here is the VF page if it helps!:
 
<apex:page standardController="Account" applyHtmlTag="true" showHeader="false" renderAs="PDF">

<apex:stylesheet value="{!$Resource.AssetReceipt_PDF}"/>
<apex:stylesheet value="http://fonts.googleapis.com/css?family=Open+Sans"/>



      
    <table cellspacing="0" border="0" cellpadding="0" width="98%">  
        <tr>
            <td width="80%" valign="top"><apex:image id="logo" url="{!$Resource.logo_bkp}"/> </td>
            <td width="18%">               
                <table id="servicetbl" cellspacing="0" border="0" cellpadding="5">
                    <tr><td colpsan="3"></td></tr>     
                    <tr>
                    <td class="rt" width="20%">Date:&nbsp;<apex:outputText value="{0,date,yyyy-MM-dd 'Time:' hh:mm}"> <apex:param value="{!NOW () - 0.208333}" /></apex:outputText></td>                    
                    </tr>
                </table>
            </td>
        </tr>
    </table>   
    
    <br clear="all" />
    <div class="full_line">{!Account.Name}</div><br clear="all"/>
    <div class="full_line">{!Account.AccountNumber}</div><br clear="all"/>

    <div >
        <br/>
        <br/>
        <h2>ÉQUIPEMENT RETOURNÉ</h2><br clear="all"/>
        <apex:dataTable value="{!Account.Hardware__r}" var="AH" columns="6" cellPadding="0" border="1" width="100%"  headerclass="Mheader_sm" title="Returned Equipment">
            
            <apex:column headerValue="PRODUCT NAME" rendered="{!IF(AH.Client_Returned_Date_VF__c = TODAY(),true,false)}" value="{!AH.Product_Txt__c}" styleClass="tbl_bdr" /> 
            <apex:column headerValue="SERIAL #" rendered="{!IF(AH.Client_Returned_Date_VF__c = TODAY(),true,false)}" value="{!AH.Serial_Number__c}"  styleClass="tbl_bdr"/>

        </apex:dataTable>
    </div>    
   
    <div class="full_line">
        
    <table>
    <tr>
    <td style="border-bottom:1px solid #000000; height:75px; width:40%;"></td>
    </tr>  
    <tr>
    <td>Heather Hanson</td>
    </tr>
    </table>
    </div>
    
        <div class="footerC">
            <div class="cover_footer">My company info</div>    
        </div>
           
 
 </apex:page>

 
I'm still reallly new to triggers.  I have 2 custom objects, "Work_Order__c" and "OrderProject__c", Work Order is a child of Account and Order Project is just related to Account with a look up field.

Order Project and Work Order are also related.  I have a related list for Work Order in the Order Project object. So Work Orders are created from an Order Project.

I created a field in Order Project called "Installatin_WO__c".  I need this field to be populated with the "Name" of the Work Order in the related list found in the Order Project that has the Work_Order_Type__c of "Installation".

I've only ever successfully created one trigger before and it is very similar to what I want to accomplish here, but I'm running into a couple of errors so I think I may be lacking understanding....

Below is what I have and the 2 error messages I have are:


Line: 9 Name, Work_Order_Type__c from Work_Order__c Where Work_Order_Type__c
                              ^
ERROR at Row:1:Column:60
Didn't understand relationship 'Work_Order__c' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.


AND

Line 17: Variable does not exist: WO

Any help correcting this would be greatly appreciated!!
trigger PM_WO_Installation on OrderProject__c (before insert, before update) {

set<Id> AccountIds = new set<Id>();
for (OrderProject__c  pm: trigger.new) {
	AccountIds.add(pm.Account_ID__c);
}
map<Id, Account> AccountWOMap = new map<Id, Account>();
list<Account> AccWOs = new list<Account>();
AccWOs = [Select Id, Name, (Select Id, Name, Work_Order_Type__c from Work_Order__c Where Work_Order_Type__c = 'Installation') from Account where Id IN : AccountIds];
for(Account acc : AccWOs){
    AccountWOMap.put(acc.Id, acc);
}
    for (OrderProject__c  pm: trigger.new) {
       if(pm.Installation_WO__c == null){
			Account Acc = AccountWOMap.get(pm.Account_ID__c);
			if(Acc != null){
				List<Work_Order__c> WO = new list<Work_Order__c>(Acc.WO);
				if(WO.size() == 1){
					pm.Installation_WO__c = WO[0].Id;
				}
			}
		}
	}

}

 
Hello All,

We have created a lookup filter on a custom object. It works for all other users in a profile as expected , except for one user. The object permission is public read/write and there are no permission sets or field level security preventing user from viewing records. If we remove the lookup filter the same user can see all the records. 
Any idea what is going on and how to fix it? 
Thank you
  • February 27, 2017
  • Like
  • 0
I created a VF page for a custom object and would like to have the column header "Certification Year" sorted by default in decending order.

Is there an easy way to do this without a controller? I'm new to coding and am not familiar with this. Or can someone help me with getting it done?

This is the code I have for the visualforce page:


<apex:page standardController="Account">
   
      You are viewing the {!account.name} account.

      <apex:pageBlock title="ONS's">

      <apex:pageBlockTable value="{!account.ONC_s__r}" var="onc">

         <apex:column value="{!onc.Name}"/>
         <apex:column value="{!onc.Owner.name}"/>
         <apex:column value="{!onc.Certification_Year__c}"  />
         <apex:column value="{!onc.Practice_Setting__c}"/>
         

      </apex:pageBlockTable>

   </apex:pageBlock>

</apex:page>