• sryan
  • NEWBIE
  • 25 Points
  • Member since 2009

  • Chatter
    Feed
  • 1
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 5
    Replies
I would appreciate any ideas of suggestions for writing a Fomula that looks at two fields (Date/Time Fields) and then sets a Text value (maybe  a Case statement) of "Day Shift" or "Night Shift" as follows:

Day Shift = 6 am to 6 pm (with same day)
Night Shift = 6 pm to 6am (across 2 days)

Thanks in advance for any ideas about ways to do this.

Sean
  • May 19, 2014
  • Like
  • 1

Hello - I'm trying to dynamically center apex:OutputPanel text that I'm laying on top of a background image for a Visualforce2PDF Email Template. The majority of the Visualforce gets rendered as a PDF attachment. I'm able to get the image to stretch to its full size, but I'm (so far) unable to get the text centered.

 

I would appreciate any help in figuring this out.

 

Thanks,

SRyan

 

My VF Email template code:

 

<messaging:emailTemplate subject="Your Completed ACME Fire Proteciton Products Training Certificate:{!relatedTo.Course__c}" recipientType="Contact" relatedToType="Enrollment__c">
  <messaging:plainTextEmailBody >
        Dear {!recipient.name},
           
        Congratulations for successfully completing the ACME Fire Protection {!relatedTo.Course__c} course. Please see your Certificate of Completion attached to this message.

        Regards,
        John Doe
        ACME Fire Protection Products
        Director, Technical Services and Training
  </messaging:plainTextEmailBody>
  <messaging:attachment renderAs="PDF" filename="{!relatedTo.Name}">
  <html>
    <script type="text/javascript" src="/js/functions.js"></script>
    <script src="/soap/ajax/11.1/connection.js"></script>
    <script language="javascript">
        function init() {
                sforce.connection.sessionId = '{!$Api.Session_ID}';
                }
     </script>
  <style>
    @page {
    /* Landscape orientation */
    size:landscape;
    margin:0.25in;
    }
    body {
    background-size:976px 689px;
    }

    #BackgroundImage {
        width: 976px;
        height: 689px;
        border-style: none;
        background-image: url('{!URLFOR($Resource.TycoFPTrainingCertbackgroundimage)}');
        }
    
    #Text {
        text-align: center;
        }
        
    .stretch {
        width:100%;
        height:100%;
        }
    .largeBoldFont { font-weight:bold; font-size:24px; }
    .normalFont { font-weight:normal; font-size:12px; }
    .mediumBoldFont { font-weight:bold; font-size:18px; }
    .normalBoldFont { font-weight:bold; font-size:12px; }

  </style>    

  <body onload="init();">
  
  <div id="BackgroundImage">
    <div id="Text">
      <apex:outputPanel >
        <apex:panelGroup >
          <p><apex:outputText value="We Hereby confirm that" styleclass="normalFont"/></p>
          <p><apex:outputText value="{!relatedTo.Contact__r.FirstName}" styleclass="largeBoldFont"/> <apex:outputText value=" "/> <apex:outputText value="{!relatedTo.Contact__r.LastName}" styleclass="largeBoldFont"/></p>
          <p><apex:outputText value="has completed the training program" styleclass="normalFont"/></p>
          <p><apex:outputText value="{!relatedTo.Course__c}" styleclass="largeBoldFont"/> <apex:outputText value=" - " styleclass="largeFont"/> <apex:outputText value="{!relatedTo.Class_Number__c}" styleclass="largeBoldFont"/></p>
          <p><apex:outputText value="on this day " styleclass="normalFont"/><apex:outputText value="{!Day(relatedTo.Date_Certified__c)}" styleclass="normalBoldFont"/><apex:outputText value=" of this month " styleclass="normalFont"/><apex:outputText value="{!Month(relatedTo.Date_Certified__c)}" styleclass="normalBoldFont"/><apex:outputText value=" of this year " styleclass="normalFont"/><apex:outputText value="{!Year(relatedTo.Date_Certified__c)}" styleclass="normalBoldFont"/> <apex:outputText value=" and has been awarded a total of " styleclass="normalFont"/><apex:outputText value="{!relatedTo.Hours__c}" styleclass="normalBoldFont"/><apex:outputText value=" Contact Hour(s)." styleclass="normalFont"/></p>
          <p><apex:outputText value="This is an authorization to " styleclass="normalFont"/> <apex:outputText value="{!relatedTo.Certificate_Activity__c}" styleclass="normalBoldFont"/><apex:outputText value=" for " styleclass="normalFont"/><apex:outputText value="{!relatedTo.Course__c}" styleclass="normalBoldFont"/><br/>
          <apex:outputText value="as a Distributor of " styleclass="normalFont"/><apex:outputText value="{!relatedTo.Class__r.Course__r.Brand__c}" styleclass="normalBoldFont"/><apex:outputText value=" - Contract NO. " styleclass="normalFont"/> <apex:outputText value="{!relatedTo.TFPP_Contract__r.Name}" styleclass="normalBoldFont"/><br/>
          <apex:outputText value="This authorization expires three years from the date of training described above." styleclass="normalFont"/></p>
        </apex:panelGroup>
      </apex:outputPanel>
    </div>
  </div>
  </body>
  </html>
  </messaging:attachment>
</messaging:emailTemplate>

 

 

  • January 22, 2013
  • Like
  • 0

Hello.

 

I'm trying to resolve a problem I'm having in VF with getting a custom controller to work.  I based my Apex code and VisualForce markup on an example that I got out of the VF Salesforce Pages Developer's Guide. I'm new to VF and Apex, so I'll do my best to explain.

 

Objective: Write a custom controller (Apex class, e.g. similarConferences) that returns a list of records for a custom object (e.g. Conference__c) selected by a variable field from the custom object (e.g. {!Conference__c.Type_of_Technology__c}).

 

Expected behavior: View the detail of a record on the Conference Tab and click a custom link associated with the custom object to open a new window (VF Page, e.g. similarConference) that renders a list of records for all Conference records that have the same type of technology (i.e. Type_of_Technology__c = current record).

 

Actual behavior: I get an error "Error: Unknown property 'similarConferences.Conference__c'" and two Quick Fixes 1) Create Apex property 'similarConferences.Conference__c' and 2) Create Apexmethod 'similarConferences.getConference__c' when I try testing my VF Page named "similarConference."

 

 

Custom Controller code:

 

public class similarConferences {
    public ApexPages.StandardSetController setCon {
        get {
            if(setCon == null) {
              setCon = new ApexPages.StandardSetController(Database.getQueryLocator([select
 Name, Conference_Date__c, Location__c From Conference__c Where Type_of_Technology__c  = '{!Conference__c.Type_of_Technology__c}']));
}
return setCon;
}
set;
}
public List<Conference__c> getConferences() {
return (List<Conference__c>) setCon.getRecords();
}
}

 

Apex Page markup:

 

<apex:page controller="similarConferences" sidebar="true">
  <apex:variable value="{!Conference__c}" var="con"/>
    <apex:pageBlock title="Similar Conferences">
      <h1>This page summarizes all conferences promoting {!con.Type_of_Technology__c} technology!</h1><br>
      <apex:outputLabel value="Total {!con.Type_of_Technology__c} Conferences: "/>
       <apex:pageBlockSection title="Conference List">
           <apex:dataTable value="{!Conference__c}" var="con" id="theTable">
               <apex:column id="firstColumn">
               <b><apex:outputLabel value="Name"/></b><br>
               <apex:outputText value="{!con.name}"/>
               </apex:column></br>
               <apex:column id="secondColumn">
               <b><apex:outputLabel value="Date"/></b><br>
               <apex:outputText value="{!con.Conference_Date__c}"/>
               </apex:column>
               <apex:column id="thirdColumn">
               <b><apex:outputLabel value="Location"/></b><br>
               <apex:outputText value="{!con.Location__c}"/>
               </apex:column>
           </apex:dataTable>       
       </apex:pageBlockSection></br>
    </apex:pageBlock>
</apex:page>

 

Any help is greatly appreciated.

 

Thanks,

S Ryan

  • March 12, 2009
  • Like
  • 0
I would appreciate any ideas of suggestions for writing a Fomula that looks at two fields (Date/Time Fields) and then sets a Text value (maybe  a Case statement) of "Day Shift" or "Night Shift" as follows:

Day Shift = 6 am to 6 pm (with same day)
Night Shift = 6 pm to 6am (across 2 days)

Thanks in advance for any ideas about ways to do this.

Sean
  • May 19, 2014
  • Like
  • 1

Hello - I'm trying to dynamically center apex:OutputPanel text that I'm laying on top of a background image for a Visualforce2PDF Email Template. The majority of the Visualforce gets rendered as a PDF attachment. I'm able to get the image to stretch to its full size, but I'm (so far) unable to get the text centered.

 

I would appreciate any help in figuring this out.

 

Thanks,

SRyan

 

My VF Email template code:

 

<messaging:emailTemplate subject="Your Completed ACME Fire Proteciton Products Training Certificate:{!relatedTo.Course__c}" recipientType="Contact" relatedToType="Enrollment__c">
  <messaging:plainTextEmailBody >
        Dear {!recipient.name},
           
        Congratulations for successfully completing the ACME Fire Protection {!relatedTo.Course__c} course. Please see your Certificate of Completion attached to this message.

        Regards,
        John Doe
        ACME Fire Protection Products
        Director, Technical Services and Training
  </messaging:plainTextEmailBody>
  <messaging:attachment renderAs="PDF" filename="{!relatedTo.Name}">
  <html>
    <script type="text/javascript" src="/js/functions.js"></script>
    <script src="/soap/ajax/11.1/connection.js"></script>
    <script language="javascript">
        function init() {
                sforce.connection.sessionId = '{!$Api.Session_ID}';
                }
     </script>
  <style>
    @page {
    /* Landscape orientation */
    size:landscape;
    margin:0.25in;
    }
    body {
    background-size:976px 689px;
    }

    #BackgroundImage {
        width: 976px;
        height: 689px;
        border-style: none;
        background-image: url('{!URLFOR($Resource.TycoFPTrainingCertbackgroundimage)}');
        }
    
    #Text {
        text-align: center;
        }
        
    .stretch {
        width:100%;
        height:100%;
        }
    .largeBoldFont { font-weight:bold; font-size:24px; }
    .normalFont { font-weight:normal; font-size:12px; }
    .mediumBoldFont { font-weight:bold; font-size:18px; }
    .normalBoldFont { font-weight:bold; font-size:12px; }

  </style>    

  <body onload="init();">
  
  <div id="BackgroundImage">
    <div id="Text">
      <apex:outputPanel >
        <apex:panelGroup >
          <p><apex:outputText value="We Hereby confirm that" styleclass="normalFont"/></p>
          <p><apex:outputText value="{!relatedTo.Contact__r.FirstName}" styleclass="largeBoldFont"/> <apex:outputText value=" "/> <apex:outputText value="{!relatedTo.Contact__r.LastName}" styleclass="largeBoldFont"/></p>
          <p><apex:outputText value="has completed the training program" styleclass="normalFont"/></p>
          <p><apex:outputText value="{!relatedTo.Course__c}" styleclass="largeBoldFont"/> <apex:outputText value=" - " styleclass="largeFont"/> <apex:outputText value="{!relatedTo.Class_Number__c}" styleclass="largeBoldFont"/></p>
          <p><apex:outputText value="on this day " styleclass="normalFont"/><apex:outputText value="{!Day(relatedTo.Date_Certified__c)}" styleclass="normalBoldFont"/><apex:outputText value=" of this month " styleclass="normalFont"/><apex:outputText value="{!Month(relatedTo.Date_Certified__c)}" styleclass="normalBoldFont"/><apex:outputText value=" of this year " styleclass="normalFont"/><apex:outputText value="{!Year(relatedTo.Date_Certified__c)}" styleclass="normalBoldFont"/> <apex:outputText value=" and has been awarded a total of " styleclass="normalFont"/><apex:outputText value="{!relatedTo.Hours__c}" styleclass="normalBoldFont"/><apex:outputText value=" Contact Hour(s)." styleclass="normalFont"/></p>
          <p><apex:outputText value="This is an authorization to " styleclass="normalFont"/> <apex:outputText value="{!relatedTo.Certificate_Activity__c}" styleclass="normalBoldFont"/><apex:outputText value=" for " styleclass="normalFont"/><apex:outputText value="{!relatedTo.Course__c}" styleclass="normalBoldFont"/><br/>
          <apex:outputText value="as a Distributor of " styleclass="normalFont"/><apex:outputText value="{!relatedTo.Class__r.Course__r.Brand__c}" styleclass="normalBoldFont"/><apex:outputText value=" - Contract NO. " styleclass="normalFont"/> <apex:outputText value="{!relatedTo.TFPP_Contract__r.Name}" styleclass="normalBoldFont"/><br/>
          <apex:outputText value="This authorization expires three years from the date of training described above." styleclass="normalFont"/></p>
        </apex:panelGroup>
      </apex:outputPanel>
    </div>
  </div>
  </body>
  </html>
  </messaging:attachment>
</messaging:emailTemplate>

 

 

  • January 22, 2013
  • Like
  • 0

Hello.

 

I'm trying to resolve a problem I'm having in VF with getting a custom controller to work.  I based my Apex code and VisualForce markup on an example that I got out of the VF Salesforce Pages Developer's Guide. I'm new to VF and Apex, so I'll do my best to explain.

 

Objective: Write a custom controller (Apex class, e.g. similarConferences) that returns a list of records for a custom object (e.g. Conference__c) selected by a variable field from the custom object (e.g. {!Conference__c.Type_of_Technology__c}).

 

Expected behavior: View the detail of a record on the Conference Tab and click a custom link associated with the custom object to open a new window (VF Page, e.g. similarConference) that renders a list of records for all Conference records that have the same type of technology (i.e. Type_of_Technology__c = current record).

 

Actual behavior: I get an error "Error: Unknown property 'similarConferences.Conference__c'" and two Quick Fixes 1) Create Apex property 'similarConferences.Conference__c' and 2) Create Apexmethod 'similarConferences.getConference__c' when I try testing my VF Page named "similarConference."

 

 

Custom Controller code:

 

public class similarConferences {
    public ApexPages.StandardSetController setCon {
        get {
            if(setCon == null) {
              setCon = new ApexPages.StandardSetController(Database.getQueryLocator([select
 Name, Conference_Date__c, Location__c From Conference__c Where Type_of_Technology__c  = '{!Conference__c.Type_of_Technology__c}']));
}
return setCon;
}
set;
}
public List<Conference__c> getConferences() {
return (List<Conference__c>) setCon.getRecords();
}
}

 

Apex Page markup:

 

<apex:page controller="similarConferences" sidebar="true">
  <apex:variable value="{!Conference__c}" var="con"/>
    <apex:pageBlock title="Similar Conferences">
      <h1>This page summarizes all conferences promoting {!con.Type_of_Technology__c} technology!</h1><br>
      <apex:outputLabel value="Total {!con.Type_of_Technology__c} Conferences: "/>
       <apex:pageBlockSection title="Conference List">
           <apex:dataTable value="{!Conference__c}" var="con" id="theTable">
               <apex:column id="firstColumn">
               <b><apex:outputLabel value="Name"/></b><br>
               <apex:outputText value="{!con.name}"/>
               </apex:column></br>
               <apex:column id="secondColumn">
               <b><apex:outputLabel value="Date"/></b><br>
               <apex:outputText value="{!con.Conference_Date__c}"/>
               </apex:column>
               <apex:column id="thirdColumn">
               <b><apex:outputLabel value="Location"/></b><br>
               <apex:outputText value="{!con.Location__c}"/>
               </apex:column>
           </apex:dataTable>       
       </apex:pageBlockSection></br>
    </apex:pageBlock>
</apex:page>

 

Any help is greatly appreciated.

 

Thanks,

S Ryan

  • March 12, 2009
  • Like
  • 0